Support case in pattern bindings under -Xsource:3#9558
Merged
lrytz merged 1 commit intoscala:2.13.xfrom Apr 20, 2021
Merged
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
Member
|
As using the keyword didn't compile before, I'm happy (and eager) to have this unflagged. Does using |
Member
Author
|
Yes. |
Member
Author
I thought about having it by default, but it seems like something that would require cooperation with scalameta at least. |
Member
Author
|
If I were to make a PR to get this (and other similar changes) in Scala 2.12, could it get in? |
Member
Yes, but 2.12 doesn't have |
Member
Author
|
Ping for review. |
lrytz
approved these changes
Apr 20, 2021
smarter
added a commit
to smarter/scala
that referenced
this pull request
Aug 9, 2021
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.
smarter
added a commit
to smarter/scala
that referenced
this pull request
Aug 10, 2021
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.
smarter
added a commit
to smarter/scala
that referenced
this pull request
Aug 27, 2021
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.
smarter
added a commit
to smarter/scala
that referenced
this pull request
Aug 27, 2021
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
casein 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