-
Notifications
You must be signed in to change notification settings - Fork 833
Open
Labels
Area-Diagnosticsmistakes and possible improvements to diagnosticsmistakes and possible improvements to diagnosticsFeature Improvement
Milestone
Description
When giving alias via as, the first element of a tuple can be matched without wrapping it between parens, while the same doesn't work for any other items in the tuple.
let foo a b =
match a, b with
| Some _ as aa, None -> aa, None
| None, Some _ as bb -> None, bb // doesn't compileThis expression was expected to have type ''a option' but here has type ''b option * 'c option'
if I wrap the second tuple element in the match in parens, it compiles:
let foo a b =
match a, b with
| Some _ as aa, None -> aa, None
| None, (Some _ as bb) -> None, bbThis seems to be inconsistent behaviour, failing principle of least surprise, and leading to confusing error message.
Is it according to spec or some issue that needs to be fixed? Should the parens be mandatory or optional in that case?
Reproduces in VS2015 and VS2017.
Metadata
Metadata
Assignees
Labels
Area-Diagnosticsmistakes and possible improvements to diagnosticsmistakes and possible improvements to diagnosticsFeature Improvement
Type
Projects
Status
New