-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Fix #10050: Use lowercase pattern variable syntax for quoted patterns #10125
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
1089a03
to
a65bdc8
Compare
Would the following be possible? case '{ $x: Map[t, t] } => '{ val y: t = .. .} // t form within the quotes Semantically this makes sense I think: we accept a type in all these positions, it's just that it has to be the same one. Normal pattern syntax does not currently allow referring to the same pattern variable multiple times in a pattern, but I recall @LPTK had some ideas on how this could be useful (e.g., when using alternatives). |
@smarter in theory it is possible. It is the next step that I want to try. The change needed to support this is unrelated to the change in syntax and I would add it in another PR. |
It would be great if the change made to allow repeating type pattern variables would be extended to all patterns, not just quoted patterns. As for supporting term pattern variables in pattern alternatives, that's a whole other beast! |
6a4f5fa
to
daaa2d1
Compare
daaa2d1
to
72f47be
Compare
In quoted pattern * Identify names lowered case names as type holes * `case '{ $x: t }`: `t` is type from within the expression * `case '{ $x: T }`/```case '{ $x: `t`}```: `T`/`t` type from outside the pattern * Old `$` prefixed syntax emits an error describing to new syntax
72f47be
to
4b1beda
Compare
Rebased and resolved conflicts |
Use lower cases for quoted type patterns
Based on #10050 (comment)