You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is an unresolved thread from #873. Review in conjunction with #1665.
Dealing with “var x” – Part 2
There is an ambiguity in patterns, the input “var x” could be recognised as a declaration_pattern or as a var_pattern. As is this PR only deals with the latter, on line 191 below, and says nothing about the former.
I think the intended semantics are:
In declaration_pattern the type cannot be the identifiervar; i.e. if it starts with var then var_pattern is considered.
A var_pattern is invalid (not considered as a valid parse) if a type called var is in scope.
This is tackled with two suggestions:
One on line 83 covering declaration_pattern (Part 1)
Reword the original statement on line 191
A *var_pattern* cannot be used when a type named `var` is in scope.
Note: I would have moved line 191 to the start of this clause but GitHub will not allow that, that would give:
11.2.4 Var pattern
A var_patternmatches every value. That is, a pattern-matching operation with a var_pattern always succeeds.
A var_pattern is applicable to every type.
A var_pattern cannot be used when a type named var is in scope.
Activity