Skip to content

Backport "Warn trivial recursion with module prefix" to 3.3 LTS #454

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 1 commit into from
Jun 20, 2025

Conversation

tgodzik
Copy link

@tgodzik tgodzik commented Jun 20, 2025

Backports scala#23278 to the 3.3.7.

PR submitted by the release tooling.
[skip ci]

Fixes scala#23277 

First, loosen the test for whether to warn for `module.recur()`. The
`this` assignment has a RHS that is not pure (because of module init)
but `isStable` (and not significant with respect to the warning).

Second, avoid emitting such a `this` assignment if the prefix is the
enclosing module. The existing code checks for a prefix that is
`Enclosing.this`.

Other "aliasing" prefixes are not considered, such as a method with
result `this.type`, since they could execute arbitrary intended effects.
[Cherry-picked 451cc74]
Base automatically changed from backport-lts-3.3-23256 to lts-3.3 June 20, 2025 10:49
@tgodzik
Copy link
Author

tgodzik commented Jun 20, 2025

No regressions detected in the community build up to backport-lts-3.3-23359.

Reference

@tgodzik tgodzik merged commit 5fdd554 into lts-3.3 Jun 20, 2025
22 checks passed
@tgodzik tgodzik deleted the backport-lts-3.3-23278 branch June 20, 2025 10:49
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.

2 participants