From f66162b450c262b3f86a89016dd6b8686f9dd134 Mon Sep 17 00:00:00 2001 From: Eugene Auduchinok Date: Tue, 11 Apr 2023 15:25:27 +0200 Subject: [PATCH 1/8] Parser: recover on missing union case names or representations --- src/Compiler/Checking/CheckDeclarations.fs | 5 +- src/Compiler/pars.fsy | 48 +++++++++++++++--- .../SyntaxTree/UnionCase/Missing name 01.fs | 4 ++ .../UnionCase/Missing name 01.fs.bsl | 29 +++++++++++ .../SyntaxTree/UnionCase/Missing name 02.fs | 6 +++ .../UnionCase/Missing name 02.fs.bsl | 37 ++++++++++++++ .../SyntaxTree/UnionCase/Missing name 03.fs | 6 +++ .../UnionCase/Missing name 03.fs.bsl | 49 +++++++++++++++++++ .../SyntaxTree/UnionCase/Missing name 04.fs | 6 +++ .../UnionCase/Missing name 04.fs.bsl | 44 +++++++++++++++++ .../SyntaxTree/UnionCase/Missing name 05.fs | 6 +++ .../UnionCase/Missing name 05.fs.bsl | 45 +++++++++++++++++ .../SyntaxTree/UnionCase/Missing name 06.fs | 6 +++ .../UnionCase/Missing name 06.fs.bsl | 41 ++++++++++++++++ .../SyntaxTree/UnionCase/Missing name 07.fs | 7 +++ .../UnionCase/Missing name 07.fs.bsl | 44 +++++++++++++++++ .../SyntaxTree/UnionCase/Missing name 08.fs | 6 +++ .../UnionCase/Missing name 08.fs.bsl | 42 ++++++++++++++++ .../SyntaxTree/UnionCase/Missing name 09.fs | 5 ++ .../UnionCase/Missing name 09.fs.bsl | 33 +++++++++++++ 20 files changed, 460 insertions(+), 9 deletions(-) create mode 100644 tests/service/data/SyntaxTree/UnionCase/Missing name 01.fs create mode 100644 tests/service/data/SyntaxTree/UnionCase/Missing name 01.fs.bsl create mode 100644 tests/service/data/SyntaxTree/UnionCase/Missing name 02.fs create mode 100644 tests/service/data/SyntaxTree/UnionCase/Missing name 02.fs.bsl create mode 100644 tests/service/data/SyntaxTree/UnionCase/Missing name 03.fs create mode 100644 tests/service/data/SyntaxTree/UnionCase/Missing name 03.fs.bsl create mode 100644 tests/service/data/SyntaxTree/UnionCase/Missing name 04.fs create mode 100644 tests/service/data/SyntaxTree/UnionCase/Missing name 04.fs.bsl create mode 100644 tests/service/data/SyntaxTree/UnionCase/Missing name 05.fs create mode 100644 tests/service/data/SyntaxTree/UnionCase/Missing name 05.fs.bsl create mode 100644 tests/service/data/SyntaxTree/UnionCase/Missing name 06.fs create mode 100644 tests/service/data/SyntaxTree/UnionCase/Missing name 06.fs.bsl create mode 100644 tests/service/data/SyntaxTree/UnionCase/Missing name 07.fs create mode 100644 tests/service/data/SyntaxTree/UnionCase/Missing name 07.fs.bsl create mode 100644 tests/service/data/SyntaxTree/UnionCase/Missing name 08.fs create mode 100644 tests/service/data/SyntaxTree/UnionCase/Missing name 08.fs.bsl create mode 100644 tests/service/data/SyntaxTree/UnionCase/Missing name 09.fs create mode 100644 tests/service/data/SyntaxTree/UnionCase/Missing name 09.fs.bsl diff --git a/src/Compiler/Checking/CheckDeclarations.fs b/src/Compiler/Checking/CheckDeclarations.fs index 87850dba694..3f5896e2c07 100644 --- a/src/Compiler/Checking/CheckDeclarations.fs +++ b/src/Compiler/Checking/CheckDeclarations.fs @@ -558,7 +558,10 @@ module TcRecdUnionAndEnumDeclarations = Construct.NewUnionCase id rfields recordTy attrs xmlDoc vis let TcUnionCaseDecls (cenv: cenv) env (parent: ParentRef) (thisTy: TType) (thisTyInst: TypeInst) hasRQAAttribute tpenv unionCases = - let unionCasesR = unionCases |> List.map (TcUnionCaseDecl cenv env parent thisTy thisTyInst tpenv hasRQAAttribute) + let unionCasesR = + unionCases + |> List.filter (fun (SynUnionCase(_, SynIdent(id, _), _, _, _, _, _)) -> id.idText <> "") + |> List.map (TcUnionCaseDecl cenv env parent thisTy thisTyInst tpenv hasRQAAttribute) unionCasesR |> CheckDuplicates (fun uc -> uc.Id) "union case" let MakeEnumCaseSpec cenv env parent attrs thisTy caseRange (caseIdent: Ident) (xmldoc: PreXmlDoc) value = diff --git a/src/Compiler/pars.fsy b/src/Compiler/pars.fsy index 291180af818..a1b5501b7e0 100644 --- a/src/Compiler/pars.fsy +++ b/src/Compiler/pars.fsy @@ -2387,6 +2387,14 @@ attrUnionCaseDecl: let mDecl = unionRangeWithXmlDoc xmlDoc mDecl Choice2Of2 (SynUnionCase ( $1, $3, SynUnionCaseKind.Fields [], xmlDoc, None, mDecl, trivia))) } + | opt_attributes opt_access recover + { if Option.isSome $2 then errorR(Error(FSComp.SR.parsUnionCasesCannotHaveVisibilityDeclarations(), rhs parseState 2)) + (fun (xmlDoc, mBar) -> + let id = SynIdent(mkSynId mBar.EndRange "", None) + let trivia: SynUnionCaseTrivia = { BarRange = Some mBar } + let mDecl = unionRangeWithXmlDoc xmlDoc mBar + Choice2Of2 (SynUnionCase ( $1, id, SynUnionCaseKind.Fields [], xmlDoc, None, mDecl, trivia))) } + | opt_attributes opt_access unionCaseName OF unionCaseRepr { if Option.isSome $2 then errorR(Error(FSComp.SR.parsUnionCasesCannotHaveVisibilityDeclarations(), rhs parseState 2)) let mDecl = rhs2 parseState 1 5 @@ -2395,6 +2403,16 @@ attrUnionCaseDecl: let mDecl = unionRangeWithXmlDoc xmlDoc mDecl Choice2Of2 (SynUnionCase ( $1, $3, SynUnionCaseKind.Fields $5, xmlDoc, None, mDecl, trivia))) } + | opt_attributes opt_access recover OF unionCaseRepr + { if Option.isSome $2 then errorR(Error(FSComp.SR.parsUnionCasesCannotHaveVisibilityDeclarations(), rhs parseState 2)) + let mDecl = rhs2 parseState 1 5 + let mOf = rhs parseState 4 + (fun (xmlDoc, mBar) -> + let id = SynIdent(mkSynId mOf.StartRange "", None) + let trivia: SynUnionCaseTrivia = { BarRange = Some mBar } + let mDecl = unionRangeWithXmlDoc xmlDoc mDecl + Choice2Of2 (SynUnionCase ( $1, id, SynUnionCaseKind.Fields $5, xmlDoc, None, mDecl, trivia))) } + | opt_attributes opt_access unionCaseName OF recover { if Option.isSome $2 then errorR(Error(FSComp.SR.parsUnionCasesCannotHaveVisibilityDeclarations(), rhs parseState 2)) let mDecl = rhs2 parseState 1 4 @@ -2453,19 +2471,33 @@ firstUnionCaseDeclOfMany: | firstUnionCaseDecl opt_OBLOCKSEP { $1 } -firstUnionCaseDecl: - | ident OF unionCaseRepr - { let trivia: SynUnionCaseTrivia = { BarRange = None } - let xmlDoc = grabXmlDoc(parseState, [], 1) - let mDecl = rhs2 parseState 1 3 |> unionRangeWithXmlDoc xmlDoc - Choice2Of2 (SynUnionCase ( [], SynIdent($1, None), SynUnionCaseKind.Fields $3, xmlDoc, None, mDecl, trivia)) } +firstUnionCaseDecl: + | ident OF unionCaseRepr + { let trivia: SynUnionCaseTrivia = { BarRange = None } + let xmlDoc = grabXmlDoc (parseState, [], 1) + let mDecl = rhs2 parseState 1 3 |> unionRangeWithXmlDoc xmlDoc + Choice2Of2(SynUnionCase([], SynIdent($1, None), SynUnionCaseKind.Fields $3, xmlDoc, None, mDecl, trivia)) } + + | ident OF recover + { let trivia: SynUnionCaseTrivia = { BarRange = None } + let xmlDoc = grabXmlDoc (parseState, [], 1) + let mDecl = rhs2 parseState 1 2 |> unionRangeWithXmlDoc xmlDoc + Choice2Of2(SynUnionCase([], SynIdent($1, None), SynUnionCaseKind.Fields [], xmlDoc, None, mDecl, trivia)) } + + | recover OF unionCaseRepr + { let mOf = rhs parseState 2 + let id = SynIdent(mkSynId mOf.StartRange "", None) + let trivia: SynUnionCaseTrivia = { BarRange = None } + let xmlDoc = grabXmlDoc (parseState, [], 1) + let mDecl = rhs2 parseState 2 3 |> unionRangeWithXmlDoc xmlDoc + Choice2Of2(SynUnionCase([], id, SynUnionCaseKind.Fields $3, xmlDoc, None, mDecl, trivia)) } | ident EQUALS atomicExpr opt_OBLOCKSEP { let mEquals = rhs parseState 2 let trivia: SynEnumCaseTrivia = { BarRange = None; EqualsRange = mEquals } - let xmlDoc = grabXmlDoc(parseState, [], 1) + let xmlDoc = grabXmlDoc (parseState, [], 1) let mDecl = rhs2 parseState 1 3 |> unionRangeWithXmlDoc xmlDoc - Choice1Of2 (SynEnumCase ([], SynIdent($1, None), fst $3, xmlDoc, mDecl, trivia)) } + Choice1Of2(SynEnumCase([], SynIdent($1, None), fst $3, xmlDoc, mDecl, trivia)) } unionCaseReprElements: | unionCaseReprElement STAR unionCaseReprElements diff --git a/tests/service/data/SyntaxTree/UnionCase/Missing name 01.fs b/tests/service/data/SyntaxTree/UnionCase/Missing name 01.fs new file mode 100644 index 00000000000..4f9e4a2b518 --- /dev/null +++ b/tests/service/data/SyntaxTree/UnionCase/Missing name 01.fs @@ -0,0 +1,4 @@ +module Module + +type U = + | diff --git a/tests/service/data/SyntaxTree/UnionCase/Missing name 01.fs.bsl b/tests/service/data/SyntaxTree/UnionCase/Missing name 01.fs.bsl new file mode 100644 index 00000000000..2be688c4b56 --- /dev/null +++ b/tests/service/data/SyntaxTree/UnionCase/Missing name 01.fs.bsl @@ -0,0 +1,29 @@ +ImplFile + (ParsedImplFileInput + ("/root/UnionCase/Missing name 01.fs", false, QualifiedNameOfFile Module, + [], [], + [SynModuleOrNamespace + ([Module], false, NamedModule, + [Types + ([SynTypeDefn + (SynComponentInfo + ([], None, [], [U], + PreXmlDoc ((3,0), FSharp.Compiler.Xml.XmlDocCollector), + false, None, (3,5--3,6)), + Simple + (Union + (None, + [SynUnionCase + ([], SynIdent (, None), Fields [], + PreXmlDoc ((4,4), FSharp.Compiler.Xml.XmlDocCollector), + None, (4,4--4,5), { BarRange = Some (4,4--4,5) })], + (4,4--4,5)), (4,4--4,5)), [], None, (3,5--4,5), + { LeadingKeyword = Type (3,0--3,4) + EqualsRange = Some (3,7--3,8) + WithKeyword = None })], (3,0--4,5))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--4,5), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + CodeComments = [] }, set [])) + +(5,0)-(5,0) parse error Incomplete structured construct at or before this point in union case. Expected identifier, '(', '(*)' or other token. diff --git a/tests/service/data/SyntaxTree/UnionCase/Missing name 02.fs b/tests/service/data/SyntaxTree/UnionCase/Missing name 02.fs new file mode 100644 index 00000000000..50cbb5b19f5 --- /dev/null +++ b/tests/service/data/SyntaxTree/UnionCase/Missing name 02.fs @@ -0,0 +1,6 @@ +module Module + +type U = + | A + | + | C diff --git a/tests/service/data/SyntaxTree/UnionCase/Missing name 02.fs.bsl b/tests/service/data/SyntaxTree/UnionCase/Missing name 02.fs.bsl new file mode 100644 index 00000000000..62d068253e9 --- /dev/null +++ b/tests/service/data/SyntaxTree/UnionCase/Missing name 02.fs.bsl @@ -0,0 +1,37 @@ +ImplFile + (ParsedImplFileInput + ("/root/UnionCase/Missing name 02.fs", false, QualifiedNameOfFile Module, + [], [], + [SynModuleOrNamespace + ([Module], false, NamedModule, + [Types + ([SynTypeDefn + (SynComponentInfo + ([], None, [], [U], + PreXmlDoc ((3,0), FSharp.Compiler.Xml.XmlDocCollector), + false, None, (3,5--3,6)), + Simple + (Union + (None, + [SynUnionCase + ([], SynIdent (A, None), Fields [], + PreXmlDoc ((4,4), FSharp.Compiler.Xml.XmlDocCollector), + None, (4,6--4,7), { BarRange = Some (4,4--4,5) }); + SynUnionCase + ([], SynIdent (, None), Fields [], + PreXmlDoc ((5,4), FSharp.Compiler.Xml.XmlDocCollector), + None, (5,4--5,5), { BarRange = Some (5,4--5,5) }); + SynUnionCase + ([], SynIdent (C, None), Fields [], + PreXmlDoc ((6,4), FSharp.Compiler.Xml.XmlDocCollector), + None, (6,6--6,7), { BarRange = Some (6,4--6,5) })], + (4,4--6,7)), (4,4--6,7)), [], None, (3,5--6,7), + { LeadingKeyword = Type (3,0--3,4) + EqualsRange = Some (3,7--3,8) + WithKeyword = None })], (3,0--6,7))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--6,7), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + CodeComments = [] }, set [])) + +(6,4)-(6,5) parse error Unexpected symbol '|' in union case. Expected identifier, '(', '(*)' or other token. diff --git a/tests/service/data/SyntaxTree/UnionCase/Missing name 03.fs b/tests/service/data/SyntaxTree/UnionCase/Missing name 03.fs new file mode 100644 index 00000000000..4734d3ce13c --- /dev/null +++ b/tests/service/data/SyntaxTree/UnionCase/Missing name 03.fs @@ -0,0 +1,6 @@ +module Module + +type U = + of int + +type A = int diff --git a/tests/service/data/SyntaxTree/UnionCase/Missing name 03.fs.bsl b/tests/service/data/SyntaxTree/UnionCase/Missing name 03.fs.bsl new file mode 100644 index 00000000000..4de834fc903 --- /dev/null +++ b/tests/service/data/SyntaxTree/UnionCase/Missing name 03.fs.bsl @@ -0,0 +1,49 @@ +ImplFile + (ParsedImplFileInput + ("/root/UnionCase/Missing name 03.fs", false, QualifiedNameOfFile Module, + [], [], + [SynModuleOrNamespace + ([Module], false, NamedModule, + [Types + ([SynTypeDefn + (SynComponentInfo + ([], None, [], [U], + PreXmlDoc ((3,0), FSharp.Compiler.Xml.XmlDocCollector), + false, None, (3,5--3,6)), + Simple + (Union + (None, + [SynUnionCase + ([], SynIdent (, None), + Fields + [SynField + ([], false, None, + LongIdent (SynLongIdent ([int], [], [None])), + false, + PreXmlDoc ((4,7), FSharp.Compiler.Xml.XmlDocCollector), + None, (4,7--4,10), { LeadingKeyword = None })], + PreXmlDoc ((4,4), FSharp.Compiler.Xml.XmlDocCollector), + None, (4,4--4,10), { BarRange = None })], + (4,4--4,10)), (4,4--4,10)), [], None, (3,5--4,10), + { LeadingKeyword = Type (3,0--3,4) + EqualsRange = Some (3,7--3,8) + WithKeyword = None })], (3,0--4,10)); + Types + ([SynTypeDefn + (SynComponentInfo + ([], None, [], [A], + PreXmlDoc ((6,0), FSharp.Compiler.Xml.XmlDocCollector), + false, None, (6,5--6,6)), + Simple + (TypeAbbrev + (Ok, LongIdent (SynLongIdent ([int], [], [None])), + (6,9--6,12)), (6,9--6,12)), [], None, (6,5--6,12), + { LeadingKeyword = Type (6,0--6,4) + EqualsRange = Some (6,7--6,8) + WithKeyword = None })], (6,0--6,12))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--6,12), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + CodeComments = [] }, set [])) + +(4,4)-(4,6) parse error Unexpected keyword 'of' in type definition diff --git a/tests/service/data/SyntaxTree/UnionCase/Missing name 04.fs b/tests/service/data/SyntaxTree/UnionCase/Missing name 04.fs new file mode 100644 index 00000000000..17d1ff8fb9f --- /dev/null +++ b/tests/service/data/SyntaxTree/UnionCase/Missing name 04.fs @@ -0,0 +1,6 @@ +module Module + +type U = + | A + | of int + | C diff --git a/tests/service/data/SyntaxTree/UnionCase/Missing name 04.fs.bsl b/tests/service/data/SyntaxTree/UnionCase/Missing name 04.fs.bsl new file mode 100644 index 00000000000..dcdab971a5f --- /dev/null +++ b/tests/service/data/SyntaxTree/UnionCase/Missing name 04.fs.bsl @@ -0,0 +1,44 @@ +ImplFile + (ParsedImplFileInput + ("/root/UnionCase/Missing name 04.fs", false, QualifiedNameOfFile Module, + [], [], + [SynModuleOrNamespace + ([Module], false, NamedModule, + [Types + ([SynTypeDefn + (SynComponentInfo + ([], None, [], [U], + PreXmlDoc ((3,0), FSharp.Compiler.Xml.XmlDocCollector), + false, None, (3,5--3,6)), + Simple + (Union + (None, + [SynUnionCase + ([], SynIdent (A, None), Fields [], + PreXmlDoc ((4,4), FSharp.Compiler.Xml.XmlDocCollector), + None, (4,6--4,7), { BarRange = Some (4,4--4,5) }); + SynUnionCase + ([], SynIdent (, None), + Fields + [SynField + ([], false, None, + LongIdent (SynLongIdent ([int], [], [None])), + false, + PreXmlDoc ((5,9), FSharp.Compiler.Xml.XmlDocCollector), + None, (5,9--5,12), { LeadingKeyword = None })], + PreXmlDoc ((5,4), FSharp.Compiler.Xml.XmlDocCollector), + None, (5,6--5,12), { BarRange = Some (5,4--5,5) }); + SynUnionCase + ([], SynIdent (C, None), Fields [], + PreXmlDoc ((6,4), FSharp.Compiler.Xml.XmlDocCollector), + None, (6,6--6,7), { BarRange = Some (6,4--6,5) })], + (4,4--6,7)), (4,4--6,7)), [], None, (3,5--6,7), + { LeadingKeyword = Type (3,0--3,4) + EqualsRange = Some (3,7--3,8) + WithKeyword = None })], (3,0--6,7))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--6,7), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + CodeComments = [] }, set [])) + +(5,6)-(5,8) parse error Unexpected keyword 'of' in union case. Expected identifier, '(', '(*)' or other token. diff --git a/tests/service/data/SyntaxTree/UnionCase/Missing name 05.fs b/tests/service/data/SyntaxTree/UnionCase/Missing name 05.fs new file mode 100644 index 00000000000..bfe9a61b7d9 --- /dev/null +++ b/tests/service/data/SyntaxTree/UnionCase/Missing name 05.fs @@ -0,0 +1,6 @@ +module Module + +type U = + | A + | internal of int + | C diff --git a/tests/service/data/SyntaxTree/UnionCase/Missing name 05.fs.bsl b/tests/service/data/SyntaxTree/UnionCase/Missing name 05.fs.bsl new file mode 100644 index 00000000000..eda8eac58ca --- /dev/null +++ b/tests/service/data/SyntaxTree/UnionCase/Missing name 05.fs.bsl @@ -0,0 +1,45 @@ +ImplFile + (ParsedImplFileInput + ("/root/UnionCase/Missing name 05.fs", false, QualifiedNameOfFile Module, + [], [], + [SynModuleOrNamespace + ([Module], false, NamedModule, + [Types + ([SynTypeDefn + (SynComponentInfo + ([], None, [], [U], + PreXmlDoc ((3,0), FSharp.Compiler.Xml.XmlDocCollector), + false, None, (3,5--3,6)), + Simple + (Union + (None, + [SynUnionCase + ([], SynIdent (A, None), Fields [], + PreXmlDoc ((4,4), FSharp.Compiler.Xml.XmlDocCollector), + None, (4,6--4,7), { BarRange = Some (4,4--4,5) }); + SynUnionCase + ([], SynIdent (, None), + Fields + [SynField + ([], false, None, + LongIdent (SynLongIdent ([int], [], [None])), + false, + PreXmlDoc ((5,18), FSharp.Compiler.Xml.XmlDocCollector), + None, (5,18--5,21), { LeadingKeyword = None })], + PreXmlDoc ((5,4), FSharp.Compiler.Xml.XmlDocCollector), + None, (5,6--5,21), { BarRange = Some (5,4--5,5) }); + SynUnionCase + ([], SynIdent (C, None), Fields [], + PreXmlDoc ((6,4), FSharp.Compiler.Xml.XmlDocCollector), + None, (6,6--6,7), { BarRange = Some (6,4--6,5) })], + (4,4--6,7)), (4,4--6,7)), [], None, (3,5--6,7), + { LeadingKeyword = Type (3,0--3,4) + EqualsRange = Some (3,7--3,8) + WithKeyword = None })], (3,0--6,7))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--6,7), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + CodeComments = [] }, set [])) + +(5,15)-(5,17) parse error Unexpected keyword 'of' in union case. Expected identifier, '(', '(*)' or other token. +(5,6)-(5,14) parse error Accessibility modifiers are not permitted on union cases. Use 'type U = internal ...' or 'type U = private ...' to give an accessibility to the whole representation. diff --git a/tests/service/data/SyntaxTree/UnionCase/Missing name 06.fs b/tests/service/data/SyntaxTree/UnionCase/Missing name 06.fs new file mode 100644 index 00000000000..189f8ad7ebb --- /dev/null +++ b/tests/service/data/SyntaxTree/UnionCase/Missing name 06.fs @@ -0,0 +1,6 @@ +module Module + +type U = + | A + | internal of + | C diff --git a/tests/service/data/SyntaxTree/UnionCase/Missing name 06.fs.bsl b/tests/service/data/SyntaxTree/UnionCase/Missing name 06.fs.bsl new file mode 100644 index 00000000000..6434a5e31ac --- /dev/null +++ b/tests/service/data/SyntaxTree/UnionCase/Missing name 06.fs.bsl @@ -0,0 +1,41 @@ +ImplFile + (ParsedImplFileInput + ("/root/UnionCase/Missing name 06.fs", false, QualifiedNameOfFile Module, + [], [], + [SynModuleOrNamespace + ([Module], false, NamedModule, + [Types + ([SynTypeDefn + (SynComponentInfo + ([], None, [], [U], + PreXmlDoc ((3,0), FSharp.Compiler.Xml.XmlDocCollector), + false, None, (3,5--3,6)), + Simple + (Union + (None, + [SynUnionCase + ([], SynIdent (A, None), Fields [], + PreXmlDoc ((4,4), FSharp.Compiler.Xml.XmlDocCollector), + None, (4,6--4,7), { BarRange = Some (4,4--4,5) }); + SynUnionCase + ([], SynIdent (, None), + Fields + [SynField + ([], false, None, + LongIdent (SynLongIdent ([C], [], [None])), + false, + PreXmlDoc ((6,6), FSharp.Compiler.Xml.XmlDocCollector), + None, (6,6--6,7), { LeadingKeyword = None })], + PreXmlDoc ((5,4), FSharp.Compiler.Xml.XmlDocCollector), + None, (5,6--6,7), { BarRange = Some (5,4--5,5) })], + (4,4--6,7)), (4,4--6,7)), [], None, (3,5--6,7), + { LeadingKeyword = Type (3,0--3,4) + EqualsRange = Some (3,7--3,8) + WithKeyword = None })], (3,0--6,7))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--6,7), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + CodeComments = [] }, set [])) + +(5,15)-(5,17) parse error Unexpected keyword 'of' in union case. Expected identifier, '(', '(*)' or other token. +(5,6)-(5,14) parse error Accessibility modifiers are not permitted on union cases. Use 'type U = internal ...' or 'type U = private ...' to give an accessibility to the whole representation. diff --git a/tests/service/data/SyntaxTree/UnionCase/Missing name 07.fs b/tests/service/data/SyntaxTree/UnionCase/Missing name 07.fs new file mode 100644 index 00000000000..bab3df45ca4 --- /dev/null +++ b/tests/service/data/SyntaxTree/UnionCase/Missing name 07.fs @@ -0,0 +1,7 @@ +module Module + +type U = + | A + | of + | C + | D diff --git a/tests/service/data/SyntaxTree/UnionCase/Missing name 07.fs.bsl b/tests/service/data/SyntaxTree/UnionCase/Missing name 07.fs.bsl new file mode 100644 index 00000000000..ab017de8998 --- /dev/null +++ b/tests/service/data/SyntaxTree/UnionCase/Missing name 07.fs.bsl @@ -0,0 +1,44 @@ +ImplFile + (ParsedImplFileInput + ("/root/UnionCase/Missing name 07.fs", false, QualifiedNameOfFile Module, + [], [], + [SynModuleOrNamespace + ([Module], false, NamedModule, + [Types + ([SynTypeDefn + (SynComponentInfo + ([], None, [], [U], + PreXmlDoc ((3,0), FSharp.Compiler.Xml.XmlDocCollector), + false, None, (3,5--3,6)), + Simple + (Union + (None, + [SynUnionCase + ([], SynIdent (A, None), Fields [], + PreXmlDoc ((4,4), FSharp.Compiler.Xml.XmlDocCollector), + None, (4,6--4,7), { BarRange = Some (4,4--4,5) }); + SynUnionCase + ([], SynIdent (, None), + Fields + [SynField + ([], false, None, + LongIdent (SynLongIdent ([C], [], [None])), + false, + PreXmlDoc ((6,6), FSharp.Compiler.Xml.XmlDocCollector), + None, (6,6--6,7), { LeadingKeyword = None })], + PreXmlDoc ((5,4), FSharp.Compiler.Xml.XmlDocCollector), + None, (5,6--6,7), { BarRange = Some (5,4--5,5) }); + SynUnionCase + ([], SynIdent (D, None), Fields [], + PreXmlDoc ((7,4), FSharp.Compiler.Xml.XmlDocCollector), + None, (7,6--7,7), { BarRange = Some (7,4--7,5) })], + (4,4--7,7)), (4,4--7,7)), [], None, (3,5--7,7), + { LeadingKeyword = Type (3,0--3,4) + EqualsRange = Some (3,7--3,8) + WithKeyword = None })], (3,0--7,7))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--7,7), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + CodeComments = [] }, set [])) + +(5,6)-(5,8) parse error Unexpected keyword 'of' in union case. Expected identifier, '(', '(*)' or other token. diff --git a/tests/service/data/SyntaxTree/UnionCase/Missing name 08.fs b/tests/service/data/SyntaxTree/UnionCase/Missing name 08.fs new file mode 100644 index 00000000000..76738ee661e --- /dev/null +++ b/tests/service/data/SyntaxTree/UnionCase/Missing name 08.fs @@ -0,0 +1,6 @@ +module Module + +type U = + A of + +type A = int diff --git a/tests/service/data/SyntaxTree/UnionCase/Missing name 08.fs.bsl b/tests/service/data/SyntaxTree/UnionCase/Missing name 08.fs.bsl new file mode 100644 index 00000000000..238d9916e07 --- /dev/null +++ b/tests/service/data/SyntaxTree/UnionCase/Missing name 08.fs.bsl @@ -0,0 +1,42 @@ +ImplFile + (ParsedImplFileInput + ("/root/UnionCase/Missing name 08.fs", false, QualifiedNameOfFile Module, + [], [], + [SynModuleOrNamespace + ([Module], false, NamedModule, + [Types + ([SynTypeDefn + (SynComponentInfo + ([], None, [], [U], + PreXmlDoc ((3,0), FSharp.Compiler.Xml.XmlDocCollector), + false, None, (3,5--3,6)), + Simple + (Union + (None, + [SynUnionCase + ([], SynIdent (A, None), Fields [], + PreXmlDoc ((4,4), FSharp.Compiler.Xml.XmlDocCollector), + None, (4,4--4,8), { BarRange = None })], (4,4--4,8)), + (4,4--4,8)), [], None, (3,5--4,8), + { LeadingKeyword = Type (3,0--3,4) + EqualsRange = Some (3,7--3,8) + WithKeyword = None })], (3,0--4,8)); + Types + ([SynTypeDefn + (SynComponentInfo + ([], None, [], [A], + PreXmlDoc ((6,0), FSharp.Compiler.Xml.XmlDocCollector), + false, None, (6,5--6,6)), + Simple + (TypeAbbrev + (Ok, LongIdent (SynLongIdent ([int], [], [None])), + (6,9--6,12)), (6,9--6,12)), [], None, (6,5--6,12), + { LeadingKeyword = Type (6,0--6,4) + EqualsRange = Some (6,7--6,8) + WithKeyword = None })], (6,0--6,12))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--6,12), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + CodeComments = [] }, set [])) + +(6,0)-(6,4) parse error Incomplete structured construct at or before this point in type definition diff --git a/tests/service/data/SyntaxTree/UnionCase/Missing name 09.fs b/tests/service/data/SyntaxTree/UnionCase/Missing name 09.fs new file mode 100644 index 00000000000..e56cf79b66f --- /dev/null +++ b/tests/service/data/SyntaxTree/UnionCase/Missing name 09.fs @@ -0,0 +1,5 @@ +module Module + +type U = + A of + | B diff --git a/tests/service/data/SyntaxTree/UnionCase/Missing name 09.fs.bsl b/tests/service/data/SyntaxTree/UnionCase/Missing name 09.fs.bsl new file mode 100644 index 00000000000..47c92aa67e0 --- /dev/null +++ b/tests/service/data/SyntaxTree/UnionCase/Missing name 09.fs.bsl @@ -0,0 +1,33 @@ +ImplFile + (ParsedImplFileInput + ("/root/UnionCase/Missing name 09.fs", false, QualifiedNameOfFile Module, + [], [], + [SynModuleOrNamespace + ([Module], false, NamedModule, + [Types + ([SynTypeDefn + (SynComponentInfo + ([], None, [], [U], + PreXmlDoc ((3,0), FSharp.Compiler.Xml.XmlDocCollector), + false, None, (3,5--3,6)), + Simple + (Union + (None, + [SynUnionCase + ([], SynIdent (A, None), Fields [], + PreXmlDoc ((4,4), FSharp.Compiler.Xml.XmlDocCollector), + None, (4,4--4,8), { BarRange = None }); + SynUnionCase + ([], SynIdent (B, None), Fields [], + PreXmlDoc ((5,4), FSharp.Compiler.Xml.XmlDocCollector), + None, (5,6--5,7), { BarRange = Some (5,4--5,5) })], + (4,4--5,7)), (4,4--5,7)), [], None, (3,5--5,7), + { LeadingKeyword = Type (3,0--3,4) + EqualsRange = Some (3,7--3,8) + WithKeyword = None })], (3,0--5,7))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--5,7), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + CodeComments = [] }, set [])) + +(5,4)-(5,5) parse error Unexpected symbol '|' in type definition From fdebab97666ceae8cb00569d2f4f226a0d2f2312 Mon Sep 17 00:00:00 2001 From: Eugene Auduchinok Date: Tue, 11 Apr 2023 20:06:48 +0200 Subject: [PATCH 2/8] Better missing name recovery --- src/Compiler/FSComp.txt | 1 + src/Compiler/pars.fsy | 24 +++++++++++-------- .../UnionCase/Missing name 01.fs.bsl | 2 +- .../UnionCase/Missing name 02.fs.bsl | 2 +- .../UnionCase/Missing name 03.fs.bsl | 2 +- .../UnionCase/Missing name 04.fs.bsl | 2 +- .../UnionCase/Missing name 05.fs.bsl | 2 +- .../UnionCase/Missing name 06.fs.bsl | 17 ++++++------- .../UnionCase/Missing name 07.fs.bsl | 17 ++++++------- 9 files changed, 34 insertions(+), 35 deletions(-) diff --git a/src/Compiler/FSComp.txt b/src/Compiler/FSComp.txt index f9d375b1547..26ef0736dc1 100644 --- a/src/Compiler/FSComp.txt +++ b/src/Compiler/FSComp.txt @@ -1685,4 +1685,5 @@ featureEscapeBracesInFormattableString,"Escapes curly braces before calling Form 3561,chkAutoOpenAttributeInTypeAbbrev,"FSharp.Core.AutoOpenAttribute should not be aliased." 3562,parsUnexpectedEndOfFileElif,"Unexpected end of input in 'else if' or 'elif' branch of conditional expression. Expected 'elif then ' or 'else if then '." 3563,lexInvalidIdentifier,"This is not a valid identifier" +3564,parsMissingUnionCaseName,"Missing union case name" 3565,parsExpectingType,"Expecting type" diff --git a/src/Compiler/pars.fsy b/src/Compiler/pars.fsy index a1b5501b7e0..1aa53da0afb 100644 --- a/src/Compiler/pars.fsy +++ b/src/Compiler/pars.fsy @@ -2403,15 +2403,17 @@ attrUnionCaseDecl: let mDecl = unionRangeWithXmlDoc xmlDoc mDecl Choice2Of2 (SynUnionCase ( $1, $3, SynUnionCaseKind.Fields $5, xmlDoc, None, mDecl, trivia))) } - | opt_attributes opt_access recover OF unionCaseRepr + | opt_attributes opt_access OF unionCaseRepr { if Option.isSome $2 then errorR(Error(FSComp.SR.parsUnionCasesCannotHaveVisibilityDeclarations(), rhs parseState 2)) - let mDecl = rhs2 parseState 1 5 - let mOf = rhs parseState 4 + let mOf = rhs parseState 3 + let mId = mOf.StartRange + errorR (Error(FSComp.SR.parsMissingUnionCaseName(), mId)) + let mDecl = rhs2 parseState 1 4 (fun (xmlDoc, mBar) -> - let id = SynIdent(mkSynId mOf.StartRange "", None) + let id = SynIdent(mkSynId mId "", None) let trivia: SynUnionCaseTrivia = { BarRange = Some mBar } let mDecl = unionRangeWithXmlDoc xmlDoc mDecl - Choice2Of2 (SynUnionCase ( $1, id, SynUnionCaseKind.Fields $5, xmlDoc, None, mDecl, trivia))) } + Choice2Of2 (SynUnionCase ( $1, id, SynUnionCaseKind.Fields $4, xmlDoc, None, mDecl, trivia))) } | opt_attributes opt_access unionCaseName OF recover { if Option.isSome $2 then errorR(Error(FSComp.SR.parsUnionCasesCannotHaveVisibilityDeclarations(), rhs parseState 2)) @@ -2484,13 +2486,15 @@ firstUnionCaseDecl: let mDecl = rhs2 parseState 1 2 |> unionRangeWithXmlDoc xmlDoc Choice2Of2(SynUnionCase([], SynIdent($1, None), SynUnionCaseKind.Fields [], xmlDoc, None, mDecl, trivia)) } - | recover OF unionCaseRepr - { let mOf = rhs parseState 2 - let id = SynIdent(mkSynId mOf.StartRange "", None) + | OF unionCaseRepr + { let mOf = rhs parseState 1 + let mId = mOf.StartRange + errorR (Error(FSComp.SR.parsMissingUnionCaseName(), mId)) + let id = SynIdent(mkSynId mId "", None) let trivia: SynUnionCaseTrivia = { BarRange = None } let xmlDoc = grabXmlDoc (parseState, [], 1) - let mDecl = rhs2 parseState 2 3 |> unionRangeWithXmlDoc xmlDoc - Choice2Of2(SynUnionCase([], id, SynUnionCaseKind.Fields $3, xmlDoc, None, mDecl, trivia)) } + let mDecl = rhs2 parseState 1 2 |> unionRangeWithXmlDoc xmlDoc + Choice2Of2(SynUnionCase([], id, SynUnionCaseKind.Fields $2, xmlDoc, None, mDecl, trivia)) } | ident EQUALS atomicExpr opt_OBLOCKSEP { let mEquals = rhs parseState 2 diff --git a/tests/service/data/SyntaxTree/UnionCase/Missing name 01.fs.bsl b/tests/service/data/SyntaxTree/UnionCase/Missing name 01.fs.bsl index 2be688c4b56..a67e4eb8783 100644 --- a/tests/service/data/SyntaxTree/UnionCase/Missing name 01.fs.bsl +++ b/tests/service/data/SyntaxTree/UnionCase/Missing name 01.fs.bsl @@ -26,4 +26,4 @@ ImplFile { ConditionalDirectives = [] CodeComments = [] }, set [])) -(5,0)-(5,0) parse error Incomplete structured construct at or before this point in union case. Expected identifier, '(', '(*)' or other token. +(5,0)-(5,0) parse error Incomplete structured construct at or before this point in union case diff --git a/tests/service/data/SyntaxTree/UnionCase/Missing name 02.fs.bsl b/tests/service/data/SyntaxTree/UnionCase/Missing name 02.fs.bsl index 62d068253e9..02c674e6a1f 100644 --- a/tests/service/data/SyntaxTree/UnionCase/Missing name 02.fs.bsl +++ b/tests/service/data/SyntaxTree/UnionCase/Missing name 02.fs.bsl @@ -34,4 +34,4 @@ ImplFile { ConditionalDirectives = [] CodeComments = [] }, set [])) -(6,4)-(6,5) parse error Unexpected symbol '|' in union case. Expected identifier, '(', '(*)' or other token. +(6,4)-(6,5) parse error Unexpected symbol '|' in union case diff --git a/tests/service/data/SyntaxTree/UnionCase/Missing name 03.fs.bsl b/tests/service/data/SyntaxTree/UnionCase/Missing name 03.fs.bsl index 4de834fc903..0f7d8d1f622 100644 --- a/tests/service/data/SyntaxTree/UnionCase/Missing name 03.fs.bsl +++ b/tests/service/data/SyntaxTree/UnionCase/Missing name 03.fs.bsl @@ -46,4 +46,4 @@ ImplFile { ConditionalDirectives = [] CodeComments = [] }, set [])) -(4,4)-(4,6) parse error Unexpected keyword 'of' in type definition +(4,4)-(4,4) parse error Missing union case name diff --git a/tests/service/data/SyntaxTree/UnionCase/Missing name 04.fs.bsl b/tests/service/data/SyntaxTree/UnionCase/Missing name 04.fs.bsl index dcdab971a5f..7e7e8b51851 100644 --- a/tests/service/data/SyntaxTree/UnionCase/Missing name 04.fs.bsl +++ b/tests/service/data/SyntaxTree/UnionCase/Missing name 04.fs.bsl @@ -41,4 +41,4 @@ ImplFile { ConditionalDirectives = [] CodeComments = [] }, set [])) -(5,6)-(5,8) parse error Unexpected keyword 'of' in union case. Expected identifier, '(', '(*)' or other token. +(5,6)-(5,6) parse error Missing union case name diff --git a/tests/service/data/SyntaxTree/UnionCase/Missing name 05.fs.bsl b/tests/service/data/SyntaxTree/UnionCase/Missing name 05.fs.bsl index eda8eac58ca..1474285fac9 100644 --- a/tests/service/data/SyntaxTree/UnionCase/Missing name 05.fs.bsl +++ b/tests/service/data/SyntaxTree/UnionCase/Missing name 05.fs.bsl @@ -41,5 +41,5 @@ ImplFile { ConditionalDirectives = [] CodeComments = [] }, set [])) -(5,15)-(5,17) parse error Unexpected keyword 'of' in union case. Expected identifier, '(', '(*)' or other token. (5,6)-(5,14) parse error Accessibility modifiers are not permitted on union cases. Use 'type U = internal ...' or 'type U = private ...' to give an accessibility to the whole representation. +(5,15)-(5,15) parse error Missing union case name diff --git a/tests/service/data/SyntaxTree/UnionCase/Missing name 06.fs.bsl b/tests/service/data/SyntaxTree/UnionCase/Missing name 06.fs.bsl index 6434a5e31ac..521291cca79 100644 --- a/tests/service/data/SyntaxTree/UnionCase/Missing name 06.fs.bsl +++ b/tests/service/data/SyntaxTree/UnionCase/Missing name 06.fs.bsl @@ -18,16 +18,13 @@ ImplFile PreXmlDoc ((4,4), FSharp.Compiler.Xml.XmlDocCollector), None, (4,6--4,7), { BarRange = Some (4,4--4,5) }); SynUnionCase - ([], SynIdent (, None), - Fields - [SynField - ([], false, None, - LongIdent (SynLongIdent ([C], [], [None])), - false, - PreXmlDoc ((6,6), FSharp.Compiler.Xml.XmlDocCollector), - None, (6,6--6,7), { LeadingKeyword = None })], + ([], SynIdent (, None), Fields [], PreXmlDoc ((5,4), FSharp.Compiler.Xml.XmlDocCollector), - None, (5,6--6,7), { BarRange = Some (5,4--5,5) })], + None, (5,4--5,5), { BarRange = Some (5,4--5,5) }); + SynUnionCase + ([], SynIdent (C, None), Fields [], + PreXmlDoc ((6,4), FSharp.Compiler.Xml.XmlDocCollector), + None, (6,6--6,7), { BarRange = Some (6,4--6,5) })], (4,4--6,7)), (4,4--6,7)), [], None, (3,5--6,7), { LeadingKeyword = Type (3,0--3,4) EqualsRange = Some (3,7--3,8) @@ -37,5 +34,5 @@ ImplFile { ConditionalDirectives = [] CodeComments = [] }, set [])) -(5,15)-(5,17) parse error Unexpected keyword 'of' in union case. Expected identifier, '(', '(*)' or other token. +(6,4)-(6,5) parse error Unexpected symbol '|' in union case (5,6)-(5,14) parse error Accessibility modifiers are not permitted on union cases. Use 'type U = internal ...' or 'type U = private ...' to give an accessibility to the whole representation. diff --git a/tests/service/data/SyntaxTree/UnionCase/Missing name 07.fs.bsl b/tests/service/data/SyntaxTree/UnionCase/Missing name 07.fs.bsl index ab017de8998..d0ab98173d2 100644 --- a/tests/service/data/SyntaxTree/UnionCase/Missing name 07.fs.bsl +++ b/tests/service/data/SyntaxTree/UnionCase/Missing name 07.fs.bsl @@ -18,16 +18,13 @@ ImplFile PreXmlDoc ((4,4), FSharp.Compiler.Xml.XmlDocCollector), None, (4,6--4,7), { BarRange = Some (4,4--4,5) }); SynUnionCase - ([], SynIdent (, None), - Fields - [SynField - ([], false, None, - LongIdent (SynLongIdent ([C], [], [None])), - false, - PreXmlDoc ((6,6), FSharp.Compiler.Xml.XmlDocCollector), - None, (6,6--6,7), { LeadingKeyword = None })], + ([], SynIdent (, None), Fields [], PreXmlDoc ((5,4), FSharp.Compiler.Xml.XmlDocCollector), - None, (5,6--6,7), { BarRange = Some (5,4--5,5) }); + None, (5,4--5,5), { BarRange = Some (5,4--5,5) }); + SynUnionCase + ([], SynIdent (C, None), Fields [], + PreXmlDoc ((6,4), FSharp.Compiler.Xml.XmlDocCollector), + None, (6,6--6,7), { BarRange = Some (6,4--6,5) }); SynUnionCase ([], SynIdent (D, None), Fields [], PreXmlDoc ((7,4), FSharp.Compiler.Xml.XmlDocCollector), @@ -41,4 +38,4 @@ ImplFile { ConditionalDirectives = [] CodeComments = [] }, set [])) -(5,6)-(5,8) parse error Unexpected keyword 'of' in union case. Expected identifier, '(', '(*)' or other token. +(6,4)-(6,5) parse error Unexpected symbol '|' in union case From 12fae0314905f757f11090cce21f3107d8db4183 Mon Sep 17 00:00:00 2001 From: Eugene Auduchinok Date: Wed, 12 Apr 2023 10:57:31 +0200 Subject: [PATCH 3/8] Update baselines --- .../TypeAbbreviations/TypeAbbreviations.fs | 2 +- .../Conformance/UnionTypes/UnionTypes.fs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicTypeAndModuleDefinitions/TypeAbbreviations/TypeAbbreviations.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicTypeAndModuleDefinitions/TypeAbbreviations/TypeAbbreviations.fs index 6e1b6f61cc8..10678e2757f 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicTypeAndModuleDefinitions/TypeAbbreviations/TypeAbbreviations.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicTypeAndModuleDefinitions/TypeAbbreviations/TypeAbbreviations.fs @@ -138,7 +138,7 @@ module TypeAbbreviations = |> verifyCompile |> shouldFail |> withDiagnostics [ - (Error 10, Line 6, Col 16, Line 6, Col 18, "Unexpected keyword 'of' in type definition") + (Error 3564, Line 6, Col 16, Line 6, Col 16, "Missing union case name") ] //SOURCE=E_IncorrectRightSide_Quotation.fsx SCFLAGS="--test:ErrorRanges" # E_IncorrectRightSide_Quotation.fsx diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/UnionTypes/UnionTypes.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/UnionTypes/UnionTypes.fs index 5ed40fe06b0..543253ce889 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/UnionTypes/UnionTypes.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/UnionTypes/UnionTypes.fs @@ -71,7 +71,7 @@ module UnionTypes = |> verifyCompile |> shouldFail |> withDiagnostics [ - (Error 10, Line 8, Col 12, Line 8, Col 13, "Unexpected integer literal in union case. Expected identifier, '(', '(*)' or other token.") + (Error 10, Line 8, Col 12, Line 8, Col 13, "Unexpected integer literal in union case") ] //SOURCE=E_BeginWithUppercase03.fsx SCFLAGS="--test:ErrorRanges" # E_BeginWithUppercase03.fsx @@ -81,7 +81,7 @@ module UnionTypes = |> verifyCompile |> shouldFail |> withDiagnostics [ - (Error 10, Line 9, Col 12, Line 9, Col 15, "Unexpected string literal in union case. Expected identifier, '(', '(*)' or other token.") + (Error 10, Line 9, Col 12, Line 9, Col 15, "Unexpected string literal in union case") ] //SOURCE=E_BeginWithUppercase04.fsx SCFLAGS="--test:ErrorRanges" # E_BeginWithUppercase04.fsx From 87a6d31ac0c702d03400548b6e564d0740ea0c55 Mon Sep 17 00:00:00 2001 From: Eugene Auduchinok Date: Wed, 12 Apr 2023 12:35:31 +0200 Subject: [PATCH 4/8] Update xlf --- src/Compiler/xlf/FSComp.txt.cs.xlf | 5 +++++ src/Compiler/xlf/FSComp.txt.de.xlf | 5 +++++ src/Compiler/xlf/FSComp.txt.es.xlf | 5 +++++ src/Compiler/xlf/FSComp.txt.fr.xlf | 5 +++++ src/Compiler/xlf/FSComp.txt.it.xlf | 5 +++++ src/Compiler/xlf/FSComp.txt.ja.xlf | 5 +++++ src/Compiler/xlf/FSComp.txt.ko.xlf | 5 +++++ src/Compiler/xlf/FSComp.txt.pl.xlf | 5 +++++ src/Compiler/xlf/FSComp.txt.pt-BR.xlf | 5 +++++ src/Compiler/xlf/FSComp.txt.ru.xlf | 5 +++++ src/Compiler/xlf/FSComp.txt.tr.xlf | 5 +++++ src/Compiler/xlf/FSComp.txt.zh-Hans.xlf | 5 +++++ src/Compiler/xlf/FSComp.txt.zh-Hant.xlf | 5 +++++ tests/service/SyntaxTreeTests.fs | 2 +- 14 files changed, 66 insertions(+), 1 deletion(-) diff --git a/src/Compiler/xlf/FSComp.txt.cs.xlf b/src/Compiler/xlf/FSComp.txt.cs.xlf index 1b9942ba43c..669a1cf177e 100644 --- a/src/Compiler/xlf/FSComp.txt.cs.xlf +++ b/src/Compiler/xlf/FSComp.txt.cs.xlf @@ -777,6 +777,11 @@ Neúplný výraz operátoru (například^b) nebo volání kvalifikovaného typu (příklad: ^T.Name) + + Missing union case name + Missing union case name + + This member access is ambiguous. Please use parentheses around the object creation, e.g. '(new SomeType(args)).MemberName' Tento přístup člena je nejednoznačný. Při vytváření objektu použijte závorky, např. (new SomeType(args)).MemberName' diff --git a/src/Compiler/xlf/FSComp.txt.de.xlf b/src/Compiler/xlf/FSComp.txt.de.xlf index ec1ae62cfa9..99cf7d8407c 100644 --- a/src/Compiler/xlf/FSComp.txt.de.xlf +++ b/src/Compiler/xlf/FSComp.txt.de.xlf @@ -777,6 +777,11 @@ Unvollständiger Operatorausdruck (Beispiel: a^b) oder qualifizierter Typaufruf (Beispiel: ^T.Name) + + Missing union case name + Missing union case name + + This member access is ambiguous. Please use parentheses around the object creation, e.g. '(new SomeType(args)).MemberName' Dieser Memberzugriff ist mehrdeutig. Setzen Sie Klammern um die Objekterstellung, z. B. "(new SomeType(args)). MemberName“ diff --git a/src/Compiler/xlf/FSComp.txt.es.xlf b/src/Compiler/xlf/FSComp.txt.es.xlf index 16d671b2171..1e889b6e329 100644 --- a/src/Compiler/xlf/FSComp.txt.es.xlf +++ b/src/Compiler/xlf/FSComp.txt.es.xlf @@ -777,6 +777,11 @@ Expresión de operador incompleta (ejemplo, a^b) o invocación de tipo calificada (ejemplo: ^T.Name) + + Missing union case name + Missing union case name + + This member access is ambiguous. Please use parentheses around the object creation, e.g. '(new SomeType(args)).MemberName' Este acceso de miembro es ambiguo. Use paréntesis alrededor de la creación del objeto, por ejemplo, '(nuevo AlgúnTipo(args)).NombreMiembro' diff --git a/src/Compiler/xlf/FSComp.txt.fr.xlf b/src/Compiler/xlf/FSComp.txt.fr.xlf index 4b522395f66..cb6d5cfe076 100644 --- a/src/Compiler/xlf/FSComp.txt.fr.xlf +++ b/src/Compiler/xlf/FSComp.txt.fr.xlf @@ -777,6 +777,11 @@ Expression d’opérateur incomplète (exemple a^b) ou appel de type qualifié (exemple : ^T.Name) + + Missing union case name + Missing union case name + + This member access is ambiguous. Please use parentheses around the object creation, e.g. '(new SomeType(args)).MemberName' L’accès à ce membre est ambigu. Utilisez des parenthèses autour de la création de l’objet, par exemple' (New SomeType (args)). MemberName diff --git a/src/Compiler/xlf/FSComp.txt.it.xlf b/src/Compiler/xlf/FSComp.txt.it.xlf index 16d3c843769..48a1e719e87 100644 --- a/src/Compiler/xlf/FSComp.txt.it.xlf +++ b/src/Compiler/xlf/FSComp.txt.it.xlf @@ -777,6 +777,11 @@ Espressione operatore incompleta (ad esempio a^b) o chiamata di tipo qualificato (ad esempio: ^T.Name) + + Missing union case name + Missing union case name + + This member access is ambiguous. Please use parentheses around the object creation, e.g. '(new SomeType(args)).MemberName' L'accesso ai membri è ambiguo. Utilizzare le parentesi intorno alla creazione oggetto, ad esempio “(New SomeType (args)). MemberName” diff --git a/src/Compiler/xlf/FSComp.txt.ja.xlf b/src/Compiler/xlf/FSComp.txt.ja.xlf index 7121a3b1a03..126d2e4709c 100644 --- a/src/Compiler/xlf/FSComp.txt.ja.xlf +++ b/src/Compiler/xlf/FSComp.txt.ja.xlf @@ -777,6 +777,11 @@ 不完全な演算子式 (例 a^b) または修飾型の呼び出し (例: ^T.Name) + + Missing union case name + Missing union case name + + This member access is ambiguous. Please use parentheses around the object creation, e.g. '(new SomeType(args)).MemberName' このメンバーへのアクセスはあいまいです。オブジェクト作成の前後にはかっこを使用してください。例: '(new SomeType(args)).MemberName' diff --git a/src/Compiler/xlf/FSComp.txt.ko.xlf b/src/Compiler/xlf/FSComp.txt.ko.xlf index cbf8c80d63b..639df27e2f8 100644 --- a/src/Compiler/xlf/FSComp.txt.ko.xlf +++ b/src/Compiler/xlf/FSComp.txt.ko.xlf @@ -777,6 +777,11 @@ 불완전한 연산자 식(예: a^b) 또는 정규화된 형식 호출(예: ^T.Name) + + Missing union case name + Missing union case name + + This member access is ambiguous. Please use parentheses around the object creation, e.g. '(new SomeType(args)).MemberName' 이 구성원 액세스가 모호합니다. 개체 생성 주위에 괄호를 사용하세요. 예: '(새로운 SomeType(인수)).MemberName' diff --git a/src/Compiler/xlf/FSComp.txt.pl.xlf b/src/Compiler/xlf/FSComp.txt.pl.xlf index d8e54061d52..c137d76cc4b 100644 --- a/src/Compiler/xlf/FSComp.txt.pl.xlf +++ b/src/Compiler/xlf/FSComp.txt.pl.xlf @@ -777,6 +777,11 @@ Niekompletne wyrażenie operatora (na przykład a^b) lub wywołanie typu kwalifikowanego (przykład: ^T.Name) + + Missing union case name + Missing union case name + + This member access is ambiguous. Please use parentheses around the object creation, e.g. '(new SomeType(args)).MemberName' Dostęp tego elementu członkowskiego jest niejednoznaczny. W celu utworzenia obiektu użyj nawiasów, na przykład „(nowy SomeType(args)).MemberName” diff --git a/src/Compiler/xlf/FSComp.txt.pt-BR.xlf b/src/Compiler/xlf/FSComp.txt.pt-BR.xlf index 8dbd46eb0ca..09419ca7384 100644 --- a/src/Compiler/xlf/FSComp.txt.pt-BR.xlf +++ b/src/Compiler/xlf/FSComp.txt.pt-BR.xlf @@ -777,6 +777,11 @@ Expressão de operador incompleta (exemplo a^b) ou invocação de tipo qualificado (exemplo: ^T.Name) + + Missing union case name + Missing union case name + + This member access is ambiguous. Please use parentheses around the object creation, e.g. '(new SomeType(args)).MemberName' Este acesso de membro é ambíguo. Use parênteses em torno da criação do objeto, por exemplo, '(new SomeType(args)).MemberName''. diff --git a/src/Compiler/xlf/FSComp.txt.ru.xlf b/src/Compiler/xlf/FSComp.txt.ru.xlf index caabd932363..5a9d0aae1f8 100644 --- a/src/Compiler/xlf/FSComp.txt.ru.xlf +++ b/src/Compiler/xlf/FSComp.txt.ru.xlf @@ -777,6 +777,11 @@ Неполное выражение оператора (например, a^b) или вызов квалифицированного типа (например, ^T.Name) + + Missing union case name + Missing union case name + + This member access is ambiguous. Please use parentheses around the object creation, e.g. '(new SomeType(args)).MemberName' Неоднозначный доступ к этому элементу. Заключите операцию создания объекта в круглые скобки, например (new Объект(аргументы)).Элемент diff --git a/src/Compiler/xlf/FSComp.txt.tr.xlf b/src/Compiler/xlf/FSComp.txt.tr.xlf index db79874f208..b40b29f5438 100644 --- a/src/Compiler/xlf/FSComp.txt.tr.xlf +++ b/src/Compiler/xlf/FSComp.txt.tr.xlf @@ -777,6 +777,11 @@ Eksik işleç ifadesi (örnek a^b) veya tam tür çağrısı (örnek: ^T.Name) + + Missing union case name + Missing union case name + + This member access is ambiguous. Please use parentheses around the object creation, e.g. '(new SomeType(args)).MemberName' Bu üye erişimi belirsiz. Lütfen nesne oluşturma etrafında parantez kullanın, örneğin '(yeni SomeType (args)).MemberName’ diff --git a/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf b/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf index 9dabd940c23..7a660c0c0a8 100644 --- a/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf +++ b/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf @@ -777,6 +777,11 @@ 运算符表达式不完整(示例: a^b)或限定类型调用(示例: ^T.Name) + + Missing union case name + Missing union case name + + This member access is ambiguous. Please use parentheses around the object creation, e.g. '(new SomeType(args)).MemberName' 此成员访问权限不明确。请在对象创建周围使用括号,例如 “(new SomeType(args)).MemberName” diff --git a/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf b/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf index 20a55b8af77..105c38cd0b7 100644 --- a/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf +++ b/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf @@ -777,6 +777,11 @@ 不完整的運算子運算式 (範例 a^b) 或限定類型調用 (範例: ^T.Name) + + Missing union case name + Missing union case name + + This member access is ambiguous. Please use parentheses around the object creation, e.g. '(new SomeType(args)).MemberName' 此成員存取不明確。請在物件建立前後加上括弧,例如「(new SomeType(args)).MemberName」 diff --git a/tests/service/SyntaxTreeTests.fs b/tests/service/SyntaxTreeTests.fs index 2650ad1720e..d1b5c529210 100644 --- a/tests/service/SyntaxTreeTests.fs +++ b/tests/service/SyntaxTreeTests.fs @@ -185,7 +185,7 @@ let ParseFile fileName = let testUpdateBSLEnv = System.Environment.GetEnvironmentVariable("TEST_UPDATE_BSL") - if not (isNull testUpdateBSLEnv) && testUpdateBSLEnv.Trim() = "1" then + if true then File.WriteAllText(bslPath, actual) Assert.AreEqual(expected, actual) From 381c1943dd1618a0338a23df8b6eafb52d9597ae Mon Sep 17 00:00:00 2001 From: Eugene Auduchinok Date: Wed, 12 Apr 2023 17:07:13 +0200 Subject: [PATCH 5/8] Undo change --- tests/service/SyntaxTreeTests.fs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/service/SyntaxTreeTests.fs b/tests/service/SyntaxTreeTests.fs index d1b5c529210..2650ad1720e 100644 --- a/tests/service/SyntaxTreeTests.fs +++ b/tests/service/SyntaxTreeTests.fs @@ -185,7 +185,7 @@ let ParseFile fileName = let testUpdateBSLEnv = System.Environment.GetEnvironmentVariable("TEST_UPDATE_BSL") - if true then + if not (isNull testUpdateBSLEnv) && testUpdateBSLEnv.Trim() = "1" then File.WriteAllText(bslPath, actual) Assert.AreEqual(expected, actual) From 0f0b1e55ebd9501fb095c277897067bff9be2ecf Mon Sep 17 00:00:00 2001 From: Eugene Auduchinok Date: Wed, 12 Apr 2023 17:49:39 +0200 Subject: [PATCH 6/8] Update baselines --- .../fsharpqa/Source/Diagnostics/NONTERM/attrUnionCaseDecl01.fs | 2 +- .../fsharpqa/Source/Diagnostics/NONTERM/attrUnionCaseDecl01b.fs | 2 +- .../Source/InteractiveSession/Misc/E_type_id_equal_pipe.fsx | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/fsharpqa/Source/Diagnostics/NONTERM/attrUnionCaseDecl01.fs b/tests/fsharpqa/Source/Diagnostics/NONTERM/attrUnionCaseDecl01.fs index fc7db92f79d..9f4fe2ffb47 100644 --- a/tests/fsharpqa/Source/Diagnostics/NONTERM/attrUnionCaseDecl01.fs +++ b/tests/fsharpqa/Source/Diagnostics/NONTERM/attrUnionCaseDecl01.fs @@ -1,6 +1,6 @@ // #Regression #Diagnostics // Regression test for FSharp1.0:3702 -//Incomplete structured construct at or before this point in union case\. Expected identifier, '\(', '\(\*\)' or other token\.$ +//Incomplete structured construct at or before this point in union case #light type Stuff = | AnonymousVariableType of string diff --git a/tests/fsharpqa/Source/Diagnostics/NONTERM/attrUnionCaseDecl01b.fs b/tests/fsharpqa/Source/Diagnostics/NONTERM/attrUnionCaseDecl01b.fs index 900a961bd2c..f178da2622c 100644 --- a/tests/fsharpqa/Source/Diagnostics/NONTERM/attrUnionCaseDecl01b.fs +++ b/tests/fsharpqa/Source/Diagnostics/NONTERM/attrUnionCaseDecl01b.fs @@ -1,7 +1,7 @@ // #Regression #Diagnostics // Regression test for FSharp1.0:3702 //NONTERM -//Incomplete structured construct at or before this point in union case\. Expected identifier, '\(', '\(\*\)' or other token\.$ +//Incomplete structured construct at or before this point in union case diff --git a/tests/fsharpqa/Source/InteractiveSession/Misc/E_type_id_equal_pipe.fsx b/tests/fsharpqa/Source/InteractiveSession/Misc/E_type_id_equal_pipe.fsx index 6e4d7bd0401..643ae7f6ed7 100644 --- a/tests/fsharpqa/Source/InteractiveSession/Misc/E_type_id_equal_pipe.fsx +++ b/tests/fsharpqa/Source/InteractiveSession/Misc/E_type_id_equal_pipe.fsx @@ -1,5 +1,5 @@ // #Regression #NoMT #FSI // Regression test for FSHARP1.0:5629 -//Incomplete structured construct at or before this point in union case\. Expected identifier, '\(', '\(\*\)' or other token\.$ +//Incomplete structured construct at or before this point in union case type R = | ;; exit 1;; From 50e4710dc2d421edd6a5ad5f66522d60da9d6820 Mon Sep 17 00:00:00 2001 From: Eugene Auduchinok Date: Thu, 13 Apr 2023 11:28:07 +0200 Subject: [PATCH 7/8] Fix error range, add missing error production --- src/Compiler/pars.fsy | 18 +++++++++++++++--- .../UnionCase/Missing name 03.fs.bsl | 2 +- .../UnionCase/Missing name 04.fs.bsl | 2 +- .../UnionCase/Missing name 05.fs.bsl | 2 +- .../UnionCase/Missing name 06.fs.bsl | 3 ++- .../UnionCase/Missing name 07.fs.bsl | 3 ++- 6 files changed, 22 insertions(+), 8 deletions(-) diff --git a/src/Compiler/pars.fsy b/src/Compiler/pars.fsy index 1aa53da0afb..c23ad61fb8e 100644 --- a/src/Compiler/pars.fsy +++ b/src/Compiler/pars.fsy @@ -2407,13 +2407,25 @@ attrUnionCaseDecl: { if Option.isSome $2 then errorR(Error(FSComp.SR.parsUnionCasesCannotHaveVisibilityDeclarations(), rhs parseState 2)) let mOf = rhs parseState 3 let mId = mOf.StartRange - errorR (Error(FSComp.SR.parsMissingUnionCaseName(), mId)) + errorR (Error(FSComp.SR.parsMissingUnionCaseName(), mOf)) let mDecl = rhs2 parseState 1 4 (fun (xmlDoc, mBar) -> let id = SynIdent(mkSynId mId "", None) let trivia: SynUnionCaseTrivia = { BarRange = Some mBar } let mDecl = unionRangeWithXmlDoc xmlDoc mDecl - Choice2Of2 (SynUnionCase ( $1, id, SynUnionCaseKind.Fields $4, xmlDoc, None, mDecl, trivia))) } + Choice2Of2(SynUnionCase($1, id, SynUnionCaseKind.Fields $4, xmlDoc, None, mDecl, trivia))) } + + | opt_attributes opt_access OF recover + { if Option.isSome $2 then errorR(Error(FSComp.SR.parsUnionCasesCannotHaveVisibilityDeclarations(), rhs parseState 2)) + let mOf = rhs parseState 3 + let mId = mOf.StartRange + errorR (Error(FSComp.SR.parsMissingUnionCaseName(), mOf)) + let mDecl = rhs2 parseState 1 3 + (fun (xmlDoc, mBar) -> + let id = SynIdent(mkSynId mId "", None) + let trivia: SynUnionCaseTrivia = { BarRange = Some mBar } + let mDecl = unionRangeWithXmlDoc xmlDoc mDecl + Choice2Of2(SynUnionCase($1, id, SynUnionCaseKind.Fields [], xmlDoc, None, mDecl, trivia))) } | opt_attributes opt_access unionCaseName OF recover { if Option.isSome $2 then errorR(Error(FSComp.SR.parsUnionCasesCannotHaveVisibilityDeclarations(), rhs parseState 2)) @@ -2489,7 +2501,7 @@ firstUnionCaseDecl: | OF unionCaseRepr { let mOf = rhs parseState 1 let mId = mOf.StartRange - errorR (Error(FSComp.SR.parsMissingUnionCaseName(), mId)) + errorR (Error(FSComp.SR.parsMissingUnionCaseName(), mOf)) let id = SynIdent(mkSynId mId "", None) let trivia: SynUnionCaseTrivia = { BarRange = None } let xmlDoc = grabXmlDoc (parseState, [], 1) diff --git a/tests/service/data/SyntaxTree/UnionCase/Missing name 03.fs.bsl b/tests/service/data/SyntaxTree/UnionCase/Missing name 03.fs.bsl index 0f7d8d1f622..f8f3055038c 100644 --- a/tests/service/data/SyntaxTree/UnionCase/Missing name 03.fs.bsl +++ b/tests/service/data/SyntaxTree/UnionCase/Missing name 03.fs.bsl @@ -46,4 +46,4 @@ ImplFile { ConditionalDirectives = [] CodeComments = [] }, set [])) -(4,4)-(4,4) parse error Missing union case name +(4,4)-(4,6) parse error Missing union case name diff --git a/tests/service/data/SyntaxTree/UnionCase/Missing name 04.fs.bsl b/tests/service/data/SyntaxTree/UnionCase/Missing name 04.fs.bsl index 7e7e8b51851..3d1dfee767b 100644 --- a/tests/service/data/SyntaxTree/UnionCase/Missing name 04.fs.bsl +++ b/tests/service/data/SyntaxTree/UnionCase/Missing name 04.fs.bsl @@ -41,4 +41,4 @@ ImplFile { ConditionalDirectives = [] CodeComments = [] }, set [])) -(5,6)-(5,6) parse error Missing union case name +(5,6)-(5,8) parse error Missing union case name diff --git a/tests/service/data/SyntaxTree/UnionCase/Missing name 05.fs.bsl b/tests/service/data/SyntaxTree/UnionCase/Missing name 05.fs.bsl index 1474285fac9..a9b9069f2bf 100644 --- a/tests/service/data/SyntaxTree/UnionCase/Missing name 05.fs.bsl +++ b/tests/service/data/SyntaxTree/UnionCase/Missing name 05.fs.bsl @@ -42,4 +42,4 @@ ImplFile CodeComments = [] }, set [])) (5,6)-(5,14) parse error Accessibility modifiers are not permitted on union cases. Use 'type U = internal ...' or 'type U = private ...' to give an accessibility to the whole representation. -(5,15)-(5,15) parse error Missing union case name +(5,15)-(5,17) parse error Missing union case name diff --git a/tests/service/data/SyntaxTree/UnionCase/Missing name 06.fs.bsl b/tests/service/data/SyntaxTree/UnionCase/Missing name 06.fs.bsl index 521291cca79..41a4bf12268 100644 --- a/tests/service/data/SyntaxTree/UnionCase/Missing name 06.fs.bsl +++ b/tests/service/data/SyntaxTree/UnionCase/Missing name 06.fs.bsl @@ -20,7 +20,7 @@ ImplFile SynUnionCase ([], SynIdent (, None), Fields [], PreXmlDoc ((5,4), FSharp.Compiler.Xml.XmlDocCollector), - None, (5,4--5,5), { BarRange = Some (5,4--5,5) }); + None, (5,6--5,17), { BarRange = Some (5,4--5,5) }); SynUnionCase ([], SynIdent (C, None), Fields [], PreXmlDoc ((6,4), FSharp.Compiler.Xml.XmlDocCollector), @@ -36,3 +36,4 @@ ImplFile (6,4)-(6,5) parse error Unexpected symbol '|' in union case (5,6)-(5,14) parse error Accessibility modifiers are not permitted on union cases. Use 'type U = internal ...' or 'type U = private ...' to give an accessibility to the whole representation. +(5,15)-(5,17) parse error Missing union case name diff --git a/tests/service/data/SyntaxTree/UnionCase/Missing name 07.fs.bsl b/tests/service/data/SyntaxTree/UnionCase/Missing name 07.fs.bsl index d0ab98173d2..c4d3efa237f 100644 --- a/tests/service/data/SyntaxTree/UnionCase/Missing name 07.fs.bsl +++ b/tests/service/data/SyntaxTree/UnionCase/Missing name 07.fs.bsl @@ -20,7 +20,7 @@ ImplFile SynUnionCase ([], SynIdent (, None), Fields [], PreXmlDoc ((5,4), FSharp.Compiler.Xml.XmlDocCollector), - None, (5,4--5,5), { BarRange = Some (5,4--5,5) }); + None, (5,6--5,8), { BarRange = Some (5,4--5,5) }); SynUnionCase ([], SynIdent (C, None), Fields [], PreXmlDoc ((6,4), FSharp.Compiler.Xml.XmlDocCollector), @@ -39,3 +39,4 @@ ImplFile CodeComments = [] }, set [])) (6,4)-(6,5) parse error Unexpected symbol '|' in union case +(5,6)-(5,8) parse error Missing union case name From a0553a5bf16dede5f71772123b2fe4df9f387b30 Mon Sep 17 00:00:00 2001 From: Eugene Auduchinok Date: Thu, 13 Apr 2023 11:57:26 +0200 Subject: [PATCH 8/8] Update baselines --- .../TypeAbbreviations/TypeAbbreviations.fs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicTypeAndModuleDefinitions/TypeAbbreviations/TypeAbbreviations.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicTypeAndModuleDefinitions/TypeAbbreviations/TypeAbbreviations.fs index 10678e2757f..24226316fcc 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicTypeAndModuleDefinitions/TypeAbbreviations/TypeAbbreviations.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicTypeAndModuleDefinitions/TypeAbbreviations/TypeAbbreviations.fs @@ -138,7 +138,7 @@ module TypeAbbreviations = |> verifyCompile |> shouldFail |> withDiagnostics [ - (Error 3564, Line 6, Col 16, Line 6, Col 16, "Missing union case name") + (Error 3564, Line 6, Col 16, Line 6, Col 18, "Missing union case name") ] //SOURCE=E_IncorrectRightSide_Quotation.fsx SCFLAGS="--test:ErrorRanges" # E_IncorrectRightSide_Quotation.fsx