diff --git a/docs/release-notes/.FSharp.Compiler.Service/11.0.100.md b/docs/release-notes/.FSharp.Compiler.Service/11.0.100.md index ffd9a021cda..c53c9007a64 100644 --- a/docs/release-notes/.FSharp.Compiler.Service/11.0.100.md +++ b/docs/release-notes/.FSharp.Compiler.Service/11.0.100.md @@ -48,6 +48,7 @@ * Fix signature generation: type params with special characters missing backtick escaping. ([Issue #19595](https://github.com/dotnet/fsharp/issues/19595), [PR #19609](https://github.com/dotnet/fsharp/pull/19609)) * Fix internal error when using custom attribute with `[]` value type parameter and no `[]`. ([Issue #8353](https://github.com/dotnet/fsharp/issues/8353), [PR #19484](https://github.com/dotnet/fsharp/pull/19484)) * Fix parallel compilation of scripts ([PR #19649](https://github.com/dotnet/fsharp/pull/19649)) +* Fix parser recovery, name resolution, and code completion for unfinished enum patterns ([PR #19708](https://github.com/dotnet/fsharp/pull/19708)) ### Added diff --git a/src/Compiler/Checking/NameResolution.fs b/src/Compiler/Checking/NameResolution.fs index de5dcff43ad..54290c21bd0 100644 --- a/src/Compiler/Checking/NameResolution.fs +++ b/src/Compiler/Checking/NameResolution.fs @@ -3531,7 +3531,7 @@ let rec ResolvePatternLongIdentPrim sink (ncenv: NameResolver) fullyQualified wa match extraDotAtTheEnd with | ExtraDotAfterIdentifier.Yes -> match LookupTypeNameInEnvNoArity fullyQualified id.idText nenv with - | tcref :: _ when tcref.IsUnionTycon -> + | tcref :: _ when tcref.IsUnionTycon || tcref.IsEnumTycon -> let res = ResolutionInfo.Empty.AddEntity (id.idRange, tcref) ResolutionInfo.SendEntityPathToSink (sink, ncenv, nenv, ItemOccurrence.Pattern, ad, res, ResultTyparChecker(fun () -> true)) Item.Types (id.idText, [ mkWoNullAppTy tcref [] ]) diff --git a/src/Compiler/Service/FSharpCheckerResults.fs b/src/Compiler/Service/FSharpCheckerResults.fs index 59d5773558c..6e9c1ced079 100644 --- a/src/Compiler/Service/FSharpCheckerResults.fs +++ b/src/Compiler/Service/FSharpCheckerResults.fs @@ -904,6 +904,7 @@ type internal TypeCheckInfo /// Is the item suitable for completion in a pattern let IsPatternCandidate (item: CompletionItem) = match item.Item with + | Item.RecdField f -> f.Tycon.IsEnumTycon | Item.Value v -> v.LiteralValue.IsSome | Item.ILField field -> field.LiteralValue.IsSome | Item.ActivePatternCase _ diff --git a/src/Compiler/pars.fsy b/src/Compiler/pars.fsy index 3d9967a5724..1cb9c5c06a7 100644 --- a/src/Compiler/pars.fsy +++ b/src/Compiler/pars.fsy @@ -241,6 +241,7 @@ let parse_error_rich = Some(fun (ctxt: ParseErrorContext<_>) -> /* start with lowest */ +%nonassoc prec_atompat_pathop_error %nonassoc prec_args_error /* less than RPAREN */ %nonassoc prec_atomexpr_lparen_error /* less than RPAREN */ @@ -6929,6 +6930,11 @@ pathOp: { let ident, trivia = $1 SynLongIdent([ident], [], [Some trivia]) } + | ident DOT %prec prec_atompat_pathop_error + { let mDot = rhs parseState 2 + reportParseErrorAt mDot.EndRange (FSComp.SR.parsIdentifierExpected()) + SynLongIdent([$1], [mDot], [None]) } + | ident DOT pathOp { prependIdentInLongIdentWithTrivia (SynIdent($1, None)) (rhs parseState 2) $3 } diff --git a/tests/FSharp.Compiler.Service.Tests/CompletionTests.fs b/tests/FSharp.Compiler.Service.Tests/CompletionTests.fs index e229a6f2b34..cdcbf7a0b8e 100644 --- a/tests/FSharp.Compiler.Service.Tests/CompletionTests.fs +++ b/tests/FSharp.Compiler.Service.Tests/CompletionTests.fs @@ -369,6 +369,45 @@ module Module = """ assertHasNoItemsWithNames ["E"] info +[] +let ``Pattern - Enum 01`` () = + let info = + Checker.getCompletionInfo """ +namespace Ns1 +type E = + | A = 1 + | B = 2 + +namespace Ns2 + +open Ns1 + +module M = + match E.A with + | E.{caret} +""" + assertHasItemWithNames ["A"] info + +[] +let ``Pattern - Enum 02`` () = + let info = + Checker.getCompletionInfo """ +namespace Ns1 +type E = + | A = 1 + | B = 2 + +namespace Ns2 + +open Ns1 + +module M = + match E.A with + | E.{caret} + | E.B -> () +""" + assertHasItemWithNames ["A"] info + #if NETCOREAPP [] let ``Span appears in completion and is not marked obsolete`` () = diff --git a/tests/FSharp.Compiler.Service.Tests/SyntaxTreeTests.fs b/tests/FSharp.Compiler.Service.Tests/SyntaxTreeTests.fs index f6ec40d76a3..6e532f2b46b 100644 --- a/tests/FSharp.Compiler.Service.Tests/SyntaxTreeTests.fs +++ b/tests/FSharp.Compiler.Service.Tests/SyntaxTreeTests.fs @@ -124,6 +124,7 @@ let private sanitizeAST (sourceDirectoryValue: string) (ast: ParsedInput) : Pars let parseSourceCode (name: string, code: string) = let location = Path.Combine(RootDirectory, name).Replace("\\", "/") + Range.setTestSource location code let parseResults = checker.ParseFile( @@ -188,7 +189,10 @@ let ParseFile fileName = let equals = expected = actual let testUpdateBSLEnv = System.Environment.GetEnvironmentVariable("TEST_UPDATE_BSL") - if not (isNull testUpdateBSLEnv) && testUpdateBSLEnv.Trim() = "1" && not equals then + let shouldUpdateBaseline = + (not (isNull testUpdateBSLEnv) && testUpdateBSLEnv.Trim() = "1" && not equals) + + if shouldUpdateBaseline then File.WriteAllText(bslPath, actual) elif not equals then File.WriteAllText(actualPath, actual) diff --git a/tests/FSharp.Compiler.Service.Tests/TypeChecker/TypeCheckerRecoveryTests.fs b/tests/FSharp.Compiler.Service.Tests/TypeChecker/TypeCheckerRecoveryTests.fs index 3f9d13622e6..a5e9aa44709 100644 --- a/tests/FSharp.Compiler.Service.Tests/TypeChecker/TypeCheckerRecoveryTests.fs +++ b/tests/FSharp.Compiler.Service.Tests/TypeChecker/TypeCheckerRecoveryTests.fs @@ -119,3 +119,76 @@ let o: obj = null if true then o.GetHashCode{caret} """ + +module Patterns = + [] + let ``Enum - Type 01`` () = + assertHasSymbolUsageAtCaret "E" """ +type E = + | A = 1 + +match E.A with +| E{caret}.A -> () +""" + + [] + let ``Enum - Type 02`` () = + assertHasSymbolUsageAtCaret "E" """ +type E = + | A = 1 + +match E.A with +| E{caret} -> () +""" + + [] + let ``Enum - Type 03`` () = + assertHasSymbolUsageAtCaret "E" """ +type E = + | A = 1 + +match E.A with +| E{caret} +""" + + [] + let ``Enum - Type 04`` () = + assertHasSymbolUsageAtCaret "E" """ +type E = + | A = 1 + +match E.A with +| E{caret}. +""" + + [] + let ``Enum - Type 05`` () = + assertHasSymbolUsageAtCaret "E" """ +type E = + | A = 1 + +match E.A with +| E{caret}. -> () +""" + + [] + let ``Enum - Type 06`` () = + assertHasSymbolUsageAtCaret "E" """ +type E = + | A = 1 + +match E.A with +| E{caret}.B +""" + + [] + let ``Enum - Type 07`` () = + assertHasSymbolUsageAtCaret "E" """ +type E = + | A = 1 + +match E.A with +| E{caret}. + +() +""" diff --git a/tests/service/data/SyntaxTree/Expression/Object - Class 13.fs.bsl b/tests/service/data/SyntaxTree/Expression/Object - Class 13.fs.bsl index 8127a275f38..8843a18752d 100644 --- a/tests/service/data/SyntaxTree/Expression/Object - Class 13.fs.bsl +++ b/tests/service/data/SyntaxTree/Expression/Object - Class 13.fs.bsl @@ -58,5 +58,5 @@ ImplFile WarnDirectives = [] CodeComments = [] }, set [])) -(4,18)-(5,5) parse error Incomplete structured construct at or before this point in object expression +(4,17)-(4,17) parse error Identifier expected (4,18)-(5,5) parse error Expecting member body diff --git a/tests/service/data/SyntaxTree/Member/Member 03.fs.bsl b/tests/service/data/SyntaxTree/Member/Member 03.fs.bsl index a7baa985888..23ffda682bf 100644 --- a/tests/service/data/SyntaxTree/Member/Member 03.fs.bsl +++ b/tests/service/data/SyntaxTree/Member/Member 03.fs.bsl @@ -110,5 +110,5 @@ ImplFile WarnDirectives = [] CodeComments = [] }, set [])) -(5,23)-(6,4) parse error Incomplete structured construct at or before this point in member definition +(5,22)-(5,22) parse error Identifier expected (5,23)-(6,4) parse error Expecting member body diff --git a/tests/service/data/SyntaxTree/Member/Member 07.fs.bsl b/tests/service/data/SyntaxTree/Member/Member 07.fs.bsl index c919ab5a29d..f712ac7bf1e 100644 --- a/tests/service/data/SyntaxTree/Member/Member 07.fs.bsl +++ b/tests/service/data/SyntaxTree/Member/Member 07.fs.bsl @@ -109,4 +109,4 @@ ImplFile WarnDirectives = [] CodeComments = [] }, set [])) -(5,23)-(5,24) parse error Unexpected symbol '=' in member definition +(5,22)-(5,22) parse error Identifier expected diff --git a/tests/service/data/SyntaxTree/Pattern/Identifier 01.fs b/tests/service/data/SyntaxTree/Pattern/Identifier 01.fs new file mode 100644 index 00000000000..4454999efcb --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Identifier 01.fs @@ -0,0 +1,4 @@ +module Module + +match e with +| E -> () diff --git a/tests/service/data/SyntaxTree/Pattern/Identifier 01.fs.bsl b/tests/service/data/SyntaxTree/Pattern/Identifier 01.fs.bsl new file mode 100644 index 00000000000..48e7e77c033 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Identifier 01.fs.bsl @@ -0,0 +1,21 @@ +ImplFile + (ParsedImplFileInput + ("/root/Pattern/Identifier 01.fs", false, QualifiedNameOfFile Module, [], + [SynModuleOrNamespace + ([Module], false, NamedModule, + [Expr + (Match + (Yes (3,0--3,12), Ident e, + [SynMatchClause + (LongIdent + (SynLongIdent ([E], [], [None]), None, None, Pats [], + None, (4,2--4,3)), None, Const (Unit, (4,7--4,9)), + (4,2--4,9), Yes, { ArrowRange = Some (4,4--4,6) + BarRange = Some (4,0--4,1) })], + (3,0--4,9), { MatchKeyword = (3,0--3,5) + WithKeyword = (3,8--3,12) }), (3,0--4,9))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--4,9), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + WarnDirectives = [] + CodeComments = [] }, set [])) diff --git a/tests/service/data/SyntaxTree/Pattern/Identifier 02.fs b/tests/service/data/SyntaxTree/Pattern/Identifier 02.fs new file mode 100644 index 00000000000..539641e4fbf --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Identifier 02.fs @@ -0,0 +1,4 @@ +module Module + +match e with +| e -> () diff --git a/tests/service/data/SyntaxTree/Pattern/Identifier 02.fs.bsl b/tests/service/data/SyntaxTree/Pattern/Identifier 02.fs.bsl new file mode 100644 index 00000000000..14c92127a25 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Identifier 02.fs.bsl @@ -0,0 +1,20 @@ +ImplFile + (ParsedImplFileInput + ("/root/Pattern/Identifier 02.fs", false, QualifiedNameOfFile Module, [], + [SynModuleOrNamespace + ([Module], false, NamedModule, + [Expr + (Match + (Yes (3,0--3,12), Ident e, + [SynMatchClause + (Named (SynIdent (e, None), false, None, (4,2--4,3)), None, + Const (Unit, (4,7--4,9)), (4,2--4,9), Yes, + { ArrowRange = Some (4,4--4,6) + BarRange = Some (4,0--4,1) })], (3,0--4,9), + { MatchKeyword = (3,0--3,5) + WithKeyword = (3,8--3,12) }), (3,0--4,9))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--4,9), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + WarnDirectives = [] + CodeComments = [] }, set [])) diff --git a/tests/service/data/SyntaxTree/Pattern/Identifier 03.fs b/tests/service/data/SyntaxTree/Pattern/Identifier 03.fs new file mode 100644 index 00000000000..2904ffb9761 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Identifier 03.fs @@ -0,0 +1,4 @@ +module Module + +match e with +| E \ No newline at end of file diff --git a/tests/service/data/SyntaxTree/Pattern/Identifier 03.fs.bsl b/tests/service/data/SyntaxTree/Pattern/Identifier 03.fs.bsl new file mode 100644 index 00000000000..99fd400d3ae --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Identifier 03.fs.bsl @@ -0,0 +1,24 @@ +ImplFile + (ParsedImplFileInput + ("/root/Pattern/Identifier 03.fs", false, QualifiedNameOfFile Module, [], + [SynModuleOrNamespace + ([Module], false, NamedModule, + [Expr + (Match + (Yes (3,0--3,12), Ident e, + [SynMatchClause + (LongIdent + (SynLongIdent ([E], [], [None]), None, None, Pats [], + None, (4,2--4,3)), None, + ArbitraryAfterError ("patternClauses2", (4,3--4,3)), + (4,2--4,3), Yes, { ArrowRange = None + BarRange = Some (4,0--4,1) })], + (3,0--4,3), { MatchKeyword = (3,0--3,5) + WithKeyword = (3,8--3,12) }), (3,0--4,3))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--4,3), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + WarnDirectives = [] + CodeComments = [] }, set [])) + +(4,0)-(4,3) parse error Incomplete structured construct at or before this point in pattern matching. Expected '->' or other token. diff --git a/tests/service/data/SyntaxTree/Pattern/Identifier 04.fs b/tests/service/data/SyntaxTree/Pattern/Identifier 04.fs new file mode 100644 index 00000000000..e30df92a905 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Identifier 04.fs @@ -0,0 +1,4 @@ +module Module + +match e with +| e \ No newline at end of file diff --git a/tests/service/data/SyntaxTree/Pattern/Identifier 04.fs.bsl b/tests/service/data/SyntaxTree/Pattern/Identifier 04.fs.bsl new file mode 100644 index 00000000000..147a7a460e0 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Identifier 04.fs.bsl @@ -0,0 +1,22 @@ +ImplFile + (ParsedImplFileInput + ("/root/Pattern/Identifier 04.fs", false, QualifiedNameOfFile Module, [], + [SynModuleOrNamespace + ([Module], false, NamedModule, + [Expr + (Match + (Yes (3,0--3,12), Ident e, + [SynMatchClause + (Named (SynIdent (e, None), false, None, (4,2--4,3)), None, + ArbitraryAfterError ("patternClauses2", (4,3--4,3)), + (4,2--4,3), Yes, { ArrowRange = None + BarRange = Some (4,0--4,1) })], + (3,0--4,3), { MatchKeyword = (3,0--3,5) + WithKeyword = (3,8--3,12) }), (3,0--4,3))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--4,3), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + WarnDirectives = [] + CodeComments = [] }, set [])) + +(4,0)-(4,3) parse error Incomplete structured construct at or before this point in pattern matching. Expected '->' or other token. diff --git a/tests/service/data/SyntaxTree/Pattern/Identifier 05.fs b/tests/service/data/SyntaxTree/Pattern/Identifier 05.fs new file mode 100644 index 00000000000..d7083cfb4f1 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Identifier 05.fs @@ -0,0 +1,4 @@ +module Module + +match e with +| E. \ No newline at end of file diff --git a/tests/service/data/SyntaxTree/Pattern/Identifier 05.fs.bsl b/tests/service/data/SyntaxTree/Pattern/Identifier 05.fs.bsl new file mode 100644 index 00000000000..43f88901eb1 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Identifier 05.fs.bsl @@ -0,0 +1,25 @@ +ImplFile + (ParsedImplFileInput + ("/root/Pattern/Identifier 05.fs", false, QualifiedNameOfFile Module, [], + [SynModuleOrNamespace + ([Module], false, NamedModule, + [Expr + (Match + (Yes (3,0--3,12), Ident e, + [SynMatchClause + (LongIdent + (SynLongIdent ([E], [(4,3--4,4)], [None]), None, None, + Pats [], None, (4,2--4,4)), None, + ArbitraryAfterError ("patternClauses2", (4,4--4,4)), + (4,2--4,4), Yes, { ArrowRange = None + BarRange = Some (4,0--4,1) })], + (3,0--4,4), { MatchKeyword = (3,0--3,5) + WithKeyword = (3,8--3,12) }), (3,0--4,4))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--4,4), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + WarnDirectives = [] + CodeComments = [] }, set [])) + +(4,4)-(4,4) parse error Identifier expected +(4,0)-(4,4) parse error Incomplete structured construct at or before this point in pattern matching. Expected '->' or other token. diff --git a/tests/service/data/SyntaxTree/Pattern/Identifier 06.fs b/tests/service/data/SyntaxTree/Pattern/Identifier 06.fs new file mode 100644 index 00000000000..525a07d92ce --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Identifier 06.fs @@ -0,0 +1,6 @@ +module Module + +match e with +| E. + +() diff --git a/tests/service/data/SyntaxTree/Pattern/Identifier 06.fs.bsl b/tests/service/data/SyntaxTree/Pattern/Identifier 06.fs.bsl new file mode 100644 index 00000000000..a2bf28f18f7 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Identifier 06.fs.bsl @@ -0,0 +1,26 @@ +ImplFile + (ParsedImplFileInput + ("/root/Pattern/Identifier 06.fs", false, QualifiedNameOfFile Module, [], + [SynModuleOrNamespace + ([Module], false, NamedModule, + [Expr + (Match + (Yes (3,0--3,12), Ident e, + [SynMatchClause + (LongIdent + (SynLongIdent ([E], [(4,3--4,4)], [None]), None, None, + Pats [], None, (4,2--4,4)), None, + ArbitraryAfterError ("patternClauses2", (4,4--4,4)), + (4,2--4,4), Yes, { ArrowRange = None + BarRange = Some (4,0--4,1) })], + (3,0--4,4), { MatchKeyword = (3,0--3,5) + WithKeyword = (3,8--3,12) }), (3,0--4,4)); + Expr (Const (Unit, (6,0--6,2)), (6,0--6,2))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--6,2), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + WarnDirectives = [] + CodeComments = [] }, set [])) + +(4,4)-(4,4) parse error Identifier expected +(6,0)-(6,1) parse error Incomplete structured construct at or before this point in pattern matching. Expected '->' or other token. diff --git a/tests/service/data/SyntaxTree/Pattern/Identifier 07.fs b/tests/service/data/SyntaxTree/Pattern/Identifier 07.fs new file mode 100644 index 00000000000..e8c72c0cf81 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Identifier 07.fs @@ -0,0 +1,7 @@ +module Module + +do + match e with + | E. + + () diff --git a/tests/service/data/SyntaxTree/Pattern/Identifier 07.fs.bsl b/tests/service/data/SyntaxTree/Pattern/Identifier 07.fs.bsl new file mode 100644 index 00000000000..dd1cc99e100 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Identifier 07.fs.bsl @@ -0,0 +1,30 @@ +ImplFile + (ParsedImplFileInput + ("/root/Pattern/Identifier 07.fs", false, QualifiedNameOfFile Module, [], + [SynModuleOrNamespace + ([Module], false, NamedModule, + [Expr + (Do + (Sequential + (SuppressNeither, true, + Match + (Yes (4,4--4,16), Ident e, + [SynMatchClause + (LongIdent + (SynLongIdent ([E], [(5,7--5,8)], [None]), None, + None, Pats [], None, (5,6--5,8)), None, + ArbitraryAfterError ("patternClauses2", (5,8--5,8)), + (5,6--5,8), Yes, { ArrowRange = None + BarRange = Some (5,4--5,5) })], + (4,4--5,8), { MatchKeyword = (4,4--4,9) + WithKeyword = (4,12--4,16) }), + Const (Unit, (7,4--7,6)), (4,4--7,6), + { SeparatorRange = None }), (3,0--7,6)), (3,0--7,6))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--7,6), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + WarnDirectives = [] + CodeComments = [] }, set [])) + +(5,8)-(5,8) parse error Identifier expected +(7,4)-(7,5) parse error Incomplete structured construct at or before this point in pattern matching. Expected '->' or other token. diff --git a/tests/service/data/SyntaxTree/Pattern/Identifier 08.fs b/tests/service/data/SyntaxTree/Pattern/Identifier 08.fs new file mode 100644 index 00000000000..239d2187202 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Identifier 08.fs @@ -0,0 +1,4 @@ +module Module + +match e with +| E diff --git a/tests/service/data/SyntaxTree/Pattern/Identifier 08.fs.bsl b/tests/service/data/SyntaxTree/Pattern/Identifier 08.fs.bsl new file mode 100644 index 00000000000..c1438e8c350 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Identifier 08.fs.bsl @@ -0,0 +1,24 @@ +ImplFile + (ParsedImplFileInput + ("/root/Pattern/Identifier 08.fs", false, QualifiedNameOfFile Module, [], + [SynModuleOrNamespace + ([Module], false, NamedModule, + [Expr + (Match + (Yes (3,0--3,12), Ident e, + [SynMatchClause + (LongIdent + (SynLongIdent ([E], [], [None]), None, None, Pats [], + None, (4,2--4,3)), None, + ArbitraryAfterError ("patternClauses2", (4,3--4,3)), + (4,2--4,3), Yes, { ArrowRange = None + BarRange = Some (4,0--4,1) })], + (3,0--4,3), { MatchKeyword = (3,0--3,5) + WithKeyword = (3,8--3,12) }), (3,0--4,3))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--4,3), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + WarnDirectives = [] + CodeComments = [] }, set [])) + +(5,0)-(5,0) parse error Incomplete structured construct at or before this point in pattern matching. Expected '->' or other token. diff --git a/tests/service/data/SyntaxTree/Pattern/Identifier 09.fs b/tests/service/data/SyntaxTree/Pattern/Identifier 09.fs new file mode 100644 index 00000000000..b815c2c5a65 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Identifier 09.fs @@ -0,0 +1,4 @@ +module Module + +match e with +| e diff --git a/tests/service/data/SyntaxTree/Pattern/Identifier 09.fs.bsl b/tests/service/data/SyntaxTree/Pattern/Identifier 09.fs.bsl new file mode 100644 index 00000000000..43c125e08ae --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Identifier 09.fs.bsl @@ -0,0 +1,22 @@ +ImplFile + (ParsedImplFileInput + ("/root/Pattern/Identifier 09.fs", false, QualifiedNameOfFile Module, [], + [SynModuleOrNamespace + ([Module], false, NamedModule, + [Expr + (Match + (Yes (3,0--3,12), Ident e, + [SynMatchClause + (Named (SynIdent (e, None), false, None, (4,2--4,3)), None, + ArbitraryAfterError ("patternClauses2", (4,3--4,3)), + (4,2--4,3), Yes, { ArrowRange = None + BarRange = Some (4,0--4,1) })], + (3,0--4,3), { MatchKeyword = (3,0--3,5) + WithKeyword = (3,8--3,12) }), (3,0--4,3))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--4,3), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + WarnDirectives = [] + CodeComments = [] }, set [])) + +(5,0)-(5,0) parse error Incomplete structured construct at or before this point in pattern matching. Expected '->' or other token. diff --git a/tests/service/data/SyntaxTree/Pattern/Identifier 10.fs b/tests/service/data/SyntaxTree/Pattern/Identifier 10.fs new file mode 100644 index 00000000000..ee54d497fd0 --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Identifier 10.fs @@ -0,0 +1,4 @@ +module Module + +match e with +| E. diff --git a/tests/service/data/SyntaxTree/Pattern/Identifier 10.fs.bsl b/tests/service/data/SyntaxTree/Pattern/Identifier 10.fs.bsl new file mode 100644 index 00000000000..3aa3e9dfa5c --- /dev/null +++ b/tests/service/data/SyntaxTree/Pattern/Identifier 10.fs.bsl @@ -0,0 +1,25 @@ +ImplFile + (ParsedImplFileInput + ("/root/Pattern/Identifier 10.fs", false, QualifiedNameOfFile Module, [], + [SynModuleOrNamespace + ([Module], false, NamedModule, + [Expr + (Match + (Yes (3,0--3,12), Ident e, + [SynMatchClause + (LongIdent + (SynLongIdent ([E], [(4,3--4,4)], [None]), None, None, + Pats [], None, (4,2--4,4)), None, + ArbitraryAfterError ("patternClauses2", (4,4--4,4)), + (4,2--4,4), Yes, { ArrowRange = None + BarRange = Some (4,0--4,1) })], + (3,0--4,4), { MatchKeyword = (3,0--3,5) + WithKeyword = (3,8--3,12) }), (3,0--4,4))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--4,4), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + WarnDirectives = [] + CodeComments = [] }, set [])) + +(4,4)-(4,4) parse error Identifier expected +(5,0)-(5,0) parse error Incomplete structured construct at or before this point in pattern matching. Expected '->' or other token.