-
Notifications
You must be signed in to change notification settings - Fork 1.7k
consider a bulk fix for removing unused imports #43886
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
I don't think it's a question of "if"; I think we already have the interaction. Whether users will experience the interaction depends on whether we apply any data-driven fixes in a library with an unused import. I think we would need to have a way to handle this gracefully before we added this support. |
In looking at #43887, I had an idea for a possible solution. We could re-run analysis after applying the fixes and clean up any unused imports only at that point. I believe this would remove the possibility of interactions between other fixes and the unused import fix, but it does carry a performance penalty. If we do at some point decide to iterate until there's nothing left to fix (other than unused_imports) then I think we'd already be incurring the cost, so I think this final cleanup would be fairly inexpensive. We should measure the performance of a second analysis (on multiple sizes of packages) to determine how big the performance impact is likely to be. Then we can decide whether to apply this solution (now or later) and whether it's reasonable to iterate at some point in the future. |
This has now landed. |
@bwilkerson I'm running |
I'm sorry, but I really don't know how to figure out which release a change was first part of. I believe the CL that fixed the problem was https://dart-review.googlesource.com/c/sdk/+/221140, but I don't know whether that change is included in 2.15.1. But if you can put together a small reproduction case I can test it against the tip of tree to see whether there's a bug or whether you need to wait for a later release. |
Thanks @bwilkerson!
The import dart:math is never used so should be clean up but dart fix does not have a fix for it
|
I created a directory named
That suggests to me that the change is not in 2.15.1, but will be in a later release. Unfortunately I don't know which release it will ship in. |
@bwilkerson Thanks for your help! I switched to the Flutter beta branch which has 2.16.0-134.1.beta and it worked as expected, guess it'll ship with the next flutter release. It must be part of this issue listed in the change log #46100 |
You're very welcome. Glad it's working for you on the beta branch. |
It seems like this is a pretty common case and a fix trivial.
There is a potential interaction w/ data-driven fixes. Brian pointed out in chat:
My inclination is to cross that bridge when we get to it?
The text was updated successfully, but these errors were encountered: