Skip to content

Introduce Transparent flag #10458

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

Merged
merged 8 commits into from
Nov 24, 2020
Merged

Introduce Transparent flag #10458

merged 8 commits into from
Nov 24, 2020

Conversation

odersky
Copy link
Contributor

@odersky odersky commented Nov 23, 2020

Let the transparent modifier translate to it. Allow transparent on traits and
inline methods only.

Fixes #10457

Also, introduce infix as a modifier backed by a flag.

Remove the @mixin and @infix annotations.

@odersky odersky marked this pull request as ready for review November 23, 2020 20:45
@odersky odersky force-pushed the change-mixin branch 2 times, most recently from 16d031b to 6d5b5cd Compare November 24, 2020 10:45
Let the `transparent` modifier translate to it. allow `transparent` on traits and
inline methods only.
For the moment, keep it in src-non-bootstrapped
Replace with @transparentTrait for now; that way we need not distinguish
between bootstrapped and non-bootstrapped code.
Make infix a flag instead of an annotation.
* are not inferred when combined with other types in an intersection.
* See reference/other-new-features/transparent-traits.html for details.
*/
final class transparentTrait extends StaticAnnotation
Copy link
Contributor

Choose a reason for hiding this comment

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

What are the use cases for this feature?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Essentially cross-compilation. stdLib213 already contains 9 traits that are annotated with @transparentTrait. Right now, we treat them also specially in a "assume transparent" set. But once we can backport the code into the standard library, we can drop that special treatment.

Copy link
Contributor

Choose a reason for hiding this comment

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

The issue seems to be that we won't be able to drop the annotation itself. I'm not sure if that is a good idea.

@@ -196,22 +194,22 @@ package object ops {
* val b: false ^ true = true
* ```
*/
@infix type ^[X <: Boolean, Y <: Boolean] <: Boolean
type ^[X <: Boolean, Y <: Boolean] <: Boolean
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are these not infix?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

They don't need to be since they are symbolic anyway.

Copy link
Contributor

@nicolasstucki nicolasstucki left a comment

Choose a reason for hiding this comment

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

The code LGTM. There is still a question about the annotation.

@odersky odersky merged commit e13089f into scala:master Nov 24, 2020
@odersky odersky deleted the change-mixin branch November 24, 2020 16:51
@nicolasstucki nicolasstucki added the release-notes Should be mentioned in the release notes label Dec 2, 2020
@Kordyjan Kordyjan added this to the 3.0.0 milestone Aug 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-notes Should be mentioned in the release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Transparent flag in compiler and TASTy
3 participants