Skip to content

[Enhanced enums] Strange compile error on CFE #48342

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
sgrekhov opened this issue Feb 8, 2022 · 2 comments
Closed

[Enhanced enums] Strange compile error on CFE #48342

sgrekhov opened this issue Feb 8, 2022 · 2 comments
Assignees
Labels
legacy-area-front-end Legacy: Use area-dart-model instead.

Comments

@sgrekhov
Copy link
Contributor

sgrekhov commented Feb 8, 2022

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"

@sgrekhov sgrekhov added the legacy-area-front-end Legacy: Use area-dart-model instead. label Feb 8, 2022
@eernstg
Copy link
Member

eernstg commented Feb 8, 2022

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 self-assigned this Feb 8, 2022
@chloestefantsova
Copy link
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
Labels
legacy-area-front-end Legacy: Use area-dart-model instead.
Projects
None yet
Development

No branches or pull requests

3 participants