From 24345e619b80f78203cbf8df2994dd98225b37ed Mon Sep 17 00:00:00 2001 From: kerams Date: Tue, 19 Sep 2023 11:16:08 +0200 Subject: [PATCH 1/3] Adjust suggested names for union case field patterns (#15989) * Adjust suggested names for union case field patterns --- src/Compiler/Service/FSharpCheckerResults.fs | 36 +++++++++++-------- .../CompletionProviderTests.fs | 18 ++++++++-- 2 files changed, 38 insertions(+), 16 deletions(-) diff --git a/src/Compiler/Service/FSharpCheckerResults.fs b/src/Compiler/Service/FSharpCheckerResults.fs index 8e06873f75e..b526c09a796 100644 --- a/src/Compiler/Service/FSharpCheckerResults.fs +++ b/src/Compiler/Service/FSharpCheckerResults.fs @@ -986,24 +986,32 @@ type internal TypeCheckInfo None /// Suggest name based on type - let SuggestNameBasedOnType g pos ty = - if isNumericType g ty then - CreateCompletionItemForSuggestedPatternName pos "num" - else - match tryTcrefOfAppTy g ty with - | ValueSome tcref when not (tyconRefEq g g.system_Object_tcref tcref) -> - CreateCompletionItemForSuggestedPatternName pos tcref.DisplayName - | _ -> None + let SuggestNameBasedOnType (g: TcGlobals) pos ty = + match stripTyparEqns ty with + | TType_app (tyconRef = tcref) when tcref.IsTypeAbbrev && (tcref.IsLocalRef || not (ccuEq g.fslibCcu tcref.nlr.Ccu)) -> + // Respect user-defined aliases + CreateCompletionItemForSuggestedPatternName pos tcref.DisplayName + | ty -> + if isNumericType g ty then + CreateCompletionItemForSuggestedPatternName pos "num" + else + match tryTcrefOfAppTy g ty with + | ValueSome tcref when not (tyconRefEq g g.system_Object_tcref tcref) -> + CreateCompletionItemForSuggestedPatternName pos tcref.DisplayName + | _ -> None /// Suggest names based on field name and type, add them to the list - let SuggestNameForUnionCaseFieldPattern g caseIdPos fieldPatternPos (uci: UnionCaseInfo) indexOrName completions = + let SuggestNameForUnionCaseFieldPattern g caseIdPos fieldPatternPos (uci: UnionCaseInfo) indexOrName isTheOnlyField completions = let field = match indexOrName with | Choice1Of2 index -> - // Index is None when parentheses were not used, i.e. "| Some v ->" - suggest a name only when the case has a single field match uci.UnionCase.RecdFieldsArray, index with - | [| field |], None -> Some field - | [| _ |], Some _ + | [| field |], None -> + // Index is None when parentheses were not used, i.e. `| Some v ->` - suggest a name only when the case has a single field + Some field + | [| _ |], Some _ when not isTheOnlyField -> + // When completing `| Some (a| , b)`, we're binding the first tuple element, not the sole case field + None | _, None -> None | arr, Some index -> arr |> Array.tryItem index | Choice2Of2 name -> uci.UnionCase.RecdFieldsArray |> Array.tryFind (fun x -> x.DisplayName = name) @@ -1016,7 +1024,7 @@ type internal TypeCheckInfo sResolutions.CapturedNameResolutions |> ResizeArray.tryPick (fun r -> match r.Item with - | Item.Value vref when r.Pos = fieldPatternPos -> Some(stripTyparEqns vref.Type) + | Item.Value vref when r.Pos = fieldPatternPos -> Some vref.Type | _ -> None) |> Option.defaultValue field.FormalType else @@ -1118,7 +1126,7 @@ type internal TypeCheckInfo |> Option.defaultValue [] |> List.append (fields indexOrName isTheOnlyField uci) - Some(SuggestNameForUnionCaseFieldPattern g caseIdRange.End pos uci indexOrName list, r.DisplayEnv, r.Range) + Some(SuggestNameForUnionCaseFieldPattern g caseIdRange.End pos uci indexOrName isTheOnlyField list, r.DisplayEnv, r.Range) | _ -> None) |> Option.orElse declaredItems diff --git a/vsintegration/tests/FSharp.Editor.Tests/CompletionProviderTests.fs b/vsintegration/tests/FSharp.Editor.Tests/CompletionProviderTests.fs index 157331988df..71fb3b0c963 100644 --- a/vsintegration/tests/FSharp.Editor.Tests/CompletionProviderTests.fs +++ b/vsintegration/tests/FSharp.Editor.Tests/CompletionProviderTests.fs @@ -1710,6 +1710,16 @@ fun (Some v) -> () type C = member _.M (Ids (c, o)) = () + + +type MyAlias = int + +type Id2<'a> = Id2 of fff: 'a + +let r: Id2 = Id2 3 + +match r with +| Id2 (a) -> () """ VerifyCompletionList(fileContents, "let x (Ids (c", [ "customerId"; "num" ], []) @@ -1720,7 +1730,9 @@ type C = VerifyCompletionList(fileContents, "fun (Ids (c, o", [ "orderId"; "option" ], []) VerifyCompletionList(fileContents, "fun (Some v", [ "value" ], []) VerifyCompletionList(fileContents, "member _.M (Ids (c", [ "customerId"; "num" ], [ "orderId" ]) - VerifyCompletionList(fileContents, "member _.M (Ids (c, o", [ "orderId"; "option" ], [ "customerId"; "num" ]) + + // Respecting the type alias + VerifyCompletionList(fileContents, "| Id2 (a", [ "fff"; "myAlias" ], [ "num" ]) [] let ``Completion list does not contain suggested names in tuple deconstruction`` () = @@ -1735,7 +1747,9 @@ match Some (1, 2) with VerifyCompletionList(fileContents, "| Some v", [ "value" ], []) VerifyCompletionList(fileContents, "| Some (a", [], [ "value" ]) VerifyCompletionList(fileContents, "| Some (a, b", [], [ "value" ]) - VerifyCompletionList(fileContents, "| Some (c", [], [ "value" ]) + + // Binding the whole tuple here, so the field name should be present + VerifyCompletionList(fileContents, "| Some (c", [ "value" ], []) [] let ``Completion list contains suggested names for union case field pattern based on the name of the generic type's solution`` () = From c4b56b4781c751c91134369d7e1de48a4fc9d45e Mon Sep 17 00:00:00 2001 From: Petr Date: Tue, 19 Sep 2023 13:26:29 +0200 Subject: [PATCH 2/3] Fix a bug in the Add Open code fix (#15998) * Fix a bug in an Add Open code fix * fantomas --- .../CodeFixes/AddOpenCodeFixProvider.fs | 25 +++++++++------- .../CodeFixes/AddOpenOnTopOffTests.fs | 29 ++++++++++++++++++- .../CodeFixes/AddOpenOnTopOnTests.fs | 29 ++++++++++++++++++- 3 files changed, 71 insertions(+), 12 deletions(-) diff --git a/vsintegration/src/FSharp.Editor/CodeFixes/AddOpenCodeFixProvider.fs b/vsintegration/src/FSharp.Editor/CodeFixes/AddOpenCodeFixProvider.fs index b6b13608cb1..ac0b952f65f 100644 --- a/vsintegration/src/FSharp.Editor/CodeFixes/AddOpenCodeFixProvider.fs +++ b/vsintegration/src/FSharp.Editor/CodeFixes/AddOpenCodeFixProvider.fs @@ -55,21 +55,26 @@ type internal AddOpenCodeFixProvider [] (assemblyContentPr // attribute, shouldn't be here | line when line.StartsWith "[<" && line.EndsWith ">]" -> - let moduleDeclLineNumber = + let moduleDeclLineNumberOpt = sourceText.Lines |> Seq.skip insertionLineNumber - |> Seq.findIndex (fun line -> line.ToString().Contains "module") - // add back the skipped lines - |> fun i -> insertionLineNumber + i + |> Seq.tryFindIndex (fun line -> line.ToString().Contains "module") - let moduleDeclLineText = sourceText.Lines[ moduleDeclLineNumber ].ToString().Trim() + match moduleDeclLineNumberOpt with + // implicit top level module + | None -> insertionLineNumber, $"{margin}open {ns}{br}{br}" + // explicit top level module + | Some number -> + // add back the skipped lines + let moduleDeclLineNumber = insertionLineNumber + number + let moduleDeclLineText = sourceText.Lines[ moduleDeclLineNumber ].ToString().Trim() - if moduleDeclLineText.EndsWith "=" then - insertionLineNumber, $"{margin}open {ns}{br}{br}" - else - moduleDeclLineNumber + 2, $"{margin}open {ns}{br}{br}" + if moduleDeclLineText.EndsWith "=" then + insertionLineNumber, $"{margin}open {ns}{br}{br}" + else + moduleDeclLineNumber + 2, $"{margin}open {ns}{br}{br}" - // something else, shot in the dark + // implicit top level module | _ -> insertionLineNumber, $"{margin}open {ns}{br}{br}" | ScopeKind.Namespace -> insertionLineNumber + 3, $"{margin}open {ns}{br}{br}" diff --git a/vsintegration/tests/FSharp.Editor.Tests/CodeFixes/AddOpenOnTopOffTests.fs b/vsintegration/tests/FSharp.Editor.Tests/CodeFixes/AddOpenOnTopOffTests.fs index 297554f3784..d3897828292 100644 --- a/vsintegration/tests/FSharp.Editor.Tests/CodeFixes/AddOpenOnTopOffTests.fs +++ b/vsintegration/tests/FSharp.Editor.Tests/CodeFixes/AddOpenOnTopOffTests.fs @@ -159,7 +159,7 @@ let ``Fixes FS0039 for missing opens - nested module`` () = Assert.Equal(expected, actual) [] -let ``Fixes FS0039 for missing opens - module has attributes`` () = +let ``Fixes FS0039 for missing opens - explicit module has attributes`` () = let code = """ [] @@ -187,6 +187,33 @@ Console.WriteLine 42 Assert.Equal(expected, actual) +[] +let ``Fixes FS0039 for missing opens - implicit module has attributes`` () = + let code = + """ +[] +type MyType() = + let now = DateTime.Now +""" + + let expected = + Some + { + Message = "open System" + FixedCode = + """ +open System + +[] +type MyType() = + let now = DateTime.Now +""" + } + + let actual = codeFix |> tryFix code Auto + + Assert.Equal(expected, actual) + // TODO: the open statement should actually be within the module [] let ``Fixes FS0039 for missing opens - nested module has attributes`` () = diff --git a/vsintegration/tests/FSharp.Editor.Tests/CodeFixes/AddOpenOnTopOnTests.fs b/vsintegration/tests/FSharp.Editor.Tests/CodeFixes/AddOpenOnTopOnTests.fs index ac95de440d4..185fd8390d1 100644 --- a/vsintegration/tests/FSharp.Editor.Tests/CodeFixes/AddOpenOnTopOnTests.fs +++ b/vsintegration/tests/FSharp.Editor.Tests/CodeFixes/AddOpenOnTopOnTests.fs @@ -153,7 +153,7 @@ module Module1 = Assert.Equal(expected, actual) [] -let ``Fixes FS0039 for missing opens - module has attributes`` () = +let ``Fixes FS0039 for missing opens - explicit module has attributes`` () = let code = """ [] @@ -181,6 +181,33 @@ Console.WriteLine 42 Assert.Equal(expected, actual) +[] +let ``Fixes FS0039 for missing opens - implicit module has attributes`` () = + let code = + """ +[] +type MyType() = + let now = DateTime.Now +""" + + let expected = + Some + { + Message = "open System" + FixedCode = + """ +open System + +[] +type MyType() = + let now = DateTime.Now +""" + } + + let actual = codeFix |> tryFix code Auto + + Assert.Equal(expected, actual) + [] let ``Fixes FS0039 for missing opens - nested module has attributes`` () = let code = From 7b1879f58aebe4162027f5e16d8f3b8e42727f09 Mon Sep 17 00:00:00 2001 From: Eugene Auduchinok Date: Tue, 19 Sep 2023 11:44:21 +0000 Subject: [PATCH 3/3] Parser: recover on unfinished record expr fields (#15953) --- src/Compiler/pars.fsy | 14 +++++++++ .../Expression/AnonymousRecords-01.fs.bsl | 14 ++++++--- .../Expression/Record - Anon - Field 01.fs | 3 -- .../Record - Anon - Field 01.fs.bsl | 16 ---------- .../Expression/Record - Anon - Field 02.fs | 3 -- .../Record - Anon - Field 02.fs.bsl | 13 -------- .../SyntaxTree/Expression/Record - Anon 01.fs | 3 ++ .../Expression/Record - Anon 01.fs.bsl | 16 ++++++++++ .../SyntaxTree/Expression/Record - Anon 02.fs | 3 ++ .../Expression/Record - Anon 02.fs.bsl | 18 +++++++++++ .../SyntaxTree/Expression/Record - Anon 03.fs | 3 ++ .../Expression/Record - Anon 03.fs.bsl | 16 ++++++++++ .../SyntaxTree/Expression/Record - Anon 04.fs | 3 ++ .../Expression/Record - Anon 04.fs.bsl | 20 ++++++++++++ .../SyntaxTree/Expression/Record - Anon 05.fs | 3 ++ .../Expression/Record - Anon 05.fs.bsl | 23 ++++++++++++++ .../SyntaxTree/Expression/Record - Anon 06.fs | 3 ++ .../Expression/Record - Anon 06.fs.bsl | 23 ++++++++++++++ .../SyntaxTree/Expression/Record - Anon 07.fs | 4 +++ .../Expression/Record - Anon 07.fs.bsl | 20 ++++++++++++ .../SyntaxTree/Expression/Record - Anon 08.fs | 4 +++ .../Expression/Record - Anon 08.fs.bsl | 20 ++++++++++++ .../SyntaxTree/Expression/Record - Anon 09.fs | 5 +++ .../Expression/Record - Anon 09.fs.bsl | 27 ++++++++++++++++ .../SyntaxTree/Expression/Record - Anon 10.fs | 5 +++ .../Expression/Record - Anon 10.fs.bsl | 22 +++++++++++++ .../SyntaxTree/Expression/Record - Anon 11.fs | 4 +++ .../Expression/Record - Anon 11.fs.bsl | 25 +++++++++++++++ .../SyntaxTree/Expression/Record - Anon 12.fs | 4 +++ .../Expression/Record - Anon 12.fs.bsl | 30 ++++++++++++++++++ .../Expression/Record - Field 11.fs | 3 ++ .../Expression/Record - Field 11.fs.bsl | 18 +++++++++++ .../Expression/Record - Field 12.fs | 4 +++ .../Expression/Record - Field 12.fs.bsl | 28 +++++++++++++++++ .../Expression/Record - Field 13.fs | 4 +++ .../Expression/Record - Field 13.fs.bsl | 21 +++++++++++++ .../Expression/Record - Field 14.fs | 5 +++ .../Expression/Record - Field 14.fs.bsl | 31 +++++++++++++++++++ 38 files changed, 442 insertions(+), 39 deletions(-) delete mode 100644 tests/service/data/SyntaxTree/Expression/Record - Anon - Field 01.fs delete mode 100644 tests/service/data/SyntaxTree/Expression/Record - Anon - Field 01.fs.bsl delete mode 100644 tests/service/data/SyntaxTree/Expression/Record - Anon - Field 02.fs delete mode 100644 tests/service/data/SyntaxTree/Expression/Record - Anon - Field 02.fs.bsl create mode 100644 tests/service/data/SyntaxTree/Expression/Record - Anon 01.fs create mode 100644 tests/service/data/SyntaxTree/Expression/Record - Anon 01.fs.bsl create mode 100644 tests/service/data/SyntaxTree/Expression/Record - Anon 02.fs create mode 100644 tests/service/data/SyntaxTree/Expression/Record - Anon 02.fs.bsl create mode 100644 tests/service/data/SyntaxTree/Expression/Record - Anon 03.fs create mode 100644 tests/service/data/SyntaxTree/Expression/Record - Anon 03.fs.bsl create mode 100644 tests/service/data/SyntaxTree/Expression/Record - Anon 04.fs create mode 100644 tests/service/data/SyntaxTree/Expression/Record - Anon 04.fs.bsl create mode 100644 tests/service/data/SyntaxTree/Expression/Record - Anon 05.fs create mode 100644 tests/service/data/SyntaxTree/Expression/Record - Anon 05.fs.bsl create mode 100644 tests/service/data/SyntaxTree/Expression/Record - Anon 06.fs create mode 100644 tests/service/data/SyntaxTree/Expression/Record - Anon 06.fs.bsl create mode 100644 tests/service/data/SyntaxTree/Expression/Record - Anon 07.fs create mode 100644 tests/service/data/SyntaxTree/Expression/Record - Anon 07.fs.bsl create mode 100644 tests/service/data/SyntaxTree/Expression/Record - Anon 08.fs create mode 100644 tests/service/data/SyntaxTree/Expression/Record - Anon 08.fs.bsl create mode 100644 tests/service/data/SyntaxTree/Expression/Record - Anon 09.fs create mode 100644 tests/service/data/SyntaxTree/Expression/Record - Anon 09.fs.bsl create mode 100644 tests/service/data/SyntaxTree/Expression/Record - Anon 10.fs create mode 100644 tests/service/data/SyntaxTree/Expression/Record - Anon 10.fs.bsl create mode 100644 tests/service/data/SyntaxTree/Expression/Record - Anon 11.fs create mode 100644 tests/service/data/SyntaxTree/Expression/Record - Anon 11.fs.bsl create mode 100644 tests/service/data/SyntaxTree/Expression/Record - Anon 12.fs create mode 100644 tests/service/data/SyntaxTree/Expression/Record - Anon 12.fs.bsl create mode 100644 tests/service/data/SyntaxTree/Expression/Record - Field 11.fs create mode 100644 tests/service/data/SyntaxTree/Expression/Record - Field 11.fs.bsl create mode 100644 tests/service/data/SyntaxTree/Expression/Record - Field 12.fs create mode 100644 tests/service/data/SyntaxTree/Expression/Record - Field 12.fs.bsl create mode 100644 tests/service/data/SyntaxTree/Expression/Record - Field 13.fs create mode 100644 tests/service/data/SyntaxTree/Expression/Record - Field 13.fs.bsl create mode 100644 tests/service/data/SyntaxTree/Expression/Record - Field 14.fs create mode 100644 tests/service/data/SyntaxTree/Expression/Record - Field 14.fs.bsl diff --git a/src/Compiler/pars.fsy b/src/Compiler/pars.fsy index 966d8dc393d..b2777233420 100644 --- a/src/Compiler/pars.fsy +++ b/src/Compiler/pars.fsy @@ -5356,6 +5356,20 @@ recdExprCore: (None, l) | _ -> raiseParseErrorAt (rhs parseState 2) (FSComp.SR.parsFieldBinding()) } + | appExpr EQUALS recover + { match $1 with + | LongOrSingleIdent(false, (SynLongIdent _ as f), None, m) -> + let f = mkRecdField f + let mEquals = rhs parseState 2 + let l = rebindRanges (f, Some mEquals, None) [] None + None, l + | _ -> raiseParseErrorAt (rhs parseState 2) (FSComp.SR.parsFieldBinding ()) } + + | appExpr + { let mExpr = rhs parseState 1 + reportParseErrorAt mExpr (FSComp.SR.parsFieldBinding ()) + Some($1, (mExpr.EndRange, None)), [] } + /* handles cases when identifier can start from the underscore */ diff --git a/tests/service/data/SyntaxTree/Expression/AnonymousRecords-01.fs.bsl b/tests/service/data/SyntaxTree/Expression/AnonymousRecords-01.fs.bsl index 9ed35f97cb0..f931eda4280 100644 --- a/tests/service/data/SyntaxTree/Expression/AnonymousRecords-01.fs.bsl +++ b/tests/service/data/SyntaxTree/Expression/AnonymousRecords-01.fs.bsl @@ -24,12 +24,18 @@ ImplFile (AnonRecd (true, None, [], (4,0--4,12), { OpeningBraceRange = (4,7--4,9) }), (4,0--4,12)); - Expr (ArbitraryAfterError ("braceBarExpr", (5,0--5,10)), (5,0--5,10)); - Expr (ArbitraryAfterError ("braceBarExpr", (6,0--6,17)), (6,0--6,17))], + Expr + (AnonRecd + (false, Some (Null (5,3--5,7), ((5,7--5,7), None)), [], + (5,0--5,10), { OpeningBraceRange = (5,0--5,2) }), (5,0--5,10)); + Expr + (AnonRecd + (true, Some (Null (6,10--6,14), ((6,14--6,14), None)), [], + (6,0--6,17), { OpeningBraceRange = (6,7--6,9) }), (6,0--6,17))], PreXmlDocEmpty, [], None, (1,0--6,17), { LeadingKeyword = None })], (true, true), { ConditionalDirectives = [] CodeComments = [] }, set [])) -(5,8)-(5,10) parse error Unexpected symbol '|}' in definition -(6,15)-(6,17) parse error Unexpected symbol '|}' in expression +(5,3)-(5,7) parse error Field bindings must have the form 'id = expr;' +(6,10)-(6,14) parse error Field bindings must have the form 'id = expr;' (1,0)-(2,0) parse warning The declarations in this file will be placed in an implicit module 'AnonymousRecords-01' based on the file name 'AnonymousRecords-01.fs'. However this is not a valid F# identifier, so the contents will not be accessible from other files. Consider renaming the file or adding a 'module' or 'namespace' declaration at the top of the file. diff --git a/tests/service/data/SyntaxTree/Expression/Record - Anon - Field 01.fs b/tests/service/data/SyntaxTree/Expression/Record - Anon - Field 01.fs deleted file mode 100644 index 1009d2b3a70..00000000000 --- a/tests/service/data/SyntaxTree/Expression/Record - Anon - Field 01.fs +++ /dev/null @@ -1,3 +0,0 @@ -namespace Foo - -{| A = 1 |} diff --git a/tests/service/data/SyntaxTree/Expression/Record - Anon - Field 01.fs.bsl b/tests/service/data/SyntaxTree/Expression/Record - Anon - Field 01.fs.bsl deleted file mode 100644 index 1bbc218fcf6..00000000000 --- a/tests/service/data/SyntaxTree/Expression/Record - Anon - Field 01.fs.bsl +++ /dev/null @@ -1,16 +0,0 @@ -ImplFile - (ParsedImplFileInput - ("/root/Expression/Record - Anon - Field 01.fs", false, - QualifiedNameOfFile Record - Anon - Field 01, [], [], - [SynModuleOrNamespace - ([Foo], false, DeclaredNamespace, - [Expr - (AnonRecd - (false, None, - [(SynLongIdent ([A], [], [None]), Some (3,5--3,6), - Const (Int32 1, (3,7--3,8)))], (3,0--3,11), - { OpeningBraceRange = (3,0--3,2) }), (3,0--3,11))], - PreXmlDocEmpty, [], None, (1,0--3,11), - { LeadingKeyword = Namespace (1,0--1,9) })], (true, true), - { ConditionalDirectives = [] - CodeComments = [] }, set [])) diff --git a/tests/service/data/SyntaxTree/Expression/Record - Anon - Field 02.fs b/tests/service/data/SyntaxTree/Expression/Record - Anon - Field 02.fs deleted file mode 100644 index 300f6342dd8..00000000000 --- a/tests/service/data/SyntaxTree/Expression/Record - Anon - Field 02.fs +++ /dev/null @@ -1,3 +0,0 @@ -namespace Foo - -{| A = |} diff --git a/tests/service/data/SyntaxTree/Expression/Record - Anon - Field 02.fs.bsl b/tests/service/data/SyntaxTree/Expression/Record - Anon - Field 02.fs.bsl deleted file mode 100644 index bb4e1569992..00000000000 --- a/tests/service/data/SyntaxTree/Expression/Record - Anon - Field 02.fs.bsl +++ /dev/null @@ -1,13 +0,0 @@ -ImplFile - (ParsedImplFileInput - ("/root/Expression/Record - Anon - Field 02.fs", false, - QualifiedNameOfFile Record - Anon - Field 02, [], [], - [SynModuleOrNamespace - ([Foo], false, DeclaredNamespace, - [Expr (ArbitraryAfterError ("braceBarExpr", (3,0--3,9)), (3,0--3,9))], - PreXmlDocEmpty, [], None, (1,0--3,9), - { LeadingKeyword = Namespace (1,0--1,9) })], (true, true), - { ConditionalDirectives = [] - CodeComments = [] }, set [])) - -(3,7)-(3,9) parse error Unexpected symbol '|}' in definition diff --git a/tests/service/data/SyntaxTree/Expression/Record - Anon 01.fs b/tests/service/data/SyntaxTree/Expression/Record - Anon 01.fs new file mode 100644 index 00000000000..e38a65289fa --- /dev/null +++ b/tests/service/data/SyntaxTree/Expression/Record - Anon 01.fs @@ -0,0 +1,3 @@ +module Module + +{| F = 1 |} diff --git a/tests/service/data/SyntaxTree/Expression/Record - Anon 01.fs.bsl b/tests/service/data/SyntaxTree/Expression/Record - Anon 01.fs.bsl new file mode 100644 index 00000000000..0e74d6eb486 --- /dev/null +++ b/tests/service/data/SyntaxTree/Expression/Record - Anon 01.fs.bsl @@ -0,0 +1,16 @@ +ImplFile + (ParsedImplFileInput + ("/root/Expression/Record - Anon 01.fs", false, QualifiedNameOfFile Module, + [], [], + [SynModuleOrNamespace + ([Module], false, NamedModule, + [Expr + (AnonRecd + (false, None, + [(SynLongIdent ([F], [], [None]), Some (3,5--3,6), + Const (Int32 1, (3,7--3,8)))], (3,0--3,11), + { OpeningBraceRange = (3,0--3,2) }), (3,0--3,11))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--3,11), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + CodeComments = [] }, set [])) diff --git a/tests/service/data/SyntaxTree/Expression/Record - Anon 02.fs b/tests/service/data/SyntaxTree/Expression/Record - Anon 02.fs new file mode 100644 index 00000000000..dd677450595 --- /dev/null +++ b/tests/service/data/SyntaxTree/Expression/Record - Anon 02.fs @@ -0,0 +1,3 @@ +module Module + +{| F = |} diff --git a/tests/service/data/SyntaxTree/Expression/Record - Anon 02.fs.bsl b/tests/service/data/SyntaxTree/Expression/Record - Anon 02.fs.bsl new file mode 100644 index 00000000000..52748529a11 --- /dev/null +++ b/tests/service/data/SyntaxTree/Expression/Record - Anon 02.fs.bsl @@ -0,0 +1,18 @@ +ImplFile + (ParsedImplFileInput + ("/root/Expression/Record - Anon 02.fs", false, QualifiedNameOfFile Module, + [], [], + [SynModuleOrNamespace + ([Module], false, NamedModule, + [Expr + (AnonRecd + (false, None, + [(SynLongIdent ([F], [], [None]), Some (3,5--3,6), + ArbitraryAfterError ("anonField", (3,3--3,4)))], (3,0--3,9), + { OpeningBraceRange = (3,0--3,2) }), (3,0--3,9))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--3,9), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + CodeComments = [] }, set [])) + +(3,7)-(3,9) parse error Unexpected symbol '|}' in definition diff --git a/tests/service/data/SyntaxTree/Expression/Record - Anon 03.fs b/tests/service/data/SyntaxTree/Expression/Record - Anon 03.fs new file mode 100644 index 00000000000..e6a6c302525 --- /dev/null +++ b/tests/service/data/SyntaxTree/Expression/Record - Anon 03.fs @@ -0,0 +1,3 @@ +module Module + +{| F |} diff --git a/tests/service/data/SyntaxTree/Expression/Record - Anon 03.fs.bsl b/tests/service/data/SyntaxTree/Expression/Record - Anon 03.fs.bsl new file mode 100644 index 00000000000..dbb9b6e063f --- /dev/null +++ b/tests/service/data/SyntaxTree/Expression/Record - Anon 03.fs.bsl @@ -0,0 +1,16 @@ +ImplFile + (ParsedImplFileInput + ("/root/Expression/Record - Anon 03.fs", false, QualifiedNameOfFile Module, + [], [], + [SynModuleOrNamespace + ([Module], false, NamedModule, + [Expr + (AnonRecd + (false, Some (Ident F, ((3,4--3,4), None)), [], (3,0--3,7), + { OpeningBraceRange = (3,0--3,2) }), (3,0--3,7))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--3,7), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + CodeComments = [] }, set [])) + +(3,3)-(3,4) parse error Field bindings must have the form 'id = expr;' diff --git a/tests/service/data/SyntaxTree/Expression/Record - Anon 04.fs b/tests/service/data/SyntaxTree/Expression/Record - Anon 04.fs new file mode 100644 index 00000000000..9cc7f94792c --- /dev/null +++ b/tests/service/data/SyntaxTree/Expression/Record - Anon 04.fs @@ -0,0 +1,3 @@ +module Module + +{| f() |} diff --git a/tests/service/data/SyntaxTree/Expression/Record - Anon 04.fs.bsl b/tests/service/data/SyntaxTree/Expression/Record - Anon 04.fs.bsl new file mode 100644 index 00000000000..07303e1a146 --- /dev/null +++ b/tests/service/data/SyntaxTree/Expression/Record - Anon 04.fs.bsl @@ -0,0 +1,20 @@ +ImplFile + (ParsedImplFileInput + ("/root/Expression/Record - Anon 04.fs", false, QualifiedNameOfFile Module, + [], [], + [SynModuleOrNamespace + ([Module], false, NamedModule, + [Expr + (AnonRecd + (false, + Some + (App + (Atomic, false, Ident f, Const (Unit, (3,4--3,6)), + (3,3--3,6)), ((3,6--3,6), None)), [], (3,0--3,9), + { OpeningBraceRange = (3,0--3,2) }), (3,0--3,9))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--3,9), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + CodeComments = [] }, set [])) + +(3,3)-(3,6) parse error Field bindings must have the form 'id = expr;' diff --git a/tests/service/data/SyntaxTree/Expression/Record - Anon 05.fs b/tests/service/data/SyntaxTree/Expression/Record - Anon 05.fs new file mode 100644 index 00000000000..343a68b1601 --- /dev/null +++ b/tests/service/data/SyntaxTree/Expression/Record - Anon 05.fs @@ -0,0 +1,3 @@ +module Module + +{| f(). |} diff --git a/tests/service/data/SyntaxTree/Expression/Record - Anon 05.fs.bsl b/tests/service/data/SyntaxTree/Expression/Record - Anon 05.fs.bsl new file mode 100644 index 00000000000..6c2cefee45d --- /dev/null +++ b/tests/service/data/SyntaxTree/Expression/Record - Anon 05.fs.bsl @@ -0,0 +1,23 @@ +ImplFile + (ParsedImplFileInput + ("/root/Expression/Record - Anon 05.fs", false, QualifiedNameOfFile Module, + [], [], + [SynModuleOrNamespace + ([Module], false, NamedModule, + [Expr + (AnonRecd + (false, + Some + (DiscardAfterMissingQualificationAfterDot + (App + (Atomic, false, Ident f, Const (Unit, (3,4--3,6)), + (3,3--3,6)), (3,6--3,7), (3,3--3,7)), + ((3,10--3,10), None)), [], (3,0--3,10), + { OpeningBraceRange = (3,0--3,2) }), (3,0--3,10))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--3,10), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + CodeComments = [] }, set [])) + +(3,6)-(3,7) parse error Missing qualification after '.' +(3,3)-(3,10) parse error Field bindings must have the form 'id = expr;' diff --git a/tests/service/data/SyntaxTree/Expression/Record - Anon 06.fs b/tests/service/data/SyntaxTree/Expression/Record - Anon 06.fs new file mode 100644 index 00000000000..9df1dd98ad5 --- /dev/null +++ b/tests/service/data/SyntaxTree/Expression/Record - Anon 06.fs @@ -0,0 +1,3 @@ +module Module + +{| f().F |} diff --git a/tests/service/data/SyntaxTree/Expression/Record - Anon 06.fs.bsl b/tests/service/data/SyntaxTree/Expression/Record - Anon 06.fs.bsl new file mode 100644 index 00000000000..edbeaa194e6 --- /dev/null +++ b/tests/service/data/SyntaxTree/Expression/Record - Anon 06.fs.bsl @@ -0,0 +1,23 @@ +ImplFile + (ParsedImplFileInput + ("/root/Expression/Record - Anon 06.fs", false, QualifiedNameOfFile Module, + [], [], + [SynModuleOrNamespace + ([Module], false, NamedModule, + [Expr + (AnonRecd + (false, + Some + (DotGet + (App + (Atomic, false, Ident f, Const (Unit, (3,4--3,6)), + (3,3--3,6)), (3,6--3,7), + SynLongIdent ([F], [], [None]), (3,3--3,8)), + ((3,8--3,8), None)), [], (3,0--3,11), + { OpeningBraceRange = (3,0--3,2) }), (3,0--3,11))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--3,11), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + CodeComments = [] }, set [])) + +(3,3)-(3,8) parse error Field bindings must have the form 'id = expr;' diff --git a/tests/service/data/SyntaxTree/Expression/Record - Anon 07.fs b/tests/service/data/SyntaxTree/Expression/Record - Anon 07.fs new file mode 100644 index 00000000000..62816821ed2 --- /dev/null +++ b/tests/service/data/SyntaxTree/Expression/Record - Anon 07.fs @@ -0,0 +1,4 @@ +module Module + +{| F1 = 1 + F2 = |} diff --git a/tests/service/data/SyntaxTree/Expression/Record - Anon 07.fs.bsl b/tests/service/data/SyntaxTree/Expression/Record - Anon 07.fs.bsl new file mode 100644 index 00000000000..1bc1a409d91 --- /dev/null +++ b/tests/service/data/SyntaxTree/Expression/Record - Anon 07.fs.bsl @@ -0,0 +1,20 @@ +ImplFile + (ParsedImplFileInput + ("/root/Expression/Record - Anon 07.fs", false, QualifiedNameOfFile Module, + [], [], + [SynModuleOrNamespace + ([Module], false, NamedModule, + [Expr + (AnonRecd + (false, None, + [(SynLongIdent ([F1], [], [None]), Some (3,6--3,7), + Const (Int32 1, (3,8--3,9))); + (SynLongIdent ([F2], [], [None]), Some (4,6--4,7), + ArbitraryAfterError ("anonField", (4,3--4,5)))], (3,0--4,10), + { OpeningBraceRange = (3,0--3,2) }), (3,0--4,10))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--4,10), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + CodeComments = [] }, set [])) + +(4,3)-(4,5) parse error Field bindings must have the form 'id = expr;' diff --git a/tests/service/data/SyntaxTree/Expression/Record - Anon 08.fs b/tests/service/data/SyntaxTree/Expression/Record - Anon 08.fs new file mode 100644 index 00000000000..f76f241320f --- /dev/null +++ b/tests/service/data/SyntaxTree/Expression/Record - Anon 08.fs @@ -0,0 +1,4 @@ +module Module + +{| F1 = 1 + F2 |} diff --git a/tests/service/data/SyntaxTree/Expression/Record - Anon 08.fs.bsl b/tests/service/data/SyntaxTree/Expression/Record - Anon 08.fs.bsl new file mode 100644 index 00000000000..0cd4a997180 --- /dev/null +++ b/tests/service/data/SyntaxTree/Expression/Record - Anon 08.fs.bsl @@ -0,0 +1,20 @@ +ImplFile + (ParsedImplFileInput + ("/root/Expression/Record - Anon 08.fs", false, QualifiedNameOfFile Module, + [], [], + [SynModuleOrNamespace + ([Module], false, NamedModule, + [Expr + (AnonRecd + (false, None, + [(SynLongIdent ([F1], [], [None]), Some (3,6--3,7), + Const (Int32 1, (3,8--3,9))); + (SynLongIdent ([F2], [], [None]), None, + ArbitraryAfterError ("anonField", (4,3--4,5)))], (3,0--4,8), + { OpeningBraceRange = (3,0--3,2) }), (3,0--4,8))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--4,8), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + CodeComments = [] }, set [])) + +(4,3)-(4,5) parse error Field bindings must have the form 'id = expr;' diff --git a/tests/service/data/SyntaxTree/Expression/Record - Anon 09.fs b/tests/service/data/SyntaxTree/Expression/Record - Anon 09.fs new file mode 100644 index 00000000000..43d6115e76c --- /dev/null +++ b/tests/service/data/SyntaxTree/Expression/Record - Anon 09.fs @@ -0,0 +1,5 @@ +module Module + +{| F1 = 1 + F2 = + F3 = 3 |} diff --git a/tests/service/data/SyntaxTree/Expression/Record - Anon 09.fs.bsl b/tests/service/data/SyntaxTree/Expression/Record - Anon 09.fs.bsl new file mode 100644 index 00000000000..e851232c521 --- /dev/null +++ b/tests/service/data/SyntaxTree/Expression/Record - Anon 09.fs.bsl @@ -0,0 +1,27 @@ +ImplFile + (ParsedImplFileInput + ("/root/Expression/Record - Anon 09.fs", false, QualifiedNameOfFile Module, + [], [], + [SynModuleOrNamespace + ([Module], false, NamedModule, + [Expr + (AnonRecd + (false, None, + [(SynLongIdent ([F1], [], [None]), Some (3,6--3,7), + Const (Int32 1, (3,8--3,9))); + (SynLongIdent ([F2], [], [None]), Some (4,6--4,7), + App + (NonAtomic, false, + App + (NonAtomic, true, + LongIdent + (false, + SynLongIdent + ([op_Equality], [], [Some (OriginalNotation "=")]), + None, (5,6--5,7)), Ident F3, (5,3--5,7)), + Const (Int32 3, (5,8--5,9)), (5,3--5,9)))], (3,0--5,12), + { OpeningBraceRange = (3,0--3,2) }), (3,0--5,12))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--5,12), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + CodeComments = [] }, set [])) diff --git a/tests/service/data/SyntaxTree/Expression/Record - Anon 10.fs b/tests/service/data/SyntaxTree/Expression/Record - Anon 10.fs new file mode 100644 index 00000000000..b5750762487 --- /dev/null +++ b/tests/service/data/SyntaxTree/Expression/Record - Anon 10.fs @@ -0,0 +1,5 @@ +module Module + +{| F1 = 1 + F2 + F3 = 3 |} diff --git a/tests/service/data/SyntaxTree/Expression/Record - Anon 10.fs.bsl b/tests/service/data/SyntaxTree/Expression/Record - Anon 10.fs.bsl new file mode 100644 index 00000000000..2e01c7ef8c7 --- /dev/null +++ b/tests/service/data/SyntaxTree/Expression/Record - Anon 10.fs.bsl @@ -0,0 +1,22 @@ +ImplFile + (ParsedImplFileInput + ("/root/Expression/Record - Anon 10.fs", false, QualifiedNameOfFile Module, + [], [], + [SynModuleOrNamespace + ([Module], false, NamedModule, + [Expr + (AnonRecd + (false, None, + [(SynLongIdent ([F1], [], [None]), Some (3,6--3,7), + Const (Int32 1, (3,8--3,9))); + (SynLongIdent ([F2], [], [None]), None, + ArbitraryAfterError ("anonField", (4,3--4,5))); + (SynLongIdent ([F3], [], [None]), Some (5,6--5,7), + Const (Int32 3, (5,8--5,9)))], (3,0--5,12), + { OpeningBraceRange = (3,0--3,2) }), (3,0--5,12))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--5,12), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + CodeComments = [] }, set [])) + +(4,3)-(4,5) parse error Field bindings must have the form 'id = expr;' diff --git a/tests/service/data/SyntaxTree/Expression/Record - Anon 11.fs b/tests/service/data/SyntaxTree/Expression/Record - Anon 11.fs new file mode 100644 index 00000000000..d2bea192ba7 --- /dev/null +++ b/tests/service/data/SyntaxTree/Expression/Record - Anon 11.fs @@ -0,0 +1,4 @@ +module Module + +{| F1 = + F2 = 2 |} diff --git a/tests/service/data/SyntaxTree/Expression/Record - Anon 11.fs.bsl b/tests/service/data/SyntaxTree/Expression/Record - Anon 11.fs.bsl new file mode 100644 index 00000000000..97ffe8e441d --- /dev/null +++ b/tests/service/data/SyntaxTree/Expression/Record - Anon 11.fs.bsl @@ -0,0 +1,25 @@ +ImplFile + (ParsedImplFileInput + ("/root/Expression/Record - Anon 11.fs", false, QualifiedNameOfFile Module, + [], [], + [SynModuleOrNamespace + ([Module], false, NamedModule, + [Expr + (AnonRecd + (false, None, + [(SynLongIdent ([F1], [], [None]), Some (3,6--3,7), + App + (NonAtomic, false, + App + (NonAtomic, true, + LongIdent + (false, + SynLongIdent + ([op_Equality], [], [Some (OriginalNotation "=")]), + None, (4,6--4,7)), Ident F2, (4,3--4,7)), + Const (Int32 2, (4,8--4,9)), (4,3--4,9)))], (3,0--4,12), + { OpeningBraceRange = (3,0--3,2) }), (3,0--4,12))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--4,12), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + CodeComments = [] }, set [])) diff --git a/tests/service/data/SyntaxTree/Expression/Record - Anon 12.fs b/tests/service/data/SyntaxTree/Expression/Record - Anon 12.fs new file mode 100644 index 00000000000..e1c541b5577 --- /dev/null +++ b/tests/service/data/SyntaxTree/Expression/Record - Anon 12.fs @@ -0,0 +1,4 @@ +module Module + +{| F1 + F2 = 2 |} diff --git a/tests/service/data/SyntaxTree/Expression/Record - Anon 12.fs.bsl b/tests/service/data/SyntaxTree/Expression/Record - Anon 12.fs.bsl new file mode 100644 index 00000000000..3371e7a75e6 --- /dev/null +++ b/tests/service/data/SyntaxTree/Expression/Record - Anon 12.fs.bsl @@ -0,0 +1,30 @@ +ImplFile + (ParsedImplFileInput + ("/root/Expression/Record - Anon 12.fs", false, QualifiedNameOfFile Module, + [], [], + [SynModuleOrNamespace + ([Module], false, NamedModule, + [Expr + (AnonRecd + (false, Some (Ident F1, ((3,5--3,5), None)), [], (3,0--3,5), + { OpeningBraceRange = (3,0--3,2) }), (3,0--3,5)); + Expr + (App + (NonAtomic, false, + App + (NonAtomic, true, + LongIdent + (false, + SynLongIdent + ([op_Equality], [], [Some (OriginalNotation "=")]), + None, (4,6--4,7)), Ident F2, (4,3--4,7)), + Const (Int32 2, (4,8--4,9)), (4,3--4,9)), (4,3--4,9))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--4,9), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + CodeComments = [] }, set [])) + +(3,3)-(3,5) parse error Field bindings must have the form 'id = expr;' +(3,6)-(4,3) parse error Incomplete structured construct at or before this point in definition. Expected '|}' or other token. +(3,0)-(3,2) parse error Unmatched '{|' +(4,10)-(4,12) parse error Unexpected symbol '|}' in definition. Expected incomplete structured construct at or before this point or other token. diff --git a/tests/service/data/SyntaxTree/Expression/Record - Field 11.fs b/tests/service/data/SyntaxTree/Expression/Record - Field 11.fs new file mode 100644 index 00000000000..20e69d7bf11 --- /dev/null +++ b/tests/service/data/SyntaxTree/Expression/Record - Field 11.fs @@ -0,0 +1,3 @@ +module Foo + +{ A = } diff --git a/tests/service/data/SyntaxTree/Expression/Record - Field 11.fs.bsl b/tests/service/data/SyntaxTree/Expression/Record - Field 11.fs.bsl new file mode 100644 index 00000000000..6b20cddae13 --- /dev/null +++ b/tests/service/data/SyntaxTree/Expression/Record - Field 11.fs.bsl @@ -0,0 +1,18 @@ +ImplFile + (ParsedImplFileInput + ("/root/Expression/Record - Field 11.fs", false, QualifiedNameOfFile Foo, + [], [], + [SynModuleOrNamespace + ([Foo], false, NamedModule, + [Expr + (Record + (None, None, + [SynExprRecordField + ((SynLongIdent ([A], [], [None]), true), Some (3,4--3,5), + None, None)], (3,0--3,7)), (3,0--3,7))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--3,7), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + CodeComments = [] }, set [])) + +(3,6)-(3,7) parse error Unexpected symbol '}' in expression diff --git a/tests/service/data/SyntaxTree/Expression/Record - Field 12.fs b/tests/service/data/SyntaxTree/Expression/Record - Field 12.fs new file mode 100644 index 00000000000..05b77961b32 --- /dev/null +++ b/tests/service/data/SyntaxTree/Expression/Record - Field 12.fs @@ -0,0 +1,4 @@ +module Foo + +{ F1 = + F2 = 2 } diff --git a/tests/service/data/SyntaxTree/Expression/Record - Field 12.fs.bsl b/tests/service/data/SyntaxTree/Expression/Record - Field 12.fs.bsl new file mode 100644 index 00000000000..f1c61f45015 --- /dev/null +++ b/tests/service/data/SyntaxTree/Expression/Record - Field 12.fs.bsl @@ -0,0 +1,28 @@ +ImplFile + (ParsedImplFileInput + ("/root/Expression/Record - Field 12.fs", false, QualifiedNameOfFile Foo, + [], [], + [SynModuleOrNamespace + ([Foo], false, NamedModule, + [Expr + (Record + (None, None, + [SynExprRecordField + ((SynLongIdent ([F1], [], [None]), true), Some (3,5--3,6), + Some + (App + (NonAtomic, false, + App + (NonAtomic, true, + LongIdent + (false, + SynLongIdent + ([op_Equality], [], + [Some (OriginalNotation "=")]), None, + (4,5--4,6)), Ident F2, (4,2--4,6)), + Const (Int32 2, (4,7--4,8)), (4,2--4,8))), None)], + (3,0--4,10)), (3,0--4,10))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--4,10), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + CodeComments = [] }, set [])) diff --git a/tests/service/data/SyntaxTree/Expression/Record - Field 13.fs b/tests/service/data/SyntaxTree/Expression/Record - Field 13.fs new file mode 100644 index 00000000000..a17c875d94c --- /dev/null +++ b/tests/service/data/SyntaxTree/Expression/Record - Field 13.fs @@ -0,0 +1,4 @@ +module Foo + +{ F1 = 1 + F2 = } diff --git a/tests/service/data/SyntaxTree/Expression/Record - Field 13.fs.bsl b/tests/service/data/SyntaxTree/Expression/Record - Field 13.fs.bsl new file mode 100644 index 00000000000..0012edc2639 --- /dev/null +++ b/tests/service/data/SyntaxTree/Expression/Record - Field 13.fs.bsl @@ -0,0 +1,21 @@ +ImplFile + (ParsedImplFileInput + ("/root/Expression/Record - Field 13.fs", false, QualifiedNameOfFile Foo, + [], [], + [SynModuleOrNamespace + ([Foo], false, NamedModule, + [Expr + (Record + (None, None, + [SynExprRecordField + ((SynLongIdent ([F1], [], [None]), true), Some (3,5--3,6), + Some (Const (Int32 1, (3,7--3,8))), Some ((3,9--4,2), None)); + SynExprRecordField + ((SynLongIdent ([F2], [], [None]), true), Some (4,5--4,6), + None, None)], (3,0--4,8)), (3,0--4,8))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--4,8), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + CodeComments = [] }, set [])) + +(4,2)-(4,4) parse error Field bindings must have the form 'id = expr;' diff --git a/tests/service/data/SyntaxTree/Expression/Record - Field 14.fs b/tests/service/data/SyntaxTree/Expression/Record - Field 14.fs new file mode 100644 index 00000000000..b57a17445bb --- /dev/null +++ b/tests/service/data/SyntaxTree/Expression/Record - Field 14.fs @@ -0,0 +1,5 @@ +module Foo + +{ F1 = 1 + F2 = + F3 = 3 } diff --git a/tests/service/data/SyntaxTree/Expression/Record - Field 14.fs.bsl b/tests/service/data/SyntaxTree/Expression/Record - Field 14.fs.bsl new file mode 100644 index 00000000000..1afdd819fb1 --- /dev/null +++ b/tests/service/data/SyntaxTree/Expression/Record - Field 14.fs.bsl @@ -0,0 +1,31 @@ +ImplFile + (ParsedImplFileInput + ("/root/Expression/Record - Field 14.fs", false, QualifiedNameOfFile Foo, + [], [], + [SynModuleOrNamespace + ([Foo], false, NamedModule, + [Expr + (Record + (None, None, + [SynExprRecordField + ((SynLongIdent ([F1], [], [None]), true), Some (3,5--3,6), + Some (Const (Int32 1, (3,7--3,8))), Some ((3,9--4,2), None)); + SynExprRecordField + ((SynLongIdent ([F2], [], [None]), true), Some (4,5--4,6), + Some + (App + (NonAtomic, false, + App + (NonAtomic, true, + LongIdent + (false, + SynLongIdent + ([op_Equality], [], + [Some (OriginalNotation "=")]), None, + (5,5--5,6)), Ident F3, (5,2--5,6)), + Const (Int32 3, (5,7--5,8)), (5,2--5,8))), None)], + (3,0--5,10)), (3,0--5,10))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--5,10), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + CodeComments = [] }, set []))