Skip to content

[Enhanced enums] Strange compile error on CFE #48342

Closed
@sgrekhov

Description

@sgrekhov

The folllowing co19 test fails https://github.com/dart-lang/co19/blob/master/LanguageFeatures/Enhanced-Enum/semantics_A09_t02.dart

enum E1 {
//   ^^
// [cfe] unspecified
  e1,
//^^
// [analyzer] unspecified
  e2,
  e3;

  final int e1 = 42;
//          ^^
// [cfe] unspecified
}

enum E2<T> {
//   ^^
// [cfe] unspecified
  e1<int>(42), // Fails here. Unexpected error at line 38, column 3: Constant evaluation error:
  e2<String>("42"),
//^^
// [analyzer] unspecified
  e3<bool>(false);

  const E2(T t);
  final List<E2> e2 = const [];
//               ^^
// [cfe] unspecified
}

enum E3 {
//   ^^
// [cfe] unspecified
  e1,
  e2,
  e3;

  static final int e1 = 42;
//                 ^^
// [analyzer] unspecified
}

main() {
  print(E1);
  print(E2);
  print(E3);
}

Why "Unexpected error at line 38, column 3: Constant evaluation error:" occurs. I don't see any errors on this line. To rerun the test use python3 tools/test.py -n cfe-strong-linux co19/LanguageFeatures/Enhanced-Enum/semantics_A09_t02

cc @eernstg

Tested on Dart SDK version: 2.17.0-edge.6bcc451e597867cb7c0b4f21d9143d0a43cbb401 (be) (Tue Feb 8 01:49:35 2022 +0000) on "linux_x64"

Activity

eernstg

eernstg commented on Feb 8, 2022

@eernstg
Member

Right, I couldn't see a reason for that error on line 38. Also I saw some 'Constant expression depends on itself' errors that I couldn't explain.

chloestefantsova

chloestefantsova commented on Feb 8, 2022

@chloestefantsova
Contributor

It seems to be an error triggered by the unhandled name conflict. I'm working on detecting and handling those conflicts, and it should fix this issue as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

    Development

    No branches or pull requests

      Participants

      @chloestefantsova@sgrekhov@eernstg

      Issue actions

        [Enhanced enums] Strange compile error on CFE · Issue #48342 · dart-lang/sdk