Description
According to the Enhanced Enums specification
It's a compile-time error if a class or mixin declaration has Enum as a superinterface and the interface of the declarations contains an instance member with the name values, whether declared or inherited. If any concrete class implements this interface, it will be an enum declaration class, and then the values member would conflict with the static values constant getter that is automatically added to enum declaration classes. Such an instance values declaration is either useless or wrong, so we disallow it entirely.
Now there is no expected error in CFE in the folllowing cases
mixin M1 on Enum {
final int values = 42;
// ^^^^^^
// [analyzer] unspecified
// [cfe] unspecified
}
mixin M2 on Enum {
final List values = [];
// ^^^^^^
// [analyzer] unspecified
// [cfe] unspecified
}
abstract class E1 extends Enum {
int values() => 42;
// ^^^^^^
// [analyzer] unspecified
// [cfe] unspecified
}
abstract class E2 extends Enum {
List<E2> values() => [];
// ^^^^^^
// [analyzer] unspecified
// [cfe] unspecified
}
It is clearly said in the specification '... class or mixin declaration has Enum as a superinterface and the interface of the declarations contains an instance member with the name values ...'. So, I believe, CFE should report a compile-time error like analyzer does.
cc @eernstg to confirm