Skip to content
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

Allow case in pattern bindings even without -Xsource:3 #9721

Merged
merged 1 commit into from Aug 11, 2021

Conversation

smarter
Copy link
Member

@smarter smarter commented Aug 9, 2021

In #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.

@scala-jenkins scala-jenkins added this to the 2.13.7 milestone Aug 9, 2021
@SethTisue
Copy link
Member

needs spec change, IMO

@SethTisue SethTisue added the release-notes worth highlighting in next release notes label Aug 9, 2021
@smarter
Copy link
Member Author

smarter commented Aug 9, 2021

Fair point, I'll edit the spec.

@smarter smarter self-assigned this 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
Copy link
Member Author

smarter commented Aug 10, 2021

Spec updated.

@smarter smarter assigned SethTisue and unassigned smarter Aug 10, 2021
@dwijnand dwijnand merged commit 2149b97 into scala:2.13.x Aug 11, 2021
@smarter
Copy link
Member Author

smarter commented Aug 26, 2021

What do you think of backporting this to 2.12 ?

@lrytz
Copy link
Member

lrytz commented Aug 27, 2021

Sure, I don't see any reason against.

@SethTisue SethTisue changed the title Allow case in pattern bindings even without -Xsource:3 Allow case in pattern bindings even without -Xsource:3 Oct 29, 2021
smarter added a commit to smarter/scala that referenced this pull request Apr 5, 2022
Like scala#9721, the goal here is to ease
cross-compilation between Scala 2 and 3 code as we prepare for `_` as wildcard
to be deprecated in Scala 3 (cf scala/scala3#5379).

This is technically a source-breaking change, but using a type named ? without
backticks is deprecated since 2.13.6 (scala#9626) and defining a type named ? without
backticks is disallowed since 2.13.7 (scala#9735). The only known user of ? as a type
name was the kind-projector plugin, but support for this syntax was removed from
the plugin a year ago (typelevel/kind-projector#186),
so I believe this change won't be disruptive.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-notes worth highlighting in next release notes
Projects
None yet
5 participants