File tree Expand file tree Collapse file tree 1 file changed +33
-2
lines changed
tests/FSharp.Compiler.ComponentTests/Language Expand file tree Collapse file tree 1 file changed +33
-2
lines changed Original file line number Diff line number Diff line change @@ -1176,23 +1176,54 @@ module NominalAndAnonymousRecords =
11761176 let ``Inference works the same`` () =
11771177 let src =
11781178 """
1179+ module M
1180+
11791181 let f x y =
11801182 if x = y then ()
11811183 else failwith $"Expected %A {x} = %A {y}."
11821184
1183- f {| a = 1 - 1 |} {| a = Unchecked.defaultof<_> |}
1185+ do f {| a = 1 - 1 |} {| a = Unchecked.defaultof<_> |}
11841186
11851187 #nowarn FS3883 // Spread shadowing explicit.
11861188
11871189 let r = {| a = Unchecked.defaultof<_> |}
1188- f {| a = 1 - 1 |} {| a = "a"; ...r |}
1190+ do f {| a = 1 - 1 |} {| a = "a"; ...r |}
1191+
1192+ let _ =
1193+ let r = {| a = Unchecked.defaultof<_> |}
1194+ f {| a = 1 - 1 |} {| a = "a"; ...r |}
11891195 """
11901196
11911197 FSharp src
11921198 |> withLangVersion SupportedLangVersion
11931199 |> compileExeAndRun
11941200 |> shouldSucceed
11951201
1202+ [<Fact>]
1203+ let ``Name resolution order is the same`` () =
1204+ let src =
1205+ """
1206+ module M
1207+
1208+ type RecordTypeB =
1209+ { Name: string
1210+ FieldB: int }
1211+
1212+ // When the anonymous record expression is encountered, it must commit to "RecordTypeB".
1213+ // The return type of "f" is, at that point, a variable type
1214+ // and must be correctly inferred by the point where we process the subsequence
1215+ // dot-notation "f().Name"
1216+ let rec f() =
1217+ {| Name = ""
1218+ FieldA = f().Name
1219+ |}
1220+ """
1221+
1222+ FSharp src
1223+ |> withLangVersion SupportedLangVersion
1224+ |> compile
1225+ |> shouldSucceed
1226+
11961227 module Conversions =
11971228 ()
11981229
You can’t perform that action at this time.
0 commit comments