Skip to content

Conversation

@bracevac
Copy link
Contributor

@bracevac bracevac commented Feb 6, 2025

Fix #22147

Supersedes #22503

Co-authored-by: Jan-Pieter van den Heuvel [email protected]
Co-authored-by: Willem W Bakker [email protected]

@bracevac
Copy link
Contributor Author

bracevac commented Feb 6, 2025

@odersky I further improved the detection logic in canForward to use the self type of cls. That allows us to rule out additional export cycles through mixins (see neg/exports3.scala) (cc: @EugeneFlesselle).

What I'm not sure about: The only difference is that now there is one more cyclicity error occurring in your tests/neg/i20245 test. If this is OK to you, then I'd prefer we merge this version.

@bracevac bracevac requested a review from odersky February 6, 2025 17:44
A member that is visible through inheritance or mixin
should not be eligible for `export`.

We perform the `derivesFrom` check in `canForward`
now on the self-type of the exporting class to detect
such cycles through mixins.

Co-authored-by: Jan-Pieter van den Heuvel <[email protected]>
Co-authored-by: Willem W Bakker <[email protected]>
Co-authored-by: odersky <[email protected]>
@odersky odersky merged commit b995bdc into scala:main Feb 12, 2025
29 checks passed
@odersky odersky deleted the i22147-alt2 branch February 12, 2025 15:02
@WojciechMazur WojciechMazur added this to the 3.7.0 milestone Mar 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Exporting this.xxx in this compiles without warning

3 participants