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
The pattern matching construct should be usable as an expression:
return match { … }
let foo = match { … }
() => match { … }
Based on the examples, I assume match () {} is a PrimaryExpression, which, if so, will align to other similar structs introduced in proposals like do-expressions and module blocks.
Being a primary expression means that besides the examples mentioned above, the following codes are also valid, I don't see a strong reason to disallow them.
match(res){when(200){res}}.code// match can start a member chain without parenthesismatch(res){when(200){res}}+1// match can be in BinaryExpression without parenthesis
The readme mentions that
Based on the examples, I assume
match () {}
is a PrimaryExpression, which, if so, will align to other similar structs introduced in proposals like do-expressions and module blocks.Being a primary expression means that besides the examples mentioned above, the following codes are also valid, I don't see a strong reason to disallow them.
We will then need to modify AssignmentTargetType to disallow match in LHS:
The text was updated successfully, but these errors were encountered: