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

Analyzer thinks import of extension operator is unused when it is used. #52514

Closed
joshualitt opened this issue May 25, 2023 · 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. P3 A lower priority bug or feature request type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@joshualitt
Copy link
Contributor

joshualitt commented May 25, 2023

SDK:
Dart SDK version: 3.1.0-edge.fad51247fcd2810955a9a927d5f44618a30cad34 (be) (Thu May 4 17:50:22 2023 +0000) on "linux_x64"

Repro:

// foo.dart:
class Foo {
  Map<String, String> data = {};
}

// ext.dart:
import 'foo.dart';
  
extension FooExt on Foo {
  void operator[]=(String p, String v) => this.data[p] = v;
}

// main.dart
import 'foo.dart';
import 'ext.dart';

void main() {
  final foo = Foo();
  foo['a'] = 'b';
}

dart analyze produces:

warning • main.dart:2:8 • Unused import: 'ext.dart'. Try removing the import directive. •
          unused_import
@lrhn lrhn added area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) labels May 25, 2023
@scheglov scheglov added the P3 A lower priority bug or feature request label May 26, 2023
@scheglov scheglov self-assigned this May 26, 2023
@scheglov scheglov added the analyzer-warning Issues with the analyzer's Warning codes label May 26, 2023
@scheglov
Copy link
Contributor

copybara-service bot pushed a commit that referenced this issue May 26, 2023
Bug: #52514
Change-Id: I88fcf39440fbb9969d901c5a293d9a1b11aff30b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/306123
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@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. P3 A lower priority bug or feature request type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

No branches or pull requests

3 participants