[tests] Primary constructors - More cases for empty body test.
From Lasse's comment in https://dart-review.googlesource.com/c/sdk/+/486525. Added many more combinations of extends, implements and mixin applications to `empty_body_test.dart`. Bug: https://github.com/dart-lang/sdk/issues/61687 Change-Id: Ie26c7661d6505d21c2f457b285f1ef1b88b8e6ac Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/486863 Reviewed-by: Lasse Nielsen <lrn@google.com> Commit-Queue: Kallen Tu <kallentu@google.com>
This commit is contained in:
@@ -6,52 +6,136 @@
|
||||
|
||||
// SharedOptions=--enable-experiment=primary-constructors
|
||||
|
||||
// Classes
|
||||
class C1;
|
||||
class S1;
|
||||
class S2 extends S;
|
||||
class S3 with M;
|
||||
class S4 extends S with M;
|
||||
class S5 extends S with M, N;
|
||||
class S6 implements I;
|
||||
class S7 extends S implements I;
|
||||
class S8 with M implements I;
|
||||
class S9 extends S with M implements I;
|
||||
class S10 extends S with M, N implements I;
|
||||
class S11 implements I, J;
|
||||
class S12 extends S implements I, J;
|
||||
class S13 with M implements I, J;
|
||||
class S14 extends S with M implements I, J;
|
||||
class S15 extends S with M, N implements I, J;
|
||||
|
||||
class C2 with M1;
|
||||
class const P1();
|
||||
class const P2() extends S;
|
||||
class const P3() with M;
|
||||
class const P4() extends S with M;
|
||||
class const P5() extends S with M, N;
|
||||
class const P6() implements I;
|
||||
class const P7() extends S implements I;
|
||||
class const P8() with M implements I;
|
||||
class const P9() extends S with M implements I;
|
||||
class const P10() extends S with M, N implements I;
|
||||
class const P11() implements I, J;
|
||||
class const P12() extends S implements I, J;
|
||||
class const P13() with M implements I, J;
|
||||
class const P14() extends S with M implements I, J;
|
||||
class const P15() extends S with M, N implements I, J;
|
||||
|
||||
class C3(var int x) extends C1;
|
||||
class MC1 = S with M;
|
||||
class MC2 = S with M, N;
|
||||
class MC3 = S with M implements I;
|
||||
class MC4 = S with M, N implements I;
|
||||
|
||||
// Extension types
|
||||
extension type E1(int x);
|
||||
mixin M1;
|
||||
mixin M2 on S;
|
||||
mixin M3 on S, M;
|
||||
mixin M4 implements I;
|
||||
mixin M5 on S implements I;
|
||||
mixin M6 on S, M implements I;
|
||||
mixin M7 implements I, J;
|
||||
mixin M8 on S implements I, J;
|
||||
mixin M9 on S, M implements I, J;
|
||||
|
||||
extension type const E2(int x);
|
||||
extension type X1(I _);
|
||||
extension type X2(I _) implements I;
|
||||
extension type X3(IJ _) implements I, J;
|
||||
extension type const X4(final I _);
|
||||
extension type const X5(final I _) implements I;
|
||||
extension type const X6(final IJ _) implements I, J;
|
||||
|
||||
// Mixin classes
|
||||
mixin class M1 implements C1;
|
||||
extension on I;
|
||||
extension Ex1 on I;
|
||||
extension Ex2<T> on T;
|
||||
|
||||
// Helpers.
|
||||
interface class I {}
|
||||
interface class J {}
|
||||
interface class IJ implements I, J {}
|
||||
class S {
|
||||
const S();
|
||||
}
|
||||
mixin M {}
|
||||
mixin N {}
|
||||
|
||||
class M1With with M1;
|
||||
|
||||
mixin class M2;
|
||||
|
||||
class M2With with M2;
|
||||
|
||||
// Mixins
|
||||
mixin M3;
|
||||
|
||||
class M3With with M3;
|
||||
|
||||
mixin M4 implements C1;
|
||||
|
||||
class M2With extends S with M2;
|
||||
class M3With extends S with M, M3;
|
||||
class M4With with M4;
|
||||
|
||||
mixin M5 on C1;
|
||||
|
||||
class M5With extends C1 with M5;
|
||||
|
||||
// Extension
|
||||
extension Ext1 on C1;
|
||||
class M5With extends S with M5;
|
||||
class M6With extends S with M, M6;
|
||||
class M7With with M7;
|
||||
class M8With extends S with M8;
|
||||
class M9With extends S with M, M9;
|
||||
|
||||
void main() {
|
||||
print(C1());
|
||||
print(C2());
|
||||
print(C3(1));
|
||||
print(E1(1));
|
||||
print(E2(1));
|
||||
print(M1With());
|
||||
print(M2With());
|
||||
print(M3With());
|
||||
print(M4With());
|
||||
print(M5With());
|
||||
S1();
|
||||
S2();
|
||||
S3();
|
||||
S4();
|
||||
S5();
|
||||
S6();
|
||||
S7();
|
||||
S8();
|
||||
S9();
|
||||
S10();
|
||||
S11();
|
||||
S12();
|
||||
S13();
|
||||
S14();
|
||||
S15();
|
||||
|
||||
P1();
|
||||
P2();
|
||||
P3();
|
||||
P4();
|
||||
P5();
|
||||
P6();
|
||||
P7();
|
||||
P8();
|
||||
P9();
|
||||
P10();
|
||||
P11();
|
||||
P12();
|
||||
P13();
|
||||
P14();
|
||||
P15();
|
||||
|
||||
MC1();
|
||||
MC2();
|
||||
MC3();
|
||||
MC4();
|
||||
|
||||
X1(I());
|
||||
X2(I());
|
||||
X3(IJ());
|
||||
X4(I());
|
||||
X5(I());
|
||||
X6(IJ());
|
||||
|
||||
M1With();
|
||||
M2With();
|
||||
M3With();
|
||||
M4With();
|
||||
M5With();
|
||||
M6With();
|
||||
M7With();
|
||||
M8With();
|
||||
M9With();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user