Skip to content

Analyzer doesn't report duplicate getter #59977

@johnniwinther

Description

@johnniwinther

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.

Metadata

Metadata

Assignees

Labels

P2A bug or feature request we're likely to work onarea-dart-modelFor issues related to conformance to the language spec in the parser, compilers or the CLI analyzer.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions