Skip to content

[cfe] Excessive error if enum and another declaration have the same names #59623

@sgrekhov

Description

@sgrekhov
enum E {e1;} // CFE: Error: Couldn't find constructor 'E'. Analyzer: Ok

int E = 1; // CFE: Error: 'E' is already declared in this scope. Analyzer: The name 'E' is already defined

Why CFE reports an error on the enum declaration? There is nothing wrong with it. No this issue if to replace an enum by some class declaration (CFE reports an error for the second declaration only if the first declaration is a class).

Dart SDK version: 3.7.0-183.0.dev (dev) (Fri Nov 22 20:03:46 2024 -0800) on "windows_x64"

Metadata

Metadata

Assignees

No one assigned

    Labels

    legacy-area-front-endLegacy: Use area-dart-model instead.model-messagesPoor/undesirable messaging in errors/warnings emitted by the analyzer and/or CFE.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions