-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
No warning given when self-assigment occurs #57144
Comments
This comment was originally written by [email protected] A setter might have side-effects. For example, if you do this in JavaScript: window.location = window.location; It will reload the page. Or if you do something like Well, generally speaking, this is bad style, but it isn't necessarily a no-op. |
We can certainly add a hint for cases where no getter or setter is being invoked, which is probably the most common occurrence of the problem. Added this to the Later milestone. |
This comment was originally written by [email protected] Ok, didn't consider side effects of setters. Thanks for the feedback. |
Added Analyzer-Hint label. |
Removed this from the Later milestone. |
Removed Oldschool-Milestone-Later label. |
I think the linter might already have a self-assignment lint? Maybe just for getters/setters? |
This issue was originally filed by [email protected]
What steps will reproduce the problem?
What is the expected output? What do you see instead?
I expect to get at least a warning because the code has no effect.
The code that should have been written would be "this.a = a;"
What version of the product are you using? On what operating system?
Dart Editor version 1.0.0_r30187 (DEV)
Dart SDK version 1.0.0.3_r30187
java version "1.7.0_45"
Linux 3.2.0-56-generic #86-Ubuntu SMP x86_64 GNU/Linux
Please provide any additional information below.
The text was updated successfully, but these errors were encountered: