-
Notifications
You must be signed in to change notification settings - Fork 1.1k
-Wunused:all
reports setter instead of unset variable
in anon class
#23200
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
Comments
The strange carets say that the unused member is
Not sure why it gets a no-op setter, but "using" it, of course, silences the warning. Moreover, the warning "should" say that the var is not set. Adding
For comparison
warns
As a footnote, scastie is on |
-Wunused:all
reports false positive when var
is used in nested trait-Wunused:all
reports spurious setter instead of unset variable
in anon class
It's not only about the setter. If you reassign the variable inside In fact, this is a minimized version of some code in the project I'm working on, where we do mutate that variable, and we use 3.7.0, not 3.7.0-RC1 |
-Wunused:all
reports spurious setter instead of unset variable
in anon class-Wunused:all
reports setter instead of unset variable
in anon class
@mberndt123 the setter is also not used from inside Bar. To answer my other question, the setter is expanded later. My fix tweaks the conditions for warning so it reports "unset var" (when that is true). |
Uh oh!
There was an error while loading. Please reload this page.
Compiler version
3.7.0
Minimized code
The compiler issues an "unused private member" warning for
var x
in line 5, even though it is used in line 7.Scastie
The text was updated successfully, but these errors were encountered: