Skip to content

[augmentations] Wrong analyzer warning when augmenting enum constructor #57028

@sgrekhov

Description

@sgrekhov

The code below produces a warning in the analyzer (with --enable-experiment=macros).

enum E {
  e0(0), e1.foo();
  final int x;
  const E(this.x);
  const E.foo(): this(1); //  The declaration 'E.foo' isn't referenced. Try removing the declaration of 'E.foo'. • unused_element
}

augment enum E {
  e2(1);
  augment const E.foo();
}

main() {
  print(E.e1);
}

E.foo() is referenced here so the warning is wrong.

Dart SDK version: 3.7.0-86.0.dev (dev) (Wed Oct 30 17:03:22 2024 -0700) on "windows_x64"

Metadata

Metadata

Assignees

No one assigned

    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.feature-augmentationsImplementation of the augmentations feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions