-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
make refutable patterns an error in 3.4 #16665
Conversation
@sjrd so far this requires patching the |
The Scala.js tests have to pass with older 2.12 and 2.13 versions, all the way back to 2.12.2 and 2.13.0. What's the magnitude of this problem? Is it a couple places, or is it everywhere? Can you give examples? |
The failure in the CI points to these files:
in total there are 7 lines affected - all refutable patterns in for comprehension or pattern val bindings |
The ones in In |
|
these community-build projects still need patching to pass
|
cc60664
to
1009b9a
Compare
updated for 3.4 - unsure if the patches are still needed for various community projects |
list of community build projects still failing:
edit: all passing now |
ffa01df
to
48f3f87
Compare
The problematic Scala.js tests will have to remain ignored until base Scala.js version is updated to 1.13.0+ (for a separate PR) |
I'm not completely sure, but I don't this ever went through the SIP process. Since it turns previously valid (and not unsound) code into an error by design, it seems to me that it affects the language spec and therefore needs a SIP. Perhaps alternatively, it could remain a configurable error. Scala 2 has enough configuration options with |
The thing is this isn't just a lint - the code generation with this change no longer calls withFilter. Previously in 3.3 the code calls withFilter even for irrefutable patterns |
So this was part of https://docs.scala-lang.org/scala3/reference/changed-features/pattern-bindings.html, which was in the set of proposals that were accepted by the SIP committee while leading up to Scala 3. So seems fine to me. |
I rebased to fix the conflict, I'll work on only making only the for-comprehension change, in anticipation of the |
close in favor of #18842 |
supersedes #16665 Only make refutable patterns in a for comprehension an error, here we have a clear set in stone solution: put `case` before the pattern. It is still in the air the ideal solution for pattern val definitions, see https://contributors.scala-lang.org/t/pre-sip-replace-non-sensical-unchecked-annotations/6342/85, so keep those as a warning for now
was originally targeting 3.3 - opening this to see which community build projects fail