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 doesn't report duplicate getter #59977

Open
johnniwinther opened this issue Jan 24, 2025 · 0 comments
Open

Analyzer doesn't report duplicate getter #59977

johnniwinther opened this issue Jan 24, 2025 · 0 comments
Labels
analyzer-spec Issues with the analyzer's implementation of the language spec area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. P2 A bug or feature request we're likely to work on

Comments

@johnniwinther
Copy link
Member

The analyzer fails to report duplicate getters on

class A {
  void set b(int? value) {}
  int? get b => null;
  int? get b => 0;
}

If the order of the declarations is changed to

class A {
  int? get b => null;
  void set b(int? value) {}
  int? get b => 0;
}

the error is reported:

  error • getter.dart:4:11 • The name 'b' is already defined. Try renaming one of the declarations. • duplicate_definition
           - The first definition of this name at getter.dart:2:11.
@johnniwinther johnniwinther added analyzer-spec Issues with the analyzer's implementation of the language spec area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. labels Jan 24, 2025
@bwilkerson bwilkerson added the P2 A bug or feature request we're likely to work on label Jan 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
analyzer-spec Issues with the analyzer's implementation of the language spec area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. P2 A bug or feature request we're likely to work on
Projects
None yet
Development

No branches or pull requests

2 participants