Consider setter of effectively private var#23211
Merged
tgodzik merged 1 commit intoscala:mainfrom Jul 21, 2025
Merged
Conversation
Anonymous classes get a setter for a var member: as usual, don't warn about the setter but only about the var getter. Additionally, check whether the setter is referenced before claiming that the var is unset.
2d4d9e7 to
9f56492
Compare
Contributor
Author
|
For class parameter that is a val/var member, it should "check all that apply" and report whichever is selected by settings. Intuitively (?), people like unused imports (which probably is least relevant to correctness, unless implicits are failing) but unused params, privates, locals have a smaller "sweet spot" where they are just right; yet it's easier to assume |
tgodzik
approved these changes
Jul 21, 2025
Contributor
tgodzik
left a comment
There was a problem hiding this comment.
LGTM I somehow lost this PR and only now thought to look at my assigned PRs, sorry!
tgodzik
pushed a commit
to scala/scala3-lts
that referenced
this pull request
Jul 26, 2025
Anonymous classes get a setter for a var member: as usual, don't warn about the setter but only about the var getter. Additionally, check whether the setter is referenced before claiming that the var is unset. Fixes scala#23200
tgodzik
added a commit
to scala/scala3-lts
that referenced
this pull request
Jul 26, 2025
Anonymous classes get a setter for a var member: as usual, don't warn about the setter but only about the var getter. Additionally, check whether the setter is referenced before claiming that the var is unset. Fixes scala#23200 [Cherry-picked 48e173a][modified]
tgodzik
pushed a commit
to scala/scala3-lts
that referenced
this pull request
Jul 28, 2025
Anonymous classes get a setter for a var member: as usual, don't warn about the setter but only about the var getter. Additionally, check whether the setter is referenced before claiming that the var is unset. Fixes scala#23200
tgodzik
added a commit
to scala/scala3-lts
that referenced
this pull request
Jul 28, 2025
Anonymous classes get a setter for a var member: as usual, don't warn about the setter but only about the var getter. Additionally, check whether the setter is referenced before claiming that the var is unset. Fixes scala#23200 [Cherry-picked 48e173a][modified]
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Anonymous classes get a setter for a var member:
as usual, don't warn about the setter but only about the var getter.
Additionally, check whether the setter is referenced before claiming that the var is unset.
Fixes #23200