Skip to content

Analyzer: When multiple imports provide the same symbol, one import should be marked as "unused" #24073

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

Closed
jbdeboer opened this issue Aug 13, 2015 · 2 comments
Labels
devexp-warning Issues with the analyzer's Warning codes legacy-area-analyzer Use area-devexp instead. P2 A bug or feature request we're likely to work on type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@jbdeboer
Copy link

e.g. In Angular, the package:angular/angular.dart file exports package:di/di.dart.

In the following file, the Module symbol is coming from di.dart, but also exported through angular.

import package:angular/angular.dart
import package:di/di.dart

class MyModule extends Module { ... }

Currently, the analyzer does not give any hints about unused imports.

However, I would expect angular.dart to be flagged as "unused". angular.dart is not used since Module is also available through di.dart.

@stereotype441 stereotype441 added legacy-area-analyzer Use area-devexp instead. devexp-warning Issues with the analyzer's Warning codes labels Aug 13, 2015
@kevmoo kevmoo added P2 A bug or feature request we're likely to work on type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) and removed Priority-Medium labels Mar 1, 2016
@srawlins
Copy link
Member

Even a subset of this, examining just shown names would be useful. I found some code with:

import 'package:a/a.dart';
import 'package:a/src/foo.dart' show foo;

because at one point, a.dart did not export foo. But now it does, so the second import is unnecessary. Not sure if one is easier to implement or faster to run than the other...

@srawlins
Copy link
Member

I'll close this in favor of the issue I've been referencing when landing changes. #44569

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
devexp-warning Issues with the analyzer's Warning codes legacy-area-analyzer Use area-devexp instead. P2 A bug or feature request we're likely to work on type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

No branches or pull requests

5 participants