Skip to content

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

Merged
dwijnand merged 1 commit intoscala:2.13.xfrom
smarter:case-without-future
Aug 11, 2021
Merged

Allow case in pattern bindings even without -Xsource:3#9721
dwijnand merged 1 commit intoscala:2.13.xfrom
smarter:case-without-future

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
@smarter smarter force-pushed the case-without-future branch from 349d75a to 0cecad3 Compare August 10, 2021 11:15
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

Development

Successfully merging this pull request may close these issues.

5 participants