Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/release-notes/.FSharp.Compiler.Service/8.0.300.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
* Add switch to generate types and members with IL visibility that accurately represents their F# visibility. ([PR #15484](https://github.com/dotnet/fsharp/pull/15484)
* Allow returning bool instead of unit option for partial active patterns. ([Language suggestion #1041](https://github.com/fsharp/fslang-suggestions/issues/1041), [PR #16473](https://github.com/dotnet/fsharp/pull/16473))
* Symbols: Add GenericArguments to FSharpEntity ([PR #16470](https://github.com/dotnet/fsharp/pull/16470))
* Parser: more 'as' pattern recovery ([PR #16837](https://github.com/dotnet/fsharp/pull/16837))
* Add extended data for `DefinitionsInSigAndImplNotCompatibleAbbreviationsDiffer` (FS0318). ([PR #16811](https://github.com/dotnet/fsharp/pull/16811)))

### Changed
Expand Down
6 changes: 6 additions & 0 deletions src/Compiler/pars.fsy
Original file line number Diff line number Diff line change
Expand Up @@ -3719,6 +3719,12 @@ parenPattern:
let pat2 = SynPat.Wild(mAs.EndRange)
SynPat.As($1, pat2, rhs2 parseState 1 2) }

| parenPattern AS
{ let mAs = rhs parseState 2
let pat2 = SynPat.Wild(mAs.EndRange)
reportParseErrorAt mAs (FSComp.SR.parsExpectingPattern ())
SynPat.As($1, pat2, rhs2 parseState 1 2) }

| parenPattern BAR parenPattern
{ let mBar = rhs parseState 2
SynPat.Or($1, $3, rhs2 parseState 1 3, { BarRange = mBar }) }
Expand Down
2 changes: 1 addition & 1 deletion tests/service/data/SyntaxTree/Pattern/As 02.fs.bsl
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ ImplFile
{ ConditionalDirectives = []
CodeComments = [] }, set []))

(4,7)-(4,9) parse error Unexpected symbol '->' in pattern
(4,4)-(4,6) parse error Expecting pattern
4 changes: 2 additions & 2 deletions tests/service/data/SyntaxTree/Pattern/As 05.fs.bsl
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ ImplFile
{ ConditionalDirectives = []
CodeComments = [] }, set []))

(5,0)-(5,0) parse error Incomplete structured construct at or before this point in pattern
(3,13)-(3,17) parse error Unexpected end of input in 'match' or 'try' expression
(4,4)-(4,6) parse error Expecting pattern
(5,0)-(5,0) parse error Incomplete structured construct at or before this point in pattern matching. Expected '->' or other token.
2 changes: 1 addition & 1 deletion tests/service/data/SyntaxTree/Pattern/As 08.fs.bsl
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ ImplFile
{ ConditionalDirectives = []
CodeComments = [] }, set []))

(5,0)-(5,1) parse error Unexpected symbol '|' in pattern
(4,4)-(4,6) parse error Expecting pattern
2 changes: 1 addition & 1 deletion tests/service/data/SyntaxTree/Pattern/As 10.fs.bsl
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ ImplFile
{ ConditionalDirectives = []
CodeComments = [] }, set []))

(3,10)-(3,11) parse error Unexpected symbol ')' in pattern
(3,7)-(3,9) parse error Expecting pattern
6 changes: 6 additions & 0 deletions tests/service/data/SyntaxTree/Pattern/As 12.fs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module Module

match a with
| :? T as

()
26 changes: 26 additions & 0 deletions tests/service/data/SyntaxTree/Pattern/As 12.fs.bsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
ImplFile
(ParsedImplFileInput
("/root/Pattern/As 12.fs", false, QualifiedNameOfFile Module, [], [],
[SynModuleOrNamespace
([Module], false, NamedModule,
[Expr
(Match
(Yes (3,0--3,12), Ident a,
[SynMatchClause
(As
(IsInst
(LongIdent (SynLongIdent ([T], [], [None])),
(4,2--4,6)), Wild (4,9--4,9), (4,2--4,9)), None,
ArbitraryAfterError ("patternClauses2", (4,9--4,9)),
(4,2--4,9), Yes, { ArrowRange = None
BarRange = Some (4,0--4,1) })],
(3,0--4,9), { MatchKeyword = (3,0--3,5)
WithKeyword = (3,8--3,12) }), (3,0--4,9));
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 = []
CodeComments = [] }, set []))

(4,7)-(4,9) parse error Expecting pattern
(6,0)-(6,1) parse error Incomplete structured construct at or before this point in pattern matching. Expected '->' or other token.