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

Support writing & instead of with in types under -Xsource:3 #9594

Merged
merged 1 commit into from Apr 27, 2021

Conversation

smarter
Copy link
Member

@smarter smarter commented 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 #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.

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.
@scala-jenkins scala-jenkins added this to the 2.13.6 milestone Apr 25, 2021
@SethTisue SethTisue added the release-notes worth highlighting in next release notes label Apr 26, 2021
@smarter
Copy link
Member Author

smarter commented Apr 26, 2021

(this is the last -Xsource:3 PR I plan to make, or at least I can't think of anything else to port at the moment :))

Copy link
Member

@lrytz lrytz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is the last -Xsource:3 PR I plan to make

Too bad, I was going to say keep them coming :-) Thanks a lot.

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
4 participants