Skip to content

Analyzer doesn't report duplicate getter #59977

Open
@johnniwinther

Description

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

Assignees

No one assigned

    Labels

    P2A bug or feature request we're likely to work onanalyzer-specIssues with the analyzer's implementation of the language specarea-analyzerUse area-analyzer for Dart analyzer issues, including the analysis server and code completion.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions