-
Notifications
You must be signed in to change notification settings - Fork 833
Closed
Description
Is your feature request related to a problem? Please describe.
Given the following F# code:
match list with
| head :: tail -> Some head
| [] -> Noneand relevant AST:
SynMatchClause
(LongIdent
(SynLongIdent
([op_ColonColon], [], [Some (OriginalNotation "::")]),
None, None,
Pats
[Tuple
(false,
[Named
(SynIdent (head, None), false, None,
tmp.fsx (2,6--2,10));
Named
(SynIdent (tail, None), false, None,
tmp.fsx (2,14--2,18))], tmp.fsx (2,6--2,18))],
None, tmp.fsx (2,6--2,18)), None, ...The code doesn't really contain any tuple in this case.
Describe the solution you'd like
I'd be in favour of having a better representation, something similar to SynPat.Or or SynPat.And.
Proposal:
type SynPat =
...
| Cons of lhsPat: SynPat * rhsPat: SynPat * range: range * trivia: SynPatConsTriviaDescribe alternatives you've considered
We currently process the AST and match against "::".
Additional context
related: #11481
//cc @dsyme, @auduchinok
auduchinok