From 7b1879f58aebe4162027f5e16d8f3b8e42727f09 Mon Sep 17 00:00:00 2001 From: Eugene Auduchinok Date: Tue, 19 Sep 2023 11:44:21 +0000 Subject: [PATCH] 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 []))