-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Open
Labels
area-dart-modelFor issues related to conformance to the language spec in the parser, compilers or the CLI analyzer.For issues related to conformance to the language spec in the parser, compilers or the CLI analyzer.model-messagesPoor/undesirable messaging in errors/warnings emitted by the analyzer and/or CFE.Poor/undesirable messaging in errors/warnings emitted by the analyzer and/or CFE.type-enhancementA request for a change that isn't a bugA request for a change that isn't a bug
Description
For the following code:
void main() {
print(E.e.value);
}
mixin class WithConstant {
const WithConstant();
final value = 42;
}
enum E with WithConstant {e}
I get the following errors:
- Analyzer: "Mixins applied to enums can't have instance variables."
- CFE: "A constant constructor can't call a non-constant super constructor."
The CFE is tecnnically correct. The mixin application of WithConstant
introduces a non-constant forwarding constructor when the mixin has an instance variable, and then the superclass of E
has a non-constant constructor.
It's not very understandable, though. The error message is a few steps away from the thing you can actually change: Removing the field or not mixing in the mixin.
The analyzer message is more directly actionable.
Metadata
Metadata
Assignees
Labels
area-dart-modelFor issues related to conformance to the language spec in the parser, compilers or the CLI analyzer.For issues related to conformance to the language spec in the parser, compilers or the CLI analyzer.model-messagesPoor/undesirable messaging in errors/warnings emitted by the analyzer and/or CFE.Poor/undesirable messaging in errors/warnings emitted by the analyzer and/or CFE.type-enhancementA request for a change that isn't a bugA request for a change that isn't a bug