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
* [patterns] Tease apart type testing from refutability.
Some patterns fail to match if the value doesn't have a certain type.
We still allow those patterns in irrefutable contexts if the matched
value is statically known to always have that type (or be dynamic).
Instead of specifying by having the refutability state of those patterns
depend on their type, make refutability a syntactic property and then
define the compile-time error for the types during type checking.
Fix#2450.
* Make variable binders explicit in pattern declarations.
This leads to a cascade of other (hopefully for the better) changes:
- Treat short identifiers as constants in cases.
- Use `if (<expr> case <pat>)` instead of `if (var <pat> = <expr>)`.
- Merge literal and constant patterns into a single construct. Extend it
to support other constant expressions.
There are some other mostly unrelated changes too:
- Don't allow unary patterns to nest.
- Allow subpatterns in cast patterns.
- Only allow assigning to local variables in pattern assignments.
* Revise based on review feedback.
Also consolidate breaking changes into a single section and explain `_`
and other breakage.
0 commit comments