Skip to content

[backport] Support writing & instead of with in types under -Xsource:3#9595

Merged
lrytz merged 1 commit intoscala:2.12.xfrom
smarter:backport-and-syntax
Apr 27, 2021
Merged

[backport] Support writing & instead of with in types under -Xsource:3#9595
lrytz merged 1 commit intoscala:2.12.xfrom
smarter:backport-and-syntax

Conversation

@smarter
Copy link
Member

@smarter smarter commented Apr 25, 2021

This backports #9594 (which has not been accepted yet).

@scala-jenkins scala-jenkins added this to the 2.12.14 milestone Apr 25, 2021
Instead of:

    val x: A with B = new A with B {}

One can now write:

    val x: A & B = new A with B {}

However mixing `&` with other infix operators is not allowed, because
unlike Scala 3, we do not take operator precedence into account, cf scala#6147.

This implementation is a bit more restrictive than the Scala 3 one which
allows shadowing the built-in `&` with your own `&` type operator, but
this cannot be done with the simple parser-based approach of this PR.
@smarter smarter force-pushed the backport-and-syntax branch from 4565ff6 to 8679754 Compare April 25, 2021 12:39
@lrytz lrytz merged commit 7e23749 into scala:2.12.x Apr 27, 2021
@SethTisue SethTisue added the release-notes worth highlighting in next release notes label Apr 27, 2021
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.

4 participants