Skip to content

Commit e272950

Browse files
committed
Safer recovery
1 parent 264964b commit e272950

File tree

2 files changed

+149
-2
lines changed

2 files changed

+149
-2
lines changed

src/Compiler/TypedTree/TypedTreeOps.fs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5715,8 +5715,8 @@ let InferValReprInfoOfExpr g allowTypeDirectedDetupling ty partialArgAttribsL re
57155715
let fun_arity = vsl.Length
57165716
let dtys, _ = stripFunTyN g fun_arity (snd (tryDestForallTy g ty))
57175717
let partialArgAttribsL = Array.ofList partialArgAttribsL
5718-
assert (List.length vsl = List.length dtys)
5719-
5718+
if List.length vsl <> List.length dtys then ValReprInfo.emptyValData else
5719+
57205720
let curriedArgInfos =
57215721
(vsl, dtys) ||> List.mapi2 (fun i vs ty ->
57225722
let partialAttribs = if i < partialArgAttribsL.Length then partialArgAttribsL[i] else []

tests/fsharp/core/auto-widen/5.0/test.bsl

Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,11 @@ but here has type
134134

135135
test.fsx(64,50,64,71): typecheck error FS0001: All elements of a list must be implicitly convertible to the type of the first element, which here is 'int64'. This element has type 'int'.
136136

137+
test.fsx(67,20,67,23): typecheck error FS0001: This expression was expected to have type
138+
'obj'
139+
but here has type
140+
'int'
141+
137142
test.fsx(67,20,67,23): typecheck error FS0001: This expression was expected to have type
138143
'obj'
139144
but here has type
@@ -144,6 +149,16 @@ test.fsx(68,22,68,25): typecheck error FS0001: This expression was expected to h
144149
but here has type
145150
'int'
146151

152+
test.fsx(68,22,68,25): typecheck error FS0001: This expression was expected to have type
153+
'int64'
154+
but here has type
155+
'int'
156+
157+
test.fsx(69,26,69,29): typecheck error FS0001: This expression was expected to have type
158+
'int64'
159+
but here has type
160+
'int'
161+
147162
test.fsx(69,26,69,29): typecheck error FS0001: This expression was expected to have type
148163
'int64'
149164
but here has type
@@ -334,21 +349,54 @@ test.fsx(207,20,207,35): typecheck error FS0001: This expression was expected to
334349
but here has type
335350
'R'
336351

352+
test.fsx(207,20,207,35): typecheck error FS0791: This type is not a record type
353+
354+
test.fsx(207,20,207,35): typecheck error FS0763: The field 'F1' has been given a value, but is not present in the type 'obj'
355+
337356
test.fsx(210,22,210,41): typecheck error FS0001: This expression was expected to have type
338357
'obj'
339358
but here has type
340359
'R'
341360

361+
test.fsx(210,30,210,31): typecheck error FS0001: This expression was expected to have type
362+
'obj'
363+
but here has type
364+
'int'
365+
366+
test.fsx(210,33,210,34): typecheck error FS0001: This expression was expected to have type
367+
'obj'
368+
but here has type
369+
'int'
370+
342371
test.fsx(213,20,213,36): typecheck error FS0001: This expression was expected to have type
343372
'obj'
344373
but here has type
345374
'SR'
346375

376+
test.fsx(213,20,213,36): typecheck error FS0791: This type is not a record type
377+
378+
test.fsx(213,20,213,36): typecheck error FS0763: The field 'SF1' has been given a value, but is not present in the type 'obj'
379+
347380
test.fsx(216,22,216,43): typecheck error FS0001: This expression was expected to have type
348381
'obj'
349382
but here has type
350383
'SR'
351384

385+
test.fsx(216,31,216,32): typecheck error FS0001: This expression was expected to have type
386+
'obj'
387+
but here has type
388+
'int'
389+
390+
test.fsx(216,34,216,35): typecheck error FS0001: This expression was expected to have type
391+
'obj'
392+
but here has type
393+
'int'
394+
395+
test.fsx(219,20,219,33): typecheck error FS0001: This expression was expected to have type
396+
'obj'
397+
but here has type
398+
'U'
399+
352400
test.fsx(219,20,219,33): typecheck error FS0001: This expression was expected to have type
353401
'obj'
354402
but here has type
@@ -369,6 +417,11 @@ test.fsx(228,21,228,40): typecheck error FS0001: This expression was expected to
369417
but here has type
370418
'SU'
371419

420+
test.fsx(228,21,228,40): typecheck error FS0001: This expression was expected to have type
421+
'obj'
422+
but here has type
423+
'SU'
424+
372425
test.fsx(231,21,231,37): typecheck error FS0001: This expression was expected to have type
373426
'obj'
374427
but here has type
@@ -533,6 +586,11 @@ test.fsx(286,22,286,45): typecheck error FS0001: This expression was expected to
533586
but here has type
534587
'IComparable'
535588

589+
test.fsx(286,22,286,24): typecheck error FS0001: This expression was expected to have type
590+
'IComparable'
591+
but here has type
592+
'string'
593+
536594
test.fsx(287,22,287,24): typecheck error FS0001: This expression was expected to have type
537595
'obj'
538596
but here has type
@@ -558,6 +616,11 @@ test.fsx(291,21,291,30): typecheck error FS0001: This expression was expected to
558616
but here has type
559617
'string'
560618

619+
test.fsx(291,21,291,30): typecheck error FS0001: This expression was expected to have type
620+
'obj'
621+
but here has type
622+
'string'
623+
561624
test.fsx(292,24,292,26): typecheck error FS0001: This expression was expected to have type
562625
'obj'
563626
but here has type
@@ -673,21 +736,41 @@ test.fsx(337,9,338,34): typecheck error FS0001: This expression was expected to
673736
but here has type
674737
''a list'
675738

739+
test.fsx(338,30,338,32): typecheck error FS0001: This expression was expected to have type
740+
'int'
741+
but here has type
742+
'int64'
743+
676744
test.fsx(340,9,341,33): typecheck error FS0001: This expression was expected to have type
677745
'int64 seq'
678746
but here has type
679747
''a list'
680748

749+
test.fsx(341,30,341,31): typecheck error FS0001: This expression was expected to have type
750+
'int64'
751+
but here has type
752+
'int'
753+
681754
test.fsx(343,9,344,35): typecheck error FS0001: This expression was expected to have type
682755
'int64 seq'
683756
but here has type
684757
''a list'
685758

759+
test.fsx(344,32,344,33): typecheck error FS0001: This expression was expected to have type
760+
'int64'
761+
but here has type
762+
'int'
763+
686764
test.fsx(346,9,347,36): typecheck error FS0001: This expression was expected to have type
687765
'int64 seq'
688766
but here has type
689767
''a list'
690768

769+
test.fsx(347,32,347,34): typecheck error FS0001: This expression was expected to have type
770+
'int'
771+
but here has type
772+
'int64'
773+
691774
test.fsx(349,9,349,36): typecheck error FS0001: This expression was expected to have type
692775
'int64 seq'
693776
but here has type
@@ -703,11 +786,21 @@ test.fsx(353,9,354,40): typecheck error FS0001: This expression was expected to
703786
but here has type
704787
''a list'
705788

789+
test.fsx(354,37,354,38): typecheck error FS0001: This expression was expected to have type
790+
'int64'
791+
but here has type
792+
'int'
793+
706794
test.fsx(356,9,357,41): typecheck error FS0001: This expression was expected to have type
707795
'int64 seq'
708796
but here has type
709797
''a list'
710798

799+
test.fsx(357,37,357,39): typecheck error FS0001: This expression was expected to have type
800+
'int'
801+
but here has type
802+
'int64'
803+
711804
test.fsx(359,9,359,35): typecheck error FS0001: This expression was expected to have type
712805
'int64 seq'
713806
but here has type
@@ -718,11 +811,21 @@ test.fsx(361,9,362,36): typecheck error FS0001: This expression was expected to
718811
but here has type
719812
''a list'
720813

814+
test.fsx(362,21,362,22): typecheck error FS0001: This expression was expected to have type
815+
'int64'
816+
but here has type
817+
'int'
818+
721819
test.fsx(364,9,365,37): typecheck error FS0001: This expression was expected to have type
722820
'int64 seq'
723821
but here has type
724822
''a list'
725823

824+
test.fsx(365,21,365,23): typecheck error FS0001: This expression was expected to have type
825+
'int'
826+
but here has type
827+
'int64'
828+
726829
test.fsx(368,39,368,40): typecheck error FS0001: This expression was expected to have type
727830
'int64'
728831
but here has type
@@ -788,21 +891,41 @@ test.fsx(391,30,392,57): typecheck error FS0001: This expression was expected to
788891
but here has type
789892
''a array'
790893

894+
test.fsx(392,52,392,54): typecheck error FS0001: This expression was expected to have type
895+
'int'
896+
but here has type
897+
'int64'
898+
791899
test.fsx(393,30,394,56): typecheck error FS0001: This expression was expected to have type
792900
'int64 seq'
793901
but here has type
794902
''a array'
795903

904+
test.fsx(394,52,394,53): typecheck error FS0001: This expression was expected to have type
905+
'int64'
906+
but here has type
907+
'int'
908+
796909
test.fsx(395,30,396,58): typecheck error FS0001: This expression was expected to have type
797910
'int64 seq'
798911
but here has type
799912
''a array'
800913

914+
test.fsx(396,54,396,55): typecheck error FS0001: This expression was expected to have type
915+
'int64'
916+
but here has type
917+
'int'
918+
801919
test.fsx(397,30,398,59): typecheck error FS0001: This expression was expected to have type
802920
'int64 seq'
803921
but here has type
804922
''a array'
805923

924+
test.fsx(398,54,398,56): typecheck error FS0001: This expression was expected to have type
925+
'int'
926+
but here has type
927+
'int64'
928+
806929
test.fsx(399,30,399,59): typecheck error FS0001: This expression was expected to have type
807930
'int64 seq'
808931
but here has type
@@ -818,11 +941,21 @@ test.fsx(401,30,402,63): typecheck error FS0001: This expression was expected to
818941
but here has type
819942
''a array'
820943

944+
test.fsx(402,59,402,60): typecheck error FS0001: This expression was expected to have type
945+
'int64'
946+
but here has type
947+
'int'
948+
821949
test.fsx(403,30,404,64): typecheck error FS0001: This expression was expected to have type
822950
'int64 seq'
823951
but here has type
824952
''a array'
825953

954+
test.fsx(404,59,404,61): typecheck error FS0001: This expression was expected to have type
955+
'int'
956+
but here has type
957+
'int64'
958+
826959
test.fsx(405,31,405,59): typecheck error FS0001: This expression was expected to have type
827960
'int64 seq'
828961
but here has type
@@ -833,21 +966,35 @@ test.fsx(406,31,407,60): typecheck error FS0001: This expression was expected to
833966
but here has type
834967
''a array'
835968

969+
test.fsx(407,44,407,45): typecheck error FS0001: This expression was expected to have type
970+
'int64'
971+
but here has type
972+
'int'
973+
836974
test.fsx(408,31,409,61): typecheck error FS0001: This expression was expected to have type
837975
'int64 seq'
838976
but here has type
839977
''a array'
840978

979+
test.fsx(409,44,409,46): typecheck error FS0001: This expression was expected to have type
980+
'int'
981+
but here has type
982+
'int64'
983+
841984
test.fsx(429,10,437,16): typecheck error FS0001: This expression was expected to have type
842985
'int64 seq'
843986
but here has type
844987
'OtherSeq<'a>'
845988

989+
test.fsx(432,19,432,58): typecheck error FS0501: The member or object constructor 'ToString' takes 0 argument(s) but is here given 1. The required signature is 'Object.ToString() : string'.
990+
846991
test.fsx(448,9,450,49): typecheck error FS0001: This expression was expected to have type
847992
'int64 seq'
848993
but here has type
849994
'OtherSeqImpl<'a>'
850995

996+
test.fsx(450,14,450,29): typecheck error FS0501: The member or object constructor 'ToString' takes 0 argument(s) but is here given 1. The required signature is 'Object.ToString() : string'.
997+
851998
test.fsx(452,32,452,33): typecheck error FS0001: This expression was expected to have type
852999
'int64'
8531000
but here has type

0 commit comments

Comments
 (0)