Skip to content
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

Unused imports does not detect unused import as part of a repeated alias #38784

Closed
dballesteros7 opened this issue Oct 9, 2019 · 1 comment
Closed
Assignees
Labels
analyzer-warning Issues with the analyzer's Warning codes area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion.

Comments

@dballesteros7
Copy link

Suppose you have:

import 'package:foo' as foo;
import 'package:foo_extension' as foo;

And later down the road someone removes all uses of the symbols imported from foo_extension from the library.

The analyzer will not report the foo_extension import as unused as long as foo itself is used even if it's just for the symbols in package:foo.

I'd expect that the check goes one level deeper with aliased imports and verifies that indeed something from the import is being used through the alias.

@vsmenon vsmenon added the area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. label Oct 9, 2019
@srawlins srawlins added the analyzer-warning Issues with the analyzer's Warning codes label May 7, 2020
kevmoo pushed a commit to angulardart/angular that referenced this issue May 12, 2020
Due to a bug in analyzer [1], some unused imports are not reported when multiple import directives share a prefix name, and one or more are unused.

[1] dart-lang/sdk#38784

Tested:
    TAP --sample ran all affected tests and none failed
    http://test/OCL:311045485:BASE:311043423:1589263041592:fdee3e8b
PiperOrigin-RevId: 311153297
dart-bot pushed a commit that referenced this issue May 12, 2020
These were previously undetected due to #38784

Change-Id: I546f698d992142f5e1d1260fba1cfd4a5308a0d0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/147701
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
srawlins added a commit to srawlins/devtools that referenced this issue Jun 10, 2020
Due to a bug in analyzer [1], some unused imports are not reported when
multiple import directives share a prefix name, and one or more are unused.

[1] dart-lang/sdk#38784
srawlins added a commit to srawlins/flutter that referenced this issue Jun 10, 2020
Due to a bug in analyzer [1], some unused imports are not reported when
multiple import directives share a prefix name, and one or more are unused.

[1] dart-lang/sdk#38784
devoncarew pushed a commit to flutter/devtools that referenced this issue Jun 11, 2020
)

Due to a bug in analyzer [1], some unused imports are not reported when
multiple import directives share a prefix name, and one or more are unused.

[1] dart-lang/sdk#38784
@srawlins srawlins self-assigned this Jun 11, 2020
HansMuller pushed a commit to flutter/flutter that referenced this issue Jun 19, 2020
…9160)

Due to a bug in analyzer [1], some unused imports are not reported when
multiple import directives share a prefix name, and one or more are unused.

[1] dart-lang/sdk#38784
zljj0818 pushed a commit to zljj0818/flutter that referenced this issue Jun 22, 2020
…utter#59160)

Due to a bug in analyzer [1], some unused imports are not reported when
multiple import directives share a prefix name, and one or more are unused.

[1] dart-lang/sdk#38784
mingwandroid pushed a commit to mingwandroid/flutter that referenced this issue Sep 6, 2020
…utter#59160)

Due to a bug in analyzer [1], some unused imports are not reported when
multiple import directives share a prefix name, and one or more are unused.

[1] dart-lang/sdk#38784
dart-bot pushed a commit that referenced this issue Sep 22, 2020
Bug: #38784
Change-Id: I2e64f0271ecbcaa7c791403f06e4e963a141b85b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/163662
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
dart-bot pushed a commit that referenced this issue Oct 21, 2020
Bug: #38784
Change-Id: Ib92f3880224243b800689d48cb3c287656a48981
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168741
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
dart-bot pushed a commit that referenced this issue Oct 21, 2020
Bug: #38784
Change-Id: I2c5477bbb36b17ad9ac4cf5e9584dd66f66afe1e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168760
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
srawlins added a commit to srawlins/flutter that referenced this issue Oct 22, 2020
The dart analyzer has a bug in its analysis of "unused imports" which caused
these import directives to not be reported.
dart-lang/sdk#38784. I'm fixing this bug, so we need
to ignore the new "unused_import" reports ahead of time.

The analyzer thinks that these are unused because it does not know about the
"web-only" API hack (see flutter#52899).
dart-bot pushed a commit that referenced this issue Nov 16, 2020
Bug: #38784
Change-Id: Ia1c1b2774ae483d30278dea4ee9d069104f7f1a2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/172301
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
dart-bot pushed a commit that referenced this issue Nov 18, 2020
Bug: #38784
Change-Id: Ifd4df564247c08606841a0e22896d767da438a47
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/172740
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
dart-bot pushed a commit that referenced this issue Nov 18, 2020
Bug: #38784
Change-Id: Ia29967ae40332db2e09d45b620acc7cbda4bbb7c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/172741
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
dart-bot pushed a commit that referenced this issue Nov 19, 2020
The analyzer will start reporting these when
#38784 is fixed.

Change-Id: I5a75b305f52812f07406057b8f0f624e6171ccd7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/172882
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
dart-bot pushed a commit that referenced this issue Nov 19, 2020
The analyzer will start reporting these when
#38784 is fixed.

Change-Id: Id7488449e90104eeac65d64095c1ee5a5bfbb469
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/172902
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
@kevmoo
Copy link
Member

kevmoo commented Nov 19, 2020

@srawlins – you are machine!

dart-bot pushed a commit that referenced this issue Dec 7, 2020
Bug: TODO from #38784
Change-Id: I4ecdaf333c2613eb5fa0c57e4a8f8be56c35bb21
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/175184
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
analyzer-warning Issues with the analyzer's Warning codes area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion.
Projects
None yet
Development

No branches or pull requests

4 participants