Description
Example:
abstract final interface class I {}
abstract final base class B {}
base class Z extends B implements I {}
void main() {
print(Z() is I);
print(Z() is B);
}
Is accepted by both analyzer and CFE.
Found in dart-lang/dart_style#1319
The final
and interface
/base
modifiers are mutually exclusive, so it should not be allowed.
It seems to require starting with abstract final
. (Which is not a valid start of a variable declaration at top-level, but is locally, so it'd be reasonable to not have decided at this point whether we're starting a variable declaration or a class declaration, and then forgetting that if it is a class declaration, the we don't allow more access modifiers. But that's me guessing.)
It is, I think, the only cases that slip through, other similar declarations starting with abstract final
gets disqualified for other reasons:
abstract final base mixin class M {}
disallowed because mixins can't befinal
.abstract final sealed class M {}
disallowed because sealed classes can't beabstract
.
The parser seems to react badly to abstract base interface class D {}
, maybe considering it a variable named interface
with a type named base
, which then cannot be abstract
.
That's not the best possible error message.
But this seems to be valid, so I can see why it's not easy to be the parser.
final base interface = null;
typedef base = int?;