Closed
Description
enum MyEnum { a, b }
class Test {
const Test(MyEnum arg) : value = arg == MyEnum.a ? 0 : 1;
final int value;
}
void main() {
Test q = const Test(MyEnum.a);
Test r = const Test(MyEnum.a);
print(identical(q, r));
}
VM prints "true", showing that the const expression is fine.
Analyzer says:
[error] In constant expressions, operands of this operator must be of type 'bool', 'num', 'String' or 'null' (test.dart, line 4, col 36)