Example:
// old_lib.dart
// @dart=2.19
// MapEntry is `final`, but can be implemented due to SDK exception.
class M implements MapEntry<int, int> {
int get key => 0;
int get value => 1;
String toString() => "Bad";
}
and
// new_lib.dart
// @dart=3.0
import "old_lib.dart";
class N implements M {
int get key => 0;
int get value => 1;
String toString() => "Evil";
}
void main() {
print(N()); // Evil.
}
This gives no errors, or warnings, in the front end or analyzer.
According to specification, you are not allowed to implement any interface which has any superinterface whose declaration is marked base or final. (Unless you are, yourself, a pre-feature library and all such superinterfaces are in platform libraries.)
Here N is not in a pre-feature library, so it gets no exemptions.
M has a superinterface marked final, so it must not be implemented by N.
(We don't have a rule against N extending M, so its not like we can prevent everything, but we can prevent new implements of a final platform type in 3.0-libraries.)
Filing as area-fe-analyzer-shared. Split this into two issues if it's two different bugs.
Example:
and
This gives no errors, or warnings, in the front end or analyzer.
According to specification, you are not allowed to implement any interface which has any superinterface whose declaration is marked
baseorfinal. (Unless you are, yourself, a pre-feature library and all such superinterfaces are in platform libraries.)Here
Nis not in a pre-feature library, so it gets no exemptions.Mhas a superinterface markedfinal, so it must not be implemented byN.(We don't have a rule against
NextendingM, so its not like we can prevent everything, but we can prevent newimplementsof afinalplatform type in 3.0-libraries.)Filing as area-fe-analyzer-shared. Split this into two issues if it's two different bugs.