Skip to content

Bug: Type checking is broken for enums #52269

Closed
@MichaelTamm

Description

@MichaelTamm

I think, the following code should not compile:

enum A { foo, bar }

enum B { foo, bar, baz }

void main() {
  final x = A.foo;
  print(x == B.foo ? '$x == B.foo' : '$x != B.foo');
}

... because it makes no sense to compare x (an instance of enum A) with an instance of enum B.

Link to the example in DartPad

  • Dart SDK 2.19.6

Metadata

Metadata

Assignees

No one assigned

    Labels

    closed-as-intendedClosed as the reported issue is expected behavior

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions