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
Support case
in pattern bindings under -Xsource:3
#9558
Conversation
Just like in Scala 3.0, adding this keyword doesn't change anything, but it will be required in future versions of Scala 3 for non-exhaustive patterns in a for comprehension. We would like to start issuing warnings by default in Scala 3 for code which does not use `case` in those situations, but to not hamper cross-compilation we need Scala 2 to also support that keyword. For details, see: https://dotty.epfl.ch/docs/reference/changed-features/pattern-bindings.html
As using the keyword didn't compile before, I'm happy (and eager) to have this unflagged. Does using |
Yes. |
I thought about having it by default, but it seems like something that would require cooperation with scalameta at least. |
If I were to make a PR to get this (and other similar changes) in Scala 2.12, could it get in? |
Yes, but 2.12 doesn't have |
Ping for review. |
In scala#9558 (which shipped with 2.13.6) we added support for `case` bindings under -Xsource:3. Since this parser change does not break any existing code and since IntelliJ and scalameta/metals now understand this syntax in Scala 2 code, it should be safe to enable it by default to further ease cross-compilation between Scala 2 and 3.
In scala#9558 (which shipped with 2.13.6) we added support for `case` bindings under -Xsource:3. Since this parser change does not break any existing code and since IntelliJ and scalameta/metals now understand this syntax in Scala 2 code, it should be safe to enable it by default to further ease cross-compilation between Scala 2 and 3.
In scala#9558 (which shipped with 2.13.6) we added support for `case` bindings under -Xsource:3. Since this parser change does not break any existing code and since IntelliJ and scalameta/metals now understand this syntax in Scala 2 code, it should be safe to enable it by default to further ease cross-compilation between Scala 2 and 3.
In scala#9558 (which shipped with 2.13.6) we added support for `case` bindings under -Xsource:3. Since this parser change does not break any existing code and since IntelliJ and scalameta/metals now understand this syntax in Scala 2 code, it should be safe to enable it by default to further ease cross-compilation between Scala 2 and 3.
Just like in Scala 3.0, adding this keyword doesn't change anything, but
it will be required in future versions of Scala 3 for non-exhaustive
patterns in a for comprehension. We would like to start issuing warnings
by default in Scala 3 for code which does not use
case
in thosesituations, but to not hamper cross-compilation we need Scala 2 to also
support that keyword.
For details, see:
https://dotty.epfl.ch/docs/reference/changed-features/pattern-bindings.html