-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Open
Labels
legacy-area-front-endLegacy: Use area-dart-model instead.Legacy: Use area-dart-model instead.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-bugIncorrect behavior (everything from a crash to more subtle misbehavior)Incorrect behavior (everything from a crash to more subtle misbehavior)
Description
mixin M {
M.baz();
}
class MA with M {}
void main(){}gives a warning of
main.dart:2:3: Error: Mixins can't declare constructors.
M.baz();
^
main.dart:5:7: Error: Can't use 'M' as a mixin because it has constructors.
class MA with M {}
^
main.dart:2:3: Context: This constructor prevents using 'M' as a mixin.
M.baz();
^
The error in line 5, "Can't use 'M' as a mixin because it has constructors.", feels misplaced.
The mixin M doesn't have constructors, because mixins can't have constructors. That's not preventing using it as a mixin, it's preventing the program from compiling.
The only real error, and the only one reported by the analyzer, is that mixin M can't declare a constructor.
Metadata
Metadata
Assignees
Labels
legacy-area-front-endLegacy: Use area-dart-model instead.Legacy: Use area-dart-model instead.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-bugIncorrect behavior (everything from a crash to more subtle misbehavior)Incorrect behavior (everything from a crash to more subtle misbehavior)