@@ -687,34 +687,56 @@ It's a compile-time error if:
687
687
class M with S {} // Error, for several reasons.
688
688
```
689
689
690
- * A class extends or mixes in a declaration marked `interface` or `final`
690
+ * A declaration has a direct super declaration from another library
691
+ which is marked `final`_(with some exceptions for platform libraries)_.
692
+
693
+ More formally:
694
+ A declaration *D* from library *L* has a direct superdeclaration *S*
695
+ marked `final` (so necessarily a `class` declaration) in library *K*, and neither
696
+ * *L* and *K* is the same library, nor
697
+ * *K* is a platform library and *L* is a pre-feature library.
698
+
699
+ ```dart
700
+ // a.dart
701
+ final class F {}
702
+
703
+ // b.dart
704
+ import 'a.dart';
705
+
706
+ class C1 extends F {} // Error.
707
+ class C2 implements F {} // Error.
708
+ mixin class C3 implements F {} // Error.
709
+ mixin M1 implements F {} // Error.
710
+ mixin M2 on F {} // Error.
711
+ enum E1 implements F {} // Error.
712
+ ```
713
+
714
+ * A class extends or mixes in a declaration marked `interface`
691
715
from another library _(with some exceptions for platform libraries)_.
692
716
693
717
_(You cannot inherit implementation from a class marked `interface`
694
- or `final` except inside the same library. Unless you are in a
695
- pre-feature library and you are inheriting from a platform library.)_
718
+ except inside the same library. Unless you are in a pre-feature
719
+ library and you are inheriting from a platform library.)_
696
720
697
721
More formally:
698
- A declaration *C* from library *L* has a declared superclass or mixin
699
- declaration *S* marked `interface` or `final` from library *K*, and neither
722
+ A declaration *C* from library *L* has a declared superclass
723
+ declaration *S* marked `interface` from library *K*, and neither
700
724
* *L* and *K* is the same library, nor
701
725
* *K* is a platform library and *L* is a pre-feature library.
702
726
703
727
```dart
704
728
// a.dart
705
729
interface class I {}
706
- final class F {}
707
730
708
731
// b.dart
709
732
import 'a.dart';
710
733
711
734
class C1 extends I {} // Error.
712
- class C2 extends F {} // Error.
713
735
```
714
736
715
737
* A declaration implements another declaration, and the other
716
- declaration itself, or any of its super-declarations,
717
- are marked `base` or `final` and are not from the first declaration's
738
+ declaration itself, or any of its super-declarations, are marked
739
+ `base` or `final` and are not from the first declaration's
718
740
library _(with some exceptions for platform libraries)_.
719
741
720
742
_(You can only implement an interface if *all* `base` or `final`
@@ -724,8 +746,8 @@ It's a compile-time error if:
724
746
725
747
More formally:
726
748
A declaration *C* in library *L* has a declared interface *P*,
727
- and *P* has any superdeclaration *S*, from a library *K*,
728
- which is marked `base` or `final` _(including *S* being *P* itself)_,
749
+ and *P* has any superdeclaration *S*, from a library *K*, which
750
+ is marked `base` or `final` _(including *S* being *P* itself)_,
729
751
and neither:
730
752
* *K* and *L* is the same library, mor
731
753
* *K* is a platform library and *L* is a pre-feature library.
@@ -850,10 +872,10 @@ mixin class C {
850
872
C(int x); // Error.
851
873
C(this.x); // Error.
852
874
C() {} // Error.
853
- C(): x = 0;
875
+ C(): x = 0; // Error.
854
876
C(): assert(true); // Error.
855
877
C(): super(); // Error.
856
- C(): this.named();
878
+ C(): this.named(); // Error.
857
879
858
880
// Not generative constructors, so neither trivial generative nor non-trivial
859
881
// generative:
0 commit comments