-
Notifications
You must be signed in to change notification settings - Fork 205
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
Variable redefinition warning #737
Comments
I don't believe that it would be appropriate for it to be part of the language spec (if that's what you meant by "language feature"), but I do think it would be a reasonable lint. |
I believe you are referring to dart-lang/sdk#57537. |
@bwilkerson / @srawlins Thanks for the link to the other discussion. I'm fairly new to Dart (~6 months) and wasn't aware of the separate repo for the linter. Is The above site mentions that The last comment in that issue appears to be from Jan 25, 2018, just coming up on 2 years ago. Should I move the discussion there and close this post? |
I don't think so.
That seems like a good plan to me. I think you're asking for the same functionality that that thread is requesting. |
@bwilkerson Thanks, done! Given the age of the thread I'm not holding my breath. It'd be nice to have though. |
I just refactored some static variables into instance variables, and in the process of some sloppy copy-pasting, forgot to remove the type in front of the variable names when instantiating them.
e.g. (simplified example)
became
The problem obviously being that
String _someString = 'hello';
should be_someString = 'hello';
.This issue compounds if you have a bunch of code you're refactoring, so luckily some assertions elsewhere caught the fact that they were null.
Dart has some cool tooling, and I was thinking it might be helpful to provide a warning in cases like this (perhaps excluding obvious instances like redefinitions of i, j, k, etc).
Should this be a language feature? An analyzer feature? An editor/plugin feature? I was thinking perhaps like the green underline you get when you forget to call super in a method you're overriding.
Thoughts?
The text was updated successfully, but these errors were encountered: