Roll dart_style 2.2.2 into the repo.
This adds formatting support for upcoming language features: - Named arguments anywhere - Enhanced enums - "super." parameters It doesn't change the formatting of any existing code, so it should be safe to roll this in without coordinating a pre-built SDK roll. I also went ahead and ran the formatter on the related language tests since before now they couldn't be formatted. (And I incidentally ran the formatter on the other enum tests sitting in the same directory.) Edit: Actually there is one small change to existing formatting: enum declarations will now get a blank line inserted before them. Most hand authored enums already have this so will be unchanged but I see a few diffs when formatting generated code. Change-Id: Icefd9f10bedc589312396cf0ddb8eafc418f8dbf Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/235284 Auto-Submit: Bob Nystrom <rnystrom@google.com> Reviewed-by: Alexander Thomas <athom@google.com> Reviewed-by: William Hesse <whesse@google.com> Commit-Queue: William Hesse <whesse@google.com>
This commit is contained in:
committed by
Commit Bot
parent
c97736d594
commit
06763dd539
@@ -107,7 +107,7 @@ vars = {
|
||||
# and land the review.
|
||||
#
|
||||
# For more details, see https://github.com/dart-lang/sdk/issues/30164
|
||||
"dart_style_rev": "6f894c0ca33686122be9085f06e5b9bf6ad55262",
|
||||
"dart_style_rev": "d7b73536a8079331c888b7da539b80e6825270ea",
|
||||
|
||||
"dartdoc_rev" : "a39f378f8100b907e6285ac825967d764fd664ad",
|
||||
"devtools_rev" : "b9f2039239cc72ac8b26f8a5fe46123f34d53ce1",
|
||||
|
||||
+47
-7
@@ -1,20 +1,60 @@
|
||||
enum E1 { element; final int element = 42; }
|
||||
enum E2 { element, element; }
|
||||
enum E3 { element; void element() {} }
|
||||
enum E4 { element; static void element() {} }
|
||||
enum E5 { element; static int element = 42; }
|
||||
enum E6 { element; void set element(E6 value) {} }
|
||||
enum E7 { element; static void set element(E7 value) {} }
|
||||
enum E1 {
|
||||
element;
|
||||
|
||||
final int element = 42;
|
||||
}
|
||||
|
||||
enum E2 {
|
||||
element,
|
||||
element;
|
||||
}
|
||||
|
||||
enum E3 {
|
||||
element;
|
||||
|
||||
void element() {}
|
||||
}
|
||||
|
||||
enum E4 {
|
||||
element;
|
||||
|
||||
static void element() {}
|
||||
}
|
||||
|
||||
enum E5 {
|
||||
element;
|
||||
|
||||
static int element = 42;
|
||||
}
|
||||
|
||||
enum E6 {
|
||||
element;
|
||||
|
||||
void set element(E6 value) {}
|
||||
}
|
||||
|
||||
enum E7 {
|
||||
element;
|
||||
|
||||
static void set element(E7 value) {}
|
||||
}
|
||||
|
||||
class A8 {
|
||||
void set element(dynamic value) {}
|
||||
}
|
||||
|
||||
enum E8 with A8 { element }
|
||||
|
||||
class A9 {
|
||||
int element = 42;
|
||||
}
|
||||
|
||||
enum E9 with A9 { element }
|
||||
|
||||
class A10 {
|
||||
void element() {}
|
||||
}
|
||||
|
||||
enum E10 with A10 { element }
|
||||
|
||||
main() {}
|
||||
|
||||
+60
@@ -0,0 +1,60 @@
|
||||
class A10 {
|
||||
void element() {}
|
||||
}
|
||||
|
||||
class A8 {
|
||||
void set element(dynamic value) {}
|
||||
}
|
||||
|
||||
class A9 {
|
||||
int element = 42;
|
||||
}
|
||||
|
||||
enum E1 {
|
||||
element;
|
||||
|
||||
final int element = 42;
|
||||
}
|
||||
|
||||
enum E10 with A10 { element }
|
||||
|
||||
enum E2 {
|
||||
element,
|
||||
element;
|
||||
}
|
||||
|
||||
enum E3 {
|
||||
element;
|
||||
|
||||
void element() {}
|
||||
}
|
||||
|
||||
enum E4 {
|
||||
element;
|
||||
|
||||
static void element() {}
|
||||
}
|
||||
|
||||
enum E5 {
|
||||
element;
|
||||
|
||||
static int element = 42;
|
||||
}
|
||||
|
||||
enum E6 {
|
||||
element;
|
||||
|
||||
void set element(E6 value) {}
|
||||
}
|
||||
|
||||
enum E7 {
|
||||
element;
|
||||
|
||||
static void set element(E7 value) {}
|
||||
}
|
||||
|
||||
enum E8 with A8 { element }
|
||||
|
||||
enum E9 with A9 { element }
|
||||
|
||||
main() {}
|
||||
+18
-1
@@ -1,3 +1,20 @@
|
||||
enum E { one, two.named(), three.f(), four.f2(); const E(); const E.named() : this(); factory E.f() => values.first; factory E.f2() { return const E(); } const factory E.f3() = E; factory E.f4() = E; factory E.f5() = E.f; factory E.f6(int value) = E.f; }
|
||||
enum E {
|
||||
one,
|
||||
two.named(),
|
||||
three.f(),
|
||||
four.f2();
|
||||
|
||||
const E();
|
||||
const E.named() : this();
|
||||
factory E.f() => values.first;
|
||||
factory E.f2() {
|
||||
return const E();
|
||||
}
|
||||
const factory E.f3() = E;
|
||||
factory E.f4() = E;
|
||||
factory E.f5() = E.f;
|
||||
factory E.f6(int value) = E.f;
|
||||
}
|
||||
|
||||
test() {}
|
||||
main() {}
|
||||
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
enum E {
|
||||
one,
|
||||
two.named(),
|
||||
three.f(),
|
||||
four.f2();
|
||||
|
||||
const E();
|
||||
const E.named() : this();
|
||||
factory E.f() => values.first;
|
||||
factory E.f2() {
|
||||
return const E();
|
||||
}
|
||||
const factory E.f3() = E;
|
||||
factory E.f4() = E;
|
||||
factory E.f5() = E.f;
|
||||
factory E.f6(int value) = E.f;
|
||||
}
|
||||
|
||||
main() {}
|
||||
test() {}
|
||||
+12
-2
@@ -1,3 +1,13 @@
|
||||
enum T { t; const T.named(); }
|
||||
enum S { s.named(); const S(); }
|
||||
enum T {
|
||||
t;
|
||||
|
||||
const T.named();
|
||||
}
|
||||
|
||||
enum S {
|
||||
s.named();
|
||||
|
||||
const S();
|
||||
}
|
||||
|
||||
void main() {}
|
||||
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
enum S {
|
||||
s.named();
|
||||
|
||||
const S();
|
||||
}
|
||||
|
||||
enum T {
|
||||
t;
|
||||
|
||||
const T.named();
|
||||
}
|
||||
|
||||
void main() {}
|
||||
@@ -1,8 +1,44 @@
|
||||
enum E1 { element; static const List<E1> values = [E1.element]; }
|
||||
enum E2 { element; int values = 42; }
|
||||
enum E3 { element; static const List<E3> values = [E3.element]; int values = 42; }
|
||||
enum E4 { element; static void set values(List<E4> x) {} }
|
||||
enum E5 { element; static void set values(dynamic x) {} }
|
||||
enum E6 { element; static void set values(Never x) {} }
|
||||
enum E7 { element; void values() {} }
|
||||
enum E1 {
|
||||
element;
|
||||
|
||||
static const List<E1> values = [E1.element];
|
||||
}
|
||||
|
||||
enum E2 {
|
||||
element;
|
||||
|
||||
int values = 42;
|
||||
}
|
||||
|
||||
enum E3 {
|
||||
element;
|
||||
|
||||
static const List<E3> values = [E3.element];
|
||||
int values = 42;
|
||||
}
|
||||
|
||||
enum E4 {
|
||||
element;
|
||||
|
||||
static void set values(List<E4> x) {}
|
||||
}
|
||||
|
||||
enum E5 {
|
||||
element;
|
||||
|
||||
static void set values(dynamic x) {}
|
||||
}
|
||||
|
||||
enum E6 {
|
||||
element;
|
||||
|
||||
static void set values(Never x) {}
|
||||
}
|
||||
|
||||
enum E7 {
|
||||
element;
|
||||
|
||||
void values() {}
|
||||
}
|
||||
|
||||
main() {}
|
||||
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
enum E1 {
|
||||
element;
|
||||
|
||||
static const List<E1> values = [E1.element];
|
||||
}
|
||||
|
||||
enum E2 {
|
||||
element;
|
||||
|
||||
int values = 42;
|
||||
}
|
||||
|
||||
enum E3 {
|
||||
element;
|
||||
|
||||
static const List<E3> values = [E3.element];
|
||||
int values = 42;
|
||||
}
|
||||
|
||||
enum E4 {
|
||||
element;
|
||||
|
||||
static void set values(List<E4> x) {}
|
||||
}
|
||||
|
||||
enum E5 {
|
||||
element;
|
||||
|
||||
static void set values(dynamic x) {}
|
||||
}
|
||||
|
||||
enum E6 {
|
||||
element;
|
||||
|
||||
static void set values(Never x) {}
|
||||
}
|
||||
|
||||
enum E7 {
|
||||
element;
|
||||
|
||||
void values() {}
|
||||
}
|
||||
|
||||
main() {}
|
||||
@@ -1,18 +1,26 @@
|
||||
abstract class A extends Enum {
|
||||
int get foo => index;
|
||||
}
|
||||
|
||||
enum EA with A { element }
|
||||
|
||||
abstract class B implements Enum {
|
||||
int get foo => index;
|
||||
}
|
||||
|
||||
enum EB with B { element }
|
||||
|
||||
mixin M on Enum {
|
||||
int get foo => index;
|
||||
}
|
||||
|
||||
enum EM with M { element }
|
||||
|
||||
mixin N implements Enum {
|
||||
int get foo => index;
|
||||
}
|
||||
|
||||
enum EN with N { element }
|
||||
|
||||
expectEquals(x, y) {}
|
||||
main() {}
|
||||
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
abstract class A extends Enum {
|
||||
int get foo => index;
|
||||
}
|
||||
|
||||
abstract class B implements Enum {
|
||||
int get foo => index;
|
||||
}
|
||||
|
||||
enum EA with A { element }
|
||||
|
||||
enum EB with B { element }
|
||||
|
||||
enum EM with M { element }
|
||||
|
||||
enum EN with N { element }
|
||||
|
||||
expectEquals(x, y) {}
|
||||
main() {}
|
||||
mixin M on Enum {
|
||||
int get foo => index;
|
||||
}
|
||||
mixin N implements Enum {
|
||||
int get foo => index;
|
||||
}
|
||||
+14
-2
@@ -1,5 +1,17 @@
|
||||
X foo<X>(X x) => x;
|
||||
enum E1 { bar(foo); const E1(int Function(int) f); }
|
||||
enum E2<X> { bar(foo); const E2(X f); }
|
||||
|
||||
enum E1 {
|
||||
bar(foo);
|
||||
|
||||
const E1(int Function(int) f);
|
||||
}
|
||||
|
||||
enum E2<X> {
|
||||
bar(foo);
|
||||
|
||||
const E2(X f);
|
||||
}
|
||||
|
||||
enum E3<X extends num, Y extends String, Z extends Function(X, Y)> { element }
|
||||
|
||||
main() {}
|
||||
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
X foo<X>(X x) => x;
|
||||
|
||||
enum E1 {
|
||||
bar(foo);
|
||||
|
||||
const E1(int Function(int) f);
|
||||
}
|
||||
|
||||
enum E2<X> {
|
||||
bar(foo);
|
||||
|
||||
const E2(X f);
|
||||
}
|
||||
|
||||
enum E3<X extends num, Y extends String, Z extends Function(X, Y)> { element }
|
||||
|
||||
main() {}
|
||||
+8
-1
@@ -1,4 +1,11 @@
|
||||
enum E<X> { one(1), two("2"); final X field; const E(this.field); }
|
||||
enum E<X> {
|
||||
one(1),
|
||||
two("2");
|
||||
|
||||
final X field;
|
||||
const E(this.field);
|
||||
}
|
||||
|
||||
test() {}
|
||||
foo(E<int> ei, E<String> es) {}
|
||||
bar(E<int> ei, E<String> es) {}
|
||||
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
bar(E<int> ei, E<String> es) {}
|
||||
baz(E<Object> ei, E<Object> es) {}
|
||||
boz(E<Never> ei, E<Never> es) {}
|
||||
checkIsNotType<T>(x) {}
|
||||
checkIsType<T>(x) {}
|
||||
|
||||
enum E<X> {
|
||||
one(1),
|
||||
two("2");
|
||||
|
||||
final X field;
|
||||
const E(this.field);
|
||||
}
|
||||
|
||||
foo(E<int> ei, E<String> es) {}
|
||||
main() {}
|
||||
test() {}
|
||||
@@ -1,3 +1,12 @@
|
||||
enum E { one("foo"), two("bar"); final String field; const E(this.field); @override String toString() => field; }
|
||||
enum E {
|
||||
one("foo"),
|
||||
two("bar");
|
||||
|
||||
final String field;
|
||||
const E(this.field);
|
||||
@override
|
||||
String toString() => field;
|
||||
}
|
||||
|
||||
expectEquals(a, b) {}
|
||||
main() {}
|
||||
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
enum E {
|
||||
one("foo"),
|
||||
two("bar");
|
||||
|
||||
final String field;
|
||||
const E(this.field);
|
||||
@override
|
||||
String toString() => field;
|
||||
}
|
||||
|
||||
expectEquals(a, b) {}
|
||||
main() {}
|
||||
@@ -1,3 +1,16 @@
|
||||
enum E { e1, e2; factory E.f(int i) => E.values[i]; }
|
||||
enum F { f1, f2(42), f3.foo(); factory F(int i) => F.values[i]; }
|
||||
enum E {
|
||||
e1,
|
||||
e2;
|
||||
|
||||
factory E.f(int i) => E.values[i];
|
||||
}
|
||||
|
||||
enum F {
|
||||
f1,
|
||||
f2(42),
|
||||
f3.foo();
|
||||
|
||||
factory F(int i) => F.values[i];
|
||||
}
|
||||
|
||||
main() {}
|
||||
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
enum E {
|
||||
e1,
|
||||
e2;
|
||||
|
||||
factory E.f(int i) => E.values[i];
|
||||
}
|
||||
|
||||
enum F {
|
||||
f1,
|
||||
f2(42),
|
||||
f3.foo();
|
||||
|
||||
factory F(int i) => F.values[i];
|
||||
}
|
||||
|
||||
main() {}
|
||||
@@ -1,2 +1,7 @@
|
||||
enum E { v([]); const E(_); }
|
||||
enum E {
|
||||
v([]);
|
||||
|
||||
const E(_);
|
||||
}
|
||||
|
||||
main() {}
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
enum E {
|
||||
v([]);
|
||||
|
||||
const E(_);
|
||||
}
|
||||
|
||||
main() {}
|
||||
@@ -1,6 +1,12 @@
|
||||
mixin M1 on Enum {
|
||||
int mixedInMethod1(int v) => v;
|
||||
}
|
||||
enum E with M1 { e1, e2, e3; }
|
||||
|
||||
enum E with M1 {
|
||||
e1,
|
||||
e2,
|
||||
e3;
|
||||
}
|
||||
|
||||
expectEquals(x, y) {}
|
||||
main() {}
|
||||
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
enum E with M1 {
|
||||
e1,
|
||||
e2,
|
||||
e3;
|
||||
}
|
||||
|
||||
expectEquals(x, y) {}
|
||||
main() {}
|
||||
mixin M1 on Enum {
|
||||
int mixedInMethod1(int v) => v;
|
||||
}
|
||||
+15
-2
@@ -1,3 +1,16 @@
|
||||
enum E1 { element; E1(); E1.named(); }
|
||||
enum E2 { one.named1(), two.named2(); const E2.named1() : super(); const E2.named2() : super(42, "42"); }
|
||||
enum E1 {
|
||||
element;
|
||||
|
||||
E1();
|
||||
E1.named();
|
||||
}
|
||||
|
||||
enum E2 {
|
||||
one.named1(),
|
||||
two.named2();
|
||||
|
||||
const E2.named1() : super();
|
||||
const E2.named2() : super(42, "42");
|
||||
}
|
||||
|
||||
main() {}
|
||||
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
enum E1 {
|
||||
element;
|
||||
|
||||
E1();
|
||||
E1.named();
|
||||
}
|
||||
|
||||
enum E2 {
|
||||
one.named1(),
|
||||
two.named2();
|
||||
|
||||
const E2.named1() : super();
|
||||
const E2.named2() : super(42, "42");
|
||||
}
|
||||
|
||||
main() {}
|
||||
@@ -1,3 +1,27 @@
|
||||
enum E { one(1), two(2); final int foo; final int bar = 42; static E staticFoo = new E.f(); const E(this.foo); factory E.f() => E.one; int method(int value) => value + 10; String staticMethod(double d, bool b) => "$d$b"; }
|
||||
enum E2<X> { one<num>(1), two("2"); final X foo; final X? bar = null; static var staticFoo = () => new E2.f(); const E2(this.foo); factory E2.f() => throw 42; int method(int value) => value + 10; String staticMethod(double d, X x) => "$d$x"; }
|
||||
enum E {
|
||||
one(1),
|
||||
two(2);
|
||||
|
||||
final int foo;
|
||||
final int bar = 42;
|
||||
static E staticFoo = new E.f();
|
||||
const E(this.foo);
|
||||
factory E.f() => E.one;
|
||||
int method(int value) => value + 10;
|
||||
String staticMethod(double d, bool b) => "$d$b";
|
||||
}
|
||||
|
||||
enum E2<X> {
|
||||
one<num>(1),
|
||||
two("2");
|
||||
|
||||
final X foo;
|
||||
final X? bar = null;
|
||||
static var staticFoo = () => new E2.f();
|
||||
const E2(this.foo);
|
||||
factory E2.f() => throw 42;
|
||||
int method(int value) => value + 10;
|
||||
String staticMethod(double d, X x) => "$d$x";
|
||||
}
|
||||
|
||||
main() {}
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
enum E {
|
||||
one(1),
|
||||
two(2);
|
||||
|
||||
final int foo;
|
||||
final int bar = 42;
|
||||
static E staticFoo = new E.f();
|
||||
const E(this.foo);
|
||||
factory E.f() => E.one;
|
||||
int method(int value) => value + 10;
|
||||
String staticMethod(double d, bool b) => "$d$b";
|
||||
}
|
||||
|
||||
enum E2<X> {
|
||||
one<num>(1),
|
||||
two("2");
|
||||
|
||||
final X foo;
|
||||
final X? bar = null;
|
||||
static var staticFoo = () => new E2.f();
|
||||
const E2(this.foo);
|
||||
factory E2.f() => throw 42;
|
||||
int method(int value) => value + 10;
|
||||
String staticMethod(double d, X x) => "$d$x";
|
||||
}
|
||||
|
||||
main() {}
|
||||
@@ -1,4 +1,29 @@
|
||||
enum E0 { one(1, bar: 1), two(2, bar: 2); final int foo; final int bar; const E0(this.foo, {required this.bar}); }
|
||||
enum E1<X> { one(foo: "1"), two(foo: 2); final X foo; const E1({required this.foo}); }
|
||||
enum E2<X, Y, Z> { one(1, bar: "1", baz: 3.14), two("2", baz: 3.14, bar: 2), three(3.0, bar: false); final X foo; final Y bar; final Z? baz; const E2(this.foo, {required this.bar, this.baz = null}); }
|
||||
enum E0 {
|
||||
one(1, bar: 1),
|
||||
two(2, bar: 2);
|
||||
|
||||
final int foo;
|
||||
final int bar;
|
||||
const E0(this.foo, {required this.bar});
|
||||
}
|
||||
|
||||
enum E1<X> {
|
||||
one(foo: "1"),
|
||||
two(foo: 2);
|
||||
|
||||
final X foo;
|
||||
const E1({required this.foo});
|
||||
}
|
||||
|
||||
enum E2<X, Y, Z> {
|
||||
one(1, bar: "1", baz: 3.14),
|
||||
two("2", baz: 3.14, bar: 2),
|
||||
three(3.0, bar: false);
|
||||
|
||||
final X foo;
|
||||
final Y bar;
|
||||
final Z? baz;
|
||||
const E2(this.foo, {required this.bar, this.baz = null});
|
||||
}
|
||||
|
||||
main() {}
|
||||
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
enum E0 {
|
||||
one(1, bar: 1),
|
||||
two(2, bar: 2);
|
||||
|
||||
final int foo;
|
||||
final int bar;
|
||||
const E0(this.foo, {required this.bar});
|
||||
}
|
||||
|
||||
enum E1<X> {
|
||||
one(foo: "1"),
|
||||
two(foo: 2);
|
||||
|
||||
final X foo;
|
||||
const E1({required this.foo});
|
||||
}
|
||||
|
||||
enum E2<X, Y, Z> {
|
||||
one(1, bar: "1", baz: 3.14),
|
||||
two("2", baz: 3.14, bar: 2),
|
||||
three(3.0, bar: false);
|
||||
|
||||
final X foo;
|
||||
final Y bar;
|
||||
final Z? baz;
|
||||
const E2(this.foo, {required this.bar, this.baz = null});
|
||||
}
|
||||
|
||||
main() {}
|
||||
+16
-1
@@ -1,3 +1,18 @@
|
||||
enum C { a(1, 2, z: 3), b(z: 3, 1, 2), c(1, z: 3, 2), d.named1(1, 2, 3), e.named2(1, 2, 3), f.named3(1, 2, 3), ; final String log; const C(int x, int y, {int z = 42}) : this.log = "x=$x, y=$y, z=$z"; const C.named1(int x, int y, int z) : this(x, y, z: z); const C.named2(int x, int y, int z) : this(x, z: z, y); const C.named3(int x, int y, int z) : this(z: z, x, y); }
|
||||
enum C {
|
||||
a(1, 2, z: 3),
|
||||
b(z: 3, 1, 2),
|
||||
c(1, z: 3, 2),
|
||||
d.named1(1, 2, 3),
|
||||
e.named2(1, 2, 3),
|
||||
f.named3(1, 2, 3),
|
||||
;
|
||||
|
||||
final String log;
|
||||
const C(int x, int y, {int z = 42}) : this.log = "x=$x, y=$y, z=$z";
|
||||
const C.named1(int x, int y, int z) : this(x, y, z: z);
|
||||
const C.named2(int x, int y, int z) : this(x, z: z, y);
|
||||
const C.named3(int x, int y, int z) : this(z: z, x, y);
|
||||
}
|
||||
|
||||
main() {}
|
||||
expect(expected, actual) {}
|
||||
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
enum C {
|
||||
a(1, 2, z: 3),
|
||||
b(z: 3, 1, 2),
|
||||
c(1, z: 3, 2),
|
||||
d.named1(1, 2, 3),
|
||||
e.named2(1, 2, 3),
|
||||
f.named3(1, 2, 3),
|
||||
;
|
||||
|
||||
final String log;
|
||||
const C(int x, int y, {int z = 42}) : this.log = "x=$x, y=$y, z=$z";
|
||||
const C.named1(int x, int y, int z) : this(x, y, z: z);
|
||||
const C.named2(int x, int y, int z) : this(x, z: z, y);
|
||||
const C.named3(int x, int y, int z) : this(z: z, x, y);
|
||||
}
|
||||
|
||||
expect(expected, actual) {}
|
||||
main() {}
|
||||
+6
-1
@@ -1,2 +1,7 @@
|
||||
enum E { a.b() ; const E.b(); }
|
||||
enum E {
|
||||
a.b();
|
||||
|
||||
const E.b();
|
||||
}
|
||||
|
||||
main() {}
|
||||
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
enum E {
|
||||
a.b();
|
||||
|
||||
const E.b();
|
||||
}
|
||||
|
||||
main() {}
|
||||
+18
-2
@@ -1,3 +1,19 @@
|
||||
enum E1 { one(1), two.named(2); final int foo; const E1(this.foo); const E1.named(int value) : this(value); }
|
||||
enum E2 { one(1), two.named(2); final int foo; const E2(this.foo); const E2.named(int value) : this(value, value); }
|
||||
enum E1 {
|
||||
one(1),
|
||||
two.named(2);
|
||||
|
||||
final int foo;
|
||||
const E1(this.foo);
|
||||
const E1.named(int value) : this(value);
|
||||
}
|
||||
|
||||
enum E2 {
|
||||
one(1),
|
||||
two.named(2);
|
||||
|
||||
final int foo;
|
||||
const E2(this.foo);
|
||||
const E2.named(int value) : this(value, value);
|
||||
}
|
||||
|
||||
main() {}
|
||||
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
enum E1 {
|
||||
one(1),
|
||||
two.named(2);
|
||||
|
||||
final int foo;
|
||||
const E1(this.foo);
|
||||
const E1.named(int value) : this(value);
|
||||
}
|
||||
|
||||
enum E2 {
|
||||
one(1),
|
||||
two.named(2);
|
||||
|
||||
final int foo;
|
||||
const E2(this.foo);
|
||||
const E2.named(int value) : this(value, value);
|
||||
}
|
||||
|
||||
main() {}
|
||||
@@ -1,3 +1,21 @@
|
||||
enum E1 { one(1), two.named(2); final int foo; const E1(this.foo); const E1.named(int value) : foo = value; }
|
||||
enum E2<X, Y> { one<int, String>(1, "one"), two.named("two", 2), three.named("three", "three"); final X foo; final Y bar; const E2(this.foo, this.bar); const E2.named(Y this.bar, X this.foo); }
|
||||
enum E1 {
|
||||
one(1),
|
||||
two.named(2);
|
||||
|
||||
final int foo;
|
||||
const E1(this.foo);
|
||||
const E1.named(int value) : foo = value;
|
||||
}
|
||||
|
||||
enum E2<X, Y> {
|
||||
one<int, String>(1, "one"),
|
||||
two.named("two", 2),
|
||||
three.named("three", "three");
|
||||
|
||||
final X foo;
|
||||
final Y bar;
|
||||
const E2(this.foo, this.bar);
|
||||
const E2.named(Y this.bar, X this.foo);
|
||||
}
|
||||
|
||||
main() {}
|
||||
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
enum E1 {
|
||||
one(1),
|
||||
two.named(2);
|
||||
|
||||
final int foo;
|
||||
const E1(this.foo);
|
||||
const E1.named(int value) : foo = value;
|
||||
}
|
||||
|
||||
enum E2<X, Y> {
|
||||
one<int, String>(1, "one"),
|
||||
two.named("two", 2),
|
||||
three.named("three", "three");
|
||||
|
||||
final X foo;
|
||||
final Y bar;
|
||||
const E2(this.foo, this.bar);
|
||||
const E2.named(Y this.bar, X this.foo);
|
||||
}
|
||||
|
||||
main() {}
|
||||
+23
-3
@@ -1,10 +1,30 @@
|
||||
abstract class I {
|
||||
void foo();
|
||||
}
|
||||
enum E1 implements I { one, two; void foo() {} }
|
||||
|
||||
enum E1 implements I {
|
||||
one,
|
||||
two;
|
||||
|
||||
void foo() {}
|
||||
}
|
||||
|
||||
enum E2 implements I { one, two }
|
||||
enum E3 implements I? { one, two; void foo() {} }
|
||||
enum E4 { one, two; void foo() {} }
|
||||
|
||||
enum E3 implements I? {
|
||||
one,
|
||||
two;
|
||||
|
||||
void foo() {}
|
||||
}
|
||||
|
||||
enum E4 {
|
||||
one,
|
||||
two;
|
||||
|
||||
void foo() {}
|
||||
}
|
||||
|
||||
bar(I i) {}
|
||||
test(E1 e1, E2 e2, E3 e3, E4 e4) {}
|
||||
main() {}
|
||||
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
abstract class I {
|
||||
void foo();
|
||||
}
|
||||
|
||||
bar(I i) {}
|
||||
|
||||
enum E1 implements I {
|
||||
one,
|
||||
two;
|
||||
|
||||
void foo() {}
|
||||
}
|
||||
|
||||
enum E2 implements I { one, two }
|
||||
|
||||
enum E3 implements I? {
|
||||
one,
|
||||
two;
|
||||
|
||||
void foo() {}
|
||||
}
|
||||
|
||||
enum E4 {
|
||||
one,
|
||||
two;
|
||||
|
||||
void foo() {}
|
||||
}
|
||||
|
||||
main() {}
|
||||
test(E1 e1, E2 e2, E3 e3, E4 e4) {}
|
||||
@@ -1,15 +1,21 @@
|
||||
class A {
|
||||
String get foo => "foo";
|
||||
}
|
||||
|
||||
class B {
|
||||
int bar() => 42;
|
||||
}
|
||||
|
||||
mixin M {
|
||||
void set callOnAssignment(void Function() f) {}
|
||||
}
|
||||
|
||||
enum E1 with A { one, two }
|
||||
|
||||
enum E2 with A, B { one, two }
|
||||
|
||||
enum E3 with M { one, two }
|
||||
|
||||
expectEquals(x, y) {}
|
||||
expectThrows(void Function() f) {}
|
||||
void throwOnCall() {}
|
||||
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
class A {
|
||||
String get foo => "foo";
|
||||
}
|
||||
|
||||
class B {
|
||||
int bar() => 42;
|
||||
}
|
||||
|
||||
enum E1 with A { one, two }
|
||||
|
||||
enum E2 with A, B { one, two }
|
||||
|
||||
enum E3 with M { one, two }
|
||||
|
||||
expectEquals(x, y) {}
|
||||
expectThrows(void Function() f) {}
|
||||
main() {}
|
||||
mixin M {
|
||||
void set callOnAssignment(void Function() f) {}
|
||||
}
|
||||
void throwOnCall() {}
|
||||
+15
-2
@@ -1,3 +1,16 @@
|
||||
enum E1 { element; E1(); E1.named(); }
|
||||
enum E2 { one.named1(), two.named2(); const E2.named1() : super(); const E2.named2() : super(42, "42"); }
|
||||
enum E1 {
|
||||
element;
|
||||
|
||||
E1();
|
||||
E1.named();
|
||||
}
|
||||
|
||||
enum E2 {
|
||||
one.named1(),
|
||||
two.named2();
|
||||
|
||||
const E2.named1() : super();
|
||||
const E2.named2() : super(42, "42");
|
||||
}
|
||||
|
||||
main() {}
|
||||
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
enum E1 {
|
||||
element;
|
||||
|
||||
E1();
|
||||
E1.named();
|
||||
}
|
||||
|
||||
enum E2 {
|
||||
one.named1(),
|
||||
two.named2();
|
||||
|
||||
const E2.named1() : super();
|
||||
const E2.named2() : super(42, "42");
|
||||
}
|
||||
|
||||
main() {}
|
||||
+7
-1
@@ -1,6 +1,12 @@
|
||||
mixin GM<T> on Enum {}
|
||||
mixin M on Object {}
|
||||
|
||||
abstract class I {}
|
||||
|
||||
abstract class GI<T> {}
|
||||
enum E<S extends num, T extends num> with GM<T>, M implements I, GI<S> { element }
|
||||
|
||||
enum E<S extends num, T extends num> with GM<T>, M implements I, GI<S> {
|
||||
element
|
||||
}
|
||||
|
||||
main() {}
|
||||
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
abstract class GI<T> {}
|
||||
|
||||
abstract class I {}
|
||||
|
||||
enum E<S extends num, T extends num> with GM<T>, M implements I, GI<S> {
|
||||
element
|
||||
}
|
||||
|
||||
main() {}
|
||||
mixin GM<T> on Enum {}
|
||||
mixin M on Object {}
|
||||
@@ -12,4 +12,5 @@ enum Foo {
|
||||
baz,
|
||||
cafebabe,
|
||||
}
|
||||
|
||||
main() {}
|
||||
|
||||
+2
@@ -4,6 +4,7 @@ class Fisk<T> {
|
||||
}
|
||||
|
||||
const int hest = 42;
|
||||
|
||||
enum Foo {
|
||||
@hest
|
||||
bar,
|
||||
@@ -11,4 +12,5 @@ enum Foo {
|
||||
baz,
|
||||
cafebabe,
|
||||
}
|
||||
|
||||
main() {}
|
||||
|
||||
@@ -15,4 +15,5 @@ enum E {
|
||||
_Enum,
|
||||
List,
|
||||
}
|
||||
|
||||
main() {}
|
||||
|
||||
+1
@@ -15,4 +15,5 @@ enum E {
|
||||
_Enum,
|
||||
List,
|
||||
}
|
||||
|
||||
main() {}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import 'main_lib.dart';
|
||||
|
||||
enum Enum1 { a, b, c }
|
||||
|
||||
typedef Alias1 = Enum1;
|
||||
test() {}
|
||||
main() {}
|
||||
|
||||
+1
@@ -1,6 +1,7 @@
|
||||
import 'main_lib.dart';
|
||||
|
||||
enum Enum1 { a, b, c }
|
||||
|
||||
main() {}
|
||||
test() {}
|
||||
typedef Alias1 = Enum1;
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
// @dart = 2.9
|
||||
const a = null;
|
||||
|
||||
@a
|
||||
enum E { E1, E2, E3 }
|
||||
|
||||
main() {}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
// @dart = 2.9
|
||||
const a = null;
|
||||
|
||||
@a
|
||||
enum E { E1, E2, E3 }
|
||||
|
||||
main() {}
|
||||
|
||||
@@ -2,5 +2,6 @@
|
||||
library test;
|
||||
|
||||
enum E { v1 }
|
||||
|
||||
final x = E.v1;
|
||||
main() {}
|
||||
|
||||
+1
@@ -2,5 +2,6 @@
|
||||
library test;
|
||||
|
||||
enum E { v1 }
|
||||
|
||||
final x = E.v1;
|
||||
main() {}
|
||||
|
||||
+1
@@ -2,5 +2,6 @@
|
||||
library test;
|
||||
|
||||
enum E { v1 }
|
||||
|
||||
final x = E.values;
|
||||
main() {}
|
||||
|
||||
+1
@@ -2,5 +2,6 @@
|
||||
library test;
|
||||
|
||||
enum E { v1 }
|
||||
|
||||
final x = E.values;
|
||||
main() {}
|
||||
|
||||
@@ -12,7 +12,9 @@ Future<int?> returnAsync6() async {}
|
||||
Future<int?> returnAsync7() async {}
|
||||
Iterable yieldSync() sync* {}
|
||||
Stream yieldAsync() async* {}
|
||||
|
||||
enum Enum { a, b }
|
||||
|
||||
Enum caseReturn1(Enum e) {}
|
||||
Enum caseReturn2(Enum e) {}
|
||||
localFunctions() {}
|
||||
|
||||
@@ -13,7 +13,9 @@ Stream yieldAsync() async* {}
|
||||
String returnExplicit() {}
|
||||
String returnImplicit() {}
|
||||
String returnMixed(bool b) {}
|
||||
|
||||
enum Enum { a, b }
|
||||
|
||||
localFunctions() {}
|
||||
main() {}
|
||||
returnAsync5() async {}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
enum Enum { e1, e2 }
|
||||
|
||||
int method1(Enum? e) {}
|
||||
int method2(Enum? e) {}
|
||||
int method3(Enum? e) {}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
enum Enum { e1, e2 }
|
||||
|
||||
expect(expected, actual) {}
|
||||
int method1(Enum? e) {}
|
||||
int method2(Enum? e) {}
|
||||
|
||||
@@ -3,4 +3,5 @@ enum Foo {
|
||||
ec1,
|
||||
ec2,
|
||||
}
|
||||
|
||||
main() {}
|
||||
|
||||
@@ -3,4 +3,5 @@ enum Foo {
|
||||
ec1,
|
||||
ec2,
|
||||
}
|
||||
|
||||
main() {}
|
||||
|
||||
@@ -2,4 +2,5 @@ enum A {
|
||||
a,
|
||||
b,
|
||||
}
|
||||
|
||||
main() {}
|
||||
|
||||
+1
@@ -2,4 +2,5 @@ enum A {
|
||||
a,
|
||||
b,
|
||||
}
|
||||
|
||||
main() {}
|
||||
|
||||
+8
@@ -1,28 +1,36 @@
|
||||
B1 f1() => throw 42;
|
||||
|
||||
class A1 {
|
||||
var foo = f1();
|
||||
A1(this.foo);
|
||||
}
|
||||
|
||||
class B1 extends A1 {
|
||||
B1(super.foo) : super();
|
||||
}
|
||||
|
||||
class A2 {
|
||||
var foo = B2.new;
|
||||
A2(this.foo);
|
||||
}
|
||||
|
||||
class B2 extends A2 {
|
||||
B2(super.foo) : super();
|
||||
}
|
||||
|
||||
class A3 {
|
||||
var foo = C3.new;
|
||||
A3();
|
||||
A3.initializeFoo(this.foo);
|
||||
}
|
||||
|
||||
class B3 extends A3 {
|
||||
var bar = A3.initializeFoo;
|
||||
B3(this.bar) : super();
|
||||
}
|
||||
|
||||
class C3 extends B3 {
|
||||
C3(super.bar) : super();
|
||||
}
|
||||
|
||||
main() {}
|
||||
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
B1 f1() => throw 42;
|
||||
|
||||
class A1 {
|
||||
A1(this.foo);
|
||||
var foo = f1();
|
||||
}
|
||||
|
||||
class A2 {
|
||||
A2(this.foo);
|
||||
var foo = B2.new;
|
||||
}
|
||||
|
||||
class A3 {
|
||||
A3();
|
||||
A3.initializeFoo(this.foo);
|
||||
var foo = C3.new;
|
||||
}
|
||||
|
||||
class B1 extends A1 {
|
||||
B1(super.foo) : super();
|
||||
}
|
||||
|
||||
class B2 extends A2 {
|
||||
B2(super.foo) : super();
|
||||
}
|
||||
|
||||
class B3 extends A3 {
|
||||
B3(this.bar) : super();
|
||||
var bar = A3.initializeFoo;
|
||||
}
|
||||
|
||||
class C3 extends B3 {
|
||||
C3(super.bar) : super();
|
||||
}
|
||||
|
||||
main() {}
|
||||
@@ -2,97 +2,122 @@ class S1 {
|
||||
int s;
|
||||
S1([int x = 0]) : s = x - 1;
|
||||
}
|
||||
|
||||
class C1 extends S1 {
|
||||
int c;
|
||||
C1([super.x]) : c = x + 1;
|
||||
}
|
||||
|
||||
class S2 {
|
||||
int s;
|
||||
S2({int x = 0}) : s = x - 1;
|
||||
}
|
||||
|
||||
class C2 extends S2 {
|
||||
int c;
|
||||
C2({super.x}) : c = x + 1;
|
||||
}
|
||||
|
||||
class S3 {
|
||||
int s;
|
||||
S3([int x = 0]) : s = x - 1;
|
||||
}
|
||||
|
||||
class C3 extends S3 {
|
||||
int c;
|
||||
C3([super.x = 42]) : c = x + 1;
|
||||
}
|
||||
|
||||
class S4 {
|
||||
int s;
|
||||
S4({int x = 0}) : s = x - 1;
|
||||
}
|
||||
|
||||
class C4 extends S4 {
|
||||
int c;
|
||||
C4({super.x = 42}) : c = x + 1;
|
||||
}
|
||||
|
||||
class S5 {
|
||||
num a;
|
||||
S5([num x = 3.14]) : a = x - 1;
|
||||
}
|
||||
|
||||
class C5 extends S5 {
|
||||
C5([int super.x]);
|
||||
}
|
||||
|
||||
class S6 {
|
||||
num? a;
|
||||
S6([num? x = 3.14]) : a = x;
|
||||
}
|
||||
|
||||
class C6 extends S6 {
|
||||
int? b;
|
||||
C6([int? super.x]);
|
||||
}
|
||||
|
||||
class S7 {
|
||||
int s;
|
||||
S7([int x = 0]) : s = x - 1;
|
||||
}
|
||||
|
||||
class C7 extends S7 {
|
||||
int c;
|
||||
C7([super.x]) : c = x + 1;
|
||||
}
|
||||
|
||||
class CC7 extends C7 {
|
||||
int cc;
|
||||
CC7([super.x]) : cc = x * 1;
|
||||
}
|
||||
|
||||
class S8 {
|
||||
int s;
|
||||
S8([int x = 0]) : s = x - 1;
|
||||
}
|
||||
|
||||
class CC8 extends C8 {
|
||||
int cc;
|
||||
CC8([super.x]) : cc = x * 1;
|
||||
}
|
||||
|
||||
class C8 extends S8 {
|
||||
int c;
|
||||
C8([super.x]) : c = x + 1;
|
||||
}
|
||||
|
||||
class CC9 extends C9 {
|
||||
int cc;
|
||||
CC9([super.x]) : cc = x * 1;
|
||||
}
|
||||
|
||||
class C9 extends S9 {
|
||||
int c;
|
||||
C9([super.x]) : c = x + 1;
|
||||
}
|
||||
|
||||
class S9 {
|
||||
int s;
|
||||
S9([int x = 0]) : s = x - 1;
|
||||
}
|
||||
|
||||
class Ap {
|
||||
Ap([num x = 3.14]);
|
||||
}
|
||||
|
||||
class Bp extends Ap {
|
||||
Bp([int super.x]);
|
||||
Bp.req(int super.x);
|
||||
}
|
||||
|
||||
class An {
|
||||
An({num x = 3.14});
|
||||
}
|
||||
|
||||
class Bn extends An {
|
||||
Bn({int super.x});
|
||||
Bn.req({required int super.x});
|
||||
}
|
||||
|
||||
main() {}
|
||||
|
||||
+123
@@ -0,0 +1,123 @@
|
||||
class An {
|
||||
An({num x = 3.14});
|
||||
}
|
||||
|
||||
class Ap {
|
||||
Ap([num x = 3.14]);
|
||||
}
|
||||
|
||||
class Bn extends An {
|
||||
Bn({int super.x});
|
||||
Bn.req({required int super.x});
|
||||
}
|
||||
|
||||
class Bp extends Ap {
|
||||
Bp([int super.x]);
|
||||
Bp.req(int super.x);
|
||||
}
|
||||
|
||||
class C1 extends S1 {
|
||||
C1([super.x]) : c = x + 1;
|
||||
int c;
|
||||
}
|
||||
|
||||
class C2 extends S2 {
|
||||
C2({super.x}) : c = x + 1;
|
||||
int c;
|
||||
}
|
||||
|
||||
class C3 extends S3 {
|
||||
C3([super.x = 42]) : c = x + 1;
|
||||
int c;
|
||||
}
|
||||
|
||||
class C4 extends S4 {
|
||||
C4({super.x = 42}) : c = x + 1;
|
||||
int c;
|
||||
}
|
||||
|
||||
class C5 extends S5 {
|
||||
C5([int super.x]);
|
||||
}
|
||||
|
||||
class C6 extends S6 {
|
||||
C6([int? super.x]);
|
||||
int? b;
|
||||
}
|
||||
|
||||
class C7 extends S7 {
|
||||
C7([super.x]) : c = x + 1;
|
||||
int c;
|
||||
}
|
||||
|
||||
class C8 extends S8 {
|
||||
C8([super.x]) : c = x + 1;
|
||||
int c;
|
||||
}
|
||||
|
||||
class C9 extends S9 {
|
||||
C9([super.x]) : c = x + 1;
|
||||
int c;
|
||||
}
|
||||
|
||||
class CC7 extends C7 {
|
||||
CC7([super.x]) : cc = x * 1;
|
||||
int cc;
|
||||
}
|
||||
|
||||
class CC8 extends C8 {
|
||||
CC8([super.x]) : cc = x * 1;
|
||||
int cc;
|
||||
}
|
||||
|
||||
class CC9 extends C9 {
|
||||
CC9([super.x]) : cc = x * 1;
|
||||
int cc;
|
||||
}
|
||||
|
||||
class S1 {
|
||||
S1([int x = 0]) : s = x - 1;
|
||||
int s;
|
||||
}
|
||||
|
||||
class S2 {
|
||||
S2({int x = 0}) : s = x - 1;
|
||||
int s;
|
||||
}
|
||||
|
||||
class S3 {
|
||||
S3([int x = 0]) : s = x - 1;
|
||||
int s;
|
||||
}
|
||||
|
||||
class S4 {
|
||||
S4({int x = 0}) : s = x - 1;
|
||||
int s;
|
||||
}
|
||||
|
||||
class S5 {
|
||||
S5([num x = 3.14]) : a = x - 1;
|
||||
num a;
|
||||
}
|
||||
|
||||
class S6 {
|
||||
S6([num? x = 3.14]) : a = x;
|
||||
num? a;
|
||||
}
|
||||
|
||||
class S7 {
|
||||
S7([int x = 0]) : s = x - 1;
|
||||
int s;
|
||||
}
|
||||
|
||||
class S8 {
|
||||
S8([int x = 0]) : s = x - 1;
|
||||
int s;
|
||||
}
|
||||
|
||||
class S9 {
|
||||
S9([int x = 0]) : s = x - 1;
|
||||
int s;
|
||||
}
|
||||
|
||||
main() {}
|
||||
@@ -1,8 +1,10 @@
|
||||
class A {
|
||||
A(num a);
|
||||
}
|
||||
|
||||
class B extends A {
|
||||
B.sub1(int super.a1);
|
||||
B.sub2(double super.a2);
|
||||
}
|
||||
|
||||
main() {}
|
||||
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
class A {
|
||||
A(num a);
|
||||
}
|
||||
|
||||
class B extends A {
|
||||
B.sub1(int super.a1);
|
||||
B.sub2(double super.a2);
|
||||
}
|
||||
|
||||
main() {}
|
||||
@@ -3,21 +3,52 @@ class S1 {
|
||||
int s2;
|
||||
S1(this.s1, [this.s2 = 42]);
|
||||
}
|
||||
|
||||
class C1 extends S1 {
|
||||
int i1;
|
||||
int i2;
|
||||
C1(this.i1, super.s1, int x, [super.s2]) : this.i2 = x;
|
||||
}
|
||||
|
||||
class S2 {
|
||||
S2({String one = "1", bool two = false, int three = 3, double four = 4, num five = 3.14, List<String> six = const ["six"]});
|
||||
S2(
|
||||
{String one = "1",
|
||||
bool two = false,
|
||||
int three = 3,
|
||||
double four = 4,
|
||||
num five = 3.14,
|
||||
List<String> six = const ["six"]});
|
||||
}
|
||||
|
||||
class C21 extends S2 {
|
||||
C21({dynamic foo, super.one, dynamic bar, dynamic baz, super.three, super.five});
|
||||
C21(
|
||||
{dynamic foo,
|
||||
super.one,
|
||||
dynamic bar,
|
||||
dynamic baz,
|
||||
super.three,
|
||||
super.five});
|
||||
}
|
||||
|
||||
class C22 extends S2 {
|
||||
C22({dynamic foo, super.six, dynamic bar, dynamic baz, super.four, super.two});
|
||||
C22(
|
||||
{dynamic foo,
|
||||
super.six,
|
||||
dynamic bar,
|
||||
dynamic baz,
|
||||
super.four,
|
||||
super.two});
|
||||
}
|
||||
|
||||
class C23 extends S2 {
|
||||
C23({super.three, dynamic foo, super.one, super.four, dynamic bar, super.two, dynamic baz});
|
||||
C23(
|
||||
{super.three,
|
||||
dynamic foo,
|
||||
super.one,
|
||||
super.four,
|
||||
dynamic bar,
|
||||
super.two,
|
||||
dynamic baz});
|
||||
}
|
||||
|
||||
main() {}
|
||||
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
class C1 extends S1 {
|
||||
C1(this.i1, super.s1, int x, [super.s2]) : this.i2 = x;
|
||||
int i1;
|
||||
int i2;
|
||||
}
|
||||
|
||||
class C21 extends S2 {
|
||||
C21(
|
||||
{dynamic foo,
|
||||
super.one,
|
||||
dynamic bar,
|
||||
dynamic baz,
|
||||
super.three,
|
||||
super.five});
|
||||
}
|
||||
|
||||
class C22 extends S2 {
|
||||
C22(
|
||||
{dynamic foo,
|
||||
super.six,
|
||||
dynamic bar,
|
||||
dynamic baz,
|
||||
super.four,
|
||||
super.two});
|
||||
}
|
||||
|
||||
class C23 extends S2 {
|
||||
C23(
|
||||
{super.three,
|
||||
dynamic foo,
|
||||
super.one,
|
||||
super.four,
|
||||
dynamic bar,
|
||||
super.two,
|
||||
dynamic baz});
|
||||
}
|
||||
|
||||
class S1 {
|
||||
S1(this.s1, [this.s2 = 42]);
|
||||
int s1;
|
||||
int s2;
|
||||
}
|
||||
|
||||
class S2 {
|
||||
S2(
|
||||
{String one = "1",
|
||||
bool two = false,
|
||||
int three = 3,
|
||||
double four = 4,
|
||||
num five = 3.14,
|
||||
List<String> six = const ["six"]});
|
||||
}
|
||||
|
||||
main() {}
|
||||
@@ -4,9 +4,11 @@ class S<T> {
|
||||
S(this.n, this.t);
|
||||
S.named(this.t, this.n);
|
||||
}
|
||||
|
||||
class C<T> extends S<T> {
|
||||
C.constr1(super.n, String s, super.t);
|
||||
C.constr2(int i, super.n, String s, super.t) : super();
|
||||
C.constr3(int i, super.t, String s, super.n) : super.named();
|
||||
}
|
||||
|
||||
main() {}
|
||||
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
class C<T> extends S<T> {
|
||||
C.constr1(super.n, String s, super.t);
|
||||
C.constr2(int i, super.n, String s, super.t) : super();
|
||||
C.constr3(int i, super.t, String s, super.n) : super.named();
|
||||
}
|
||||
|
||||
class S<T> {
|
||||
S(this.n, this.t);
|
||||
S.named(this.t, this.n);
|
||||
T t;
|
||||
num n;
|
||||
}
|
||||
|
||||
main() {}
|
||||
@@ -2,7 +2,9 @@ class A {
|
||||
final int foo;
|
||||
A(this.foo);
|
||||
}
|
||||
|
||||
class B extends A {
|
||||
B(super.foo);
|
||||
}
|
||||
|
||||
main() {}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
class A {
|
||||
A(this.foo);
|
||||
final int foo;
|
||||
}
|
||||
|
||||
class B extends A {
|
||||
B(super.foo);
|
||||
}
|
||||
|
||||
main() {}
|
||||
@@ -5,18 +5,22 @@ class A1 {
|
||||
A1.named2(int foo) : foo = foo;
|
||||
A1.named3({required int foo}) : foo = foo;
|
||||
}
|
||||
|
||||
class B1 extends A1 {
|
||||
B1(super.foo);
|
||||
B1.named(super.foo) : super.named();
|
||||
B1.named2(super.foo) : super.named2();
|
||||
B1.named3({required super.foo}) : super.named3();
|
||||
}
|
||||
|
||||
class A2 {
|
||||
final int foo;
|
||||
final String bar;
|
||||
A2({required int this.foo, required String this.bar});
|
||||
}
|
||||
|
||||
class B2 extends A2 {
|
||||
B2({required super.bar, required super.foo});
|
||||
}
|
||||
|
||||
main() {}
|
||||
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
class A1 {
|
||||
A1(this.foo);
|
||||
A1.named(this.foo);
|
||||
A1.named2(int foo) : foo = foo;
|
||||
A1.named3({required int foo}) : foo = foo;
|
||||
final int foo;
|
||||
}
|
||||
|
||||
class A2 {
|
||||
A2({required int this.foo, required String this.bar});
|
||||
final String bar;
|
||||
final int foo;
|
||||
}
|
||||
|
||||
class B1 extends A1 {
|
||||
B1(super.foo);
|
||||
B1.named(super.foo) : super.named();
|
||||
B1.named2(super.foo) : super.named2();
|
||||
B1.named3({required super.foo}) : super.named3();
|
||||
}
|
||||
|
||||
class B2 extends A2 {
|
||||
B2({required super.bar, required super.foo});
|
||||
}
|
||||
|
||||
main() {}
|
||||
+6
@@ -2,22 +2,28 @@ class A1 {
|
||||
final int foo;
|
||||
A1({required this.foo});
|
||||
}
|
||||
|
||||
class B1 extends A1 {
|
||||
B1({required super.foo}) : super();
|
||||
}
|
||||
|
||||
class C1 extends A1 {
|
||||
C1({required super.foo}) : super(foo: foo);
|
||||
}
|
||||
|
||||
class A2 {
|
||||
final int foo;
|
||||
final String bar;
|
||||
A2({required this.foo, required this.bar});
|
||||
}
|
||||
|
||||
class B2 extends A2 {
|
||||
B2() : super(foo: 42, bar: "bar", baz: false);
|
||||
}
|
||||
|
||||
class C2 extends A2 {
|
||||
C2({required super.foo}) : super();
|
||||
C2.other({required super.foo}) : super(bar: 'bar');
|
||||
}
|
||||
|
||||
main() {}
|
||||
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
class A1 {
|
||||
A1({required this.foo});
|
||||
final int foo;
|
||||
}
|
||||
|
||||
class A2 {
|
||||
A2({required this.foo, required this.bar});
|
||||
final String bar;
|
||||
final int foo;
|
||||
}
|
||||
|
||||
class B1 extends A1 {
|
||||
B1({required super.foo}) : super();
|
||||
}
|
||||
|
||||
class B2 extends A2 {
|
||||
B2() : super(foo: 42, bar: "bar", baz: false);
|
||||
}
|
||||
|
||||
class C1 extends A1 {
|
||||
C1({required super.foo}) : super(foo: foo);
|
||||
}
|
||||
|
||||
class C2 extends A2 {
|
||||
C2({required super.foo}) : super();
|
||||
C2.other({required super.foo}) : super(bar: 'bar');
|
||||
}
|
||||
|
||||
main() {}
|
||||
+6
@@ -2,21 +2,27 @@ class A1 {
|
||||
final int foo;
|
||||
A1(this.foo);
|
||||
}
|
||||
|
||||
class B1 extends A1 {
|
||||
B1(super.foo) : super();
|
||||
}
|
||||
|
||||
class C1 extends A1 {
|
||||
C1(super.foo) : super(42);
|
||||
}
|
||||
|
||||
class A2 {
|
||||
final int foo;
|
||||
final String bar;
|
||||
A2(this.foo, this.bar);
|
||||
}
|
||||
|
||||
class B2 extends A2 {
|
||||
B2() : super(0, 1, 2);
|
||||
}
|
||||
|
||||
class C2 extends A2 {
|
||||
C2(super.foo) : super();
|
||||
}
|
||||
|
||||
main() {}
|
||||
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
class A1 {
|
||||
A1(this.foo);
|
||||
final int foo;
|
||||
}
|
||||
|
||||
class A2 {
|
||||
A2(this.foo, this.bar);
|
||||
final String bar;
|
||||
final int foo;
|
||||
}
|
||||
|
||||
class B1 extends A1 {
|
||||
B1(super.foo) : super();
|
||||
}
|
||||
|
||||
class B2 extends A2 {
|
||||
B2() : super(0, 1, 2);
|
||||
}
|
||||
|
||||
class C1 extends A1 {
|
||||
C1(super.foo) : super(42);
|
||||
}
|
||||
|
||||
class C2 extends A2 {
|
||||
C2(super.foo) : super();
|
||||
}
|
||||
|
||||
main() {}
|
||||
+2
@@ -3,8 +3,10 @@ class S {
|
||||
int s2;
|
||||
S([this.s1 = 1, this.s2 = 2]);
|
||||
}
|
||||
|
||||
class C extends S {
|
||||
int c1;
|
||||
C(this.c1, [int super.s1, int x = 0, int super.s2]);
|
||||
}
|
||||
|
||||
main() {}
|
||||
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
class C extends S {
|
||||
C(this.c1, [int super.s1, int x = 0, int super.s2]);
|
||||
int c1;
|
||||
}
|
||||
|
||||
class S {
|
||||
S([this.s1 = 1, this.s2 = 2]);
|
||||
int s1;
|
||||
int s2;
|
||||
}
|
||||
|
||||
main() {}
|
||||
+22
@@ -2,53 +2,75 @@ class A1 {
|
||||
final int a;
|
||||
A1(this.a);
|
||||
}
|
||||
|
||||
class B1 {}
|
||||
|
||||
class C1 = A1 with B1;
|
||||
|
||||
class D1 extends C1 {
|
||||
D1(super.a);
|
||||
}
|
||||
|
||||
class A2 {
|
||||
final int a;
|
||||
A2({this.a = 0});
|
||||
}
|
||||
|
||||
class B2 {}
|
||||
|
||||
class C2 = A2 with B2;
|
||||
|
||||
class D2 extends C2 {
|
||||
D2({super.a});
|
||||
}
|
||||
|
||||
class A3 {
|
||||
final int a;
|
||||
A3([this.a = 0]);
|
||||
}
|
||||
|
||||
class B3 {}
|
||||
|
||||
class C3 = A3 with B3;
|
||||
|
||||
class D3 extends C3 {
|
||||
D3([super.a]);
|
||||
}
|
||||
|
||||
class D4 extends C4 {
|
||||
D4([super.foo]);
|
||||
}
|
||||
|
||||
class C4 = A4 with B4;
|
||||
|
||||
class B4 {}
|
||||
|
||||
class A4 extends AA4 {
|
||||
A4([super.foo]);
|
||||
}
|
||||
|
||||
class AA4 {
|
||||
final int foo;
|
||||
AA4([this.foo = 42]);
|
||||
}
|
||||
|
||||
class D5 extends C5c {
|
||||
D5([super.foo]);
|
||||
}
|
||||
|
||||
class C5c = C5b with B5;
|
||||
class C5b = C5a with B5;
|
||||
class C5a = A5 with B5;
|
||||
|
||||
class B5 {}
|
||||
|
||||
class A5 extends AA5 {
|
||||
A5([super.foo]);
|
||||
}
|
||||
|
||||
class AA5 {
|
||||
final int foo;
|
||||
AA5([this.foo = 42]);
|
||||
}
|
||||
|
||||
main() {}
|
||||
|
||||
+72
@@ -0,0 +1,72 @@
|
||||
class A1 {
|
||||
A1(this.a);
|
||||
final int a;
|
||||
}
|
||||
|
||||
class A2 {
|
||||
A2({this.a = 0});
|
||||
final int a;
|
||||
}
|
||||
|
||||
class A3 {
|
||||
A3([this.a = 0]);
|
||||
final int a;
|
||||
}
|
||||
|
||||
class A4 extends AA4 {
|
||||
A4([super.foo]);
|
||||
}
|
||||
|
||||
class A5 extends AA5 {
|
||||
A5([super.foo]);
|
||||
}
|
||||
|
||||
class AA4 {
|
||||
AA4([this.foo = 42]);
|
||||
final int foo;
|
||||
}
|
||||
|
||||
class AA5 {
|
||||
AA5([this.foo = 42]);
|
||||
final int foo;
|
||||
}
|
||||
|
||||
class B1 {}
|
||||
|
||||
class B2 {}
|
||||
|
||||
class B3 {}
|
||||
|
||||
class B4 {}
|
||||
|
||||
class B5 {}
|
||||
|
||||
class C1 = A1 with B1;
|
||||
class C2 = A2 with B2;
|
||||
class C3 = A3 with B3;
|
||||
class C4 = A4 with B4;
|
||||
class C5a = A5 with B5;
|
||||
class C5b = C5a with B5;
|
||||
class C5c = C5b with B5;
|
||||
|
||||
class D1 extends C1 {
|
||||
D1(super.a);
|
||||
}
|
||||
|
||||
class D2 extends C2 {
|
||||
D2({super.a});
|
||||
}
|
||||
|
||||
class D3 extends C3 {
|
||||
D3([super.a]);
|
||||
}
|
||||
|
||||
class D4 extends C4 {
|
||||
D4([super.foo]);
|
||||
}
|
||||
|
||||
class D5 extends C5c {
|
||||
D5([super.foo]);
|
||||
}
|
||||
|
||||
main() {}
|
||||
+12
@@ -2,44 +2,56 @@ class A1 {
|
||||
final String foo;
|
||||
A1(this.foo);
|
||||
}
|
||||
|
||||
typedef TA1 = A1;
|
||||
typedef TTA1 = TA1;
|
||||
typedef TTTA1 = TTA1;
|
||||
typedef TTTTA1 = TTTA1;
|
||||
|
||||
class D1 extends TTTTA1 {
|
||||
D1(super.foo);
|
||||
}
|
||||
|
||||
class A2 {
|
||||
final String foo;
|
||||
A2({this.foo = "bar"});
|
||||
}
|
||||
|
||||
typedef TA2 = A2;
|
||||
typedef TTA2 = TA2;
|
||||
typedef TTTA2 = TTA2;
|
||||
typedef TTTTA2 = TTTA2;
|
||||
|
||||
class D2 extends TTTTA2 {
|
||||
D2({super.foo});
|
||||
}
|
||||
|
||||
class A3 {
|
||||
final String foo;
|
||||
A3([this.foo = "bar"]);
|
||||
}
|
||||
|
||||
typedef TA3 = A3;
|
||||
typedef TTA3 = TA3;
|
||||
typedef TTTA3 = TTA3;
|
||||
typedef TTTTA3 = TTTA3;
|
||||
|
||||
class D3 extends TTTTA3 {
|
||||
D3([super.foo]);
|
||||
}
|
||||
|
||||
class D4 extends TTTTA4 {
|
||||
D4([super.foo]);
|
||||
}
|
||||
|
||||
typedef TTTTA4 = TTTA4;
|
||||
typedef TTTA4 = TTA4;
|
||||
typedef TTA4 = TA4;
|
||||
typedef TA4 = A4;
|
||||
|
||||
class A4 {
|
||||
final String foo;
|
||||
A4([this.foo = "bar"]);
|
||||
}
|
||||
|
||||
main() {}
|
||||
|
||||
+53
@@ -0,0 +1,53 @@
|
||||
class A1 {
|
||||
A1(this.foo);
|
||||
final String foo;
|
||||
}
|
||||
|
||||
class A2 {
|
||||
A2({this.foo = "bar"});
|
||||
final String foo;
|
||||
}
|
||||
|
||||
class A3 {
|
||||
A3([this.foo = "bar"]);
|
||||
final String foo;
|
||||
}
|
||||
|
||||
class A4 {
|
||||
A4([this.foo = "bar"]);
|
||||
final String foo;
|
||||
}
|
||||
|
||||
class D1 extends TTTTA1 {
|
||||
D1(super.foo);
|
||||
}
|
||||
|
||||
class D2 extends TTTTA2 {
|
||||
D2({super.foo});
|
||||
}
|
||||
|
||||
class D3 extends TTTTA3 {
|
||||
D3([super.foo]);
|
||||
}
|
||||
|
||||
class D4 extends TTTTA4 {
|
||||
D4([super.foo]);
|
||||
}
|
||||
|
||||
main() {}
|
||||
typedef TA1 = A1;
|
||||
typedef TA2 = A2;
|
||||
typedef TA3 = A3;
|
||||
typedef TA4 = A4;
|
||||
typedef TTA1 = TA1;
|
||||
typedef TTA2 = TA2;
|
||||
typedef TTA3 = TA3;
|
||||
typedef TTA4 = TA4;
|
||||
typedef TTTA1 = TTA1;
|
||||
typedef TTTA2 = TTA2;
|
||||
typedef TTTA3 = TTA3;
|
||||
typedef TTTA4 = TTA4;
|
||||
typedef TTTTA1 = TTTA1;
|
||||
typedef TTTTA2 = TTTA2;
|
||||
typedef TTTTA3 = TTTA3;
|
||||
typedef TTTTA4 = TTTA4;
|
||||
+10
@@ -2,35 +2,45 @@ class A1 {
|
||||
final int foo;
|
||||
A1(int this.foo);
|
||||
}
|
||||
|
||||
class B1 extends A1 {
|
||||
B1(int super.foo);
|
||||
}
|
||||
|
||||
class A2 {
|
||||
final int Function(int) foo;
|
||||
A2(int Function(int) this.foo);
|
||||
}
|
||||
|
||||
class B2 extends A2 {
|
||||
B2(int Function(int) super.foo);
|
||||
}
|
||||
|
||||
class A3 {
|
||||
final int Function(int) foo;
|
||||
A3(int this.foo(int));
|
||||
}
|
||||
|
||||
class B3 extends A3 {
|
||||
B3(int super.foo(int));
|
||||
}
|
||||
|
||||
class A4 {
|
||||
final void Function() Function(void Function()) foo;
|
||||
A4(void Function() this.foo(void Function()));
|
||||
}
|
||||
|
||||
class B4 extends A4 {
|
||||
B4(void Function() super.foo(void Function()));
|
||||
}
|
||||
|
||||
class A5 {
|
||||
final void Function() Function(void Function()) foo;
|
||||
A5(void Function() Function(void Function()) this.foo);
|
||||
}
|
||||
|
||||
class B5 extends A5 {
|
||||
B5(void Function() Function(void Function()) super.foo);
|
||||
}
|
||||
|
||||
main() {}
|
||||
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
class A1 {
|
||||
A1(int this.foo);
|
||||
final int foo;
|
||||
}
|
||||
|
||||
class A2 {
|
||||
A2(int Function(int) this.foo);
|
||||
final int Function(int) foo;
|
||||
}
|
||||
|
||||
class A3 {
|
||||
A3(int this.foo(int));
|
||||
final int Function(int) foo;
|
||||
}
|
||||
|
||||
class A4 {
|
||||
A4(void Function() this.foo(void Function()));
|
||||
final void Function() Function(void Function()) foo;
|
||||
}
|
||||
|
||||
class A5 {
|
||||
A5(void Function() Function(void Function()) this.foo);
|
||||
final void Function() Function(void Function()) foo;
|
||||
}
|
||||
|
||||
class B1 extends A1 {
|
||||
B1(int super.foo);
|
||||
}
|
||||
|
||||
class B2 extends A2 {
|
||||
B2(int Function(int) super.foo);
|
||||
}
|
||||
|
||||
class B3 extends A3 {
|
||||
B3(int super.foo(int));
|
||||
}
|
||||
|
||||
class B4 extends A4 {
|
||||
B4(void Function() super.foo(void Function()));
|
||||
}
|
||||
|
||||
class B5 extends A5 {
|
||||
B5(void Function() Function(void Function()) super.foo);
|
||||
}
|
||||
|
||||
main() {}
|
||||
@@ -28,30 +28,8 @@ constructor_tearoffs/issue47075: FormatterCrash
|
||||
constructor_tearoffs/new_as_selector: FormatterCrash
|
||||
dart2js/late_fields: FormatterCrash
|
||||
dart2js/late_statics: FormatterCrash
|
||||
enhanced_enums/conflicting_elements: FormatterCrash
|
||||
enhanced_enums/constructor_calls: FormatterCrash
|
||||
enhanced_enums/constructor_not_found: FormatterCrash
|
||||
enhanced_enums/declared_values: FormatterCrash
|
||||
enhanced_enums/entries_with_type_arguments: FormatterCrash
|
||||
enhanced_enums/enum_as_supertype: FormatterCrash
|
||||
enhanced_enums/inference_in_constructor_parameters: FormatterCrash
|
||||
enhanced_enums/instantiated_generic_enum_types: FormatterCrash
|
||||
enhanced_enums/issue48084: FormatterCrash
|
||||
enhanced_enums/issue48181: FormatterCrash
|
||||
enhanced_enums/issue48232: FormatterCrash
|
||||
enhanced_enums/issue48303: FormatterCrash
|
||||
enhanced_enums/malformed_constructors: FormatterCrash
|
||||
enhanced_enums/members: FormatterCrash
|
||||
enhanced_enums/named_arguments: FormatterCrash
|
||||
enhanced_enums/named_arguments_anywhere/redirecting_constructor: FormatterCrash
|
||||
enhanced_enums/qualified_names_with_no_type_arguments: FormatterCrash
|
||||
enhanced_enums/recovery_in_elements: FormatterCrash
|
||||
enhanced_enums/redirecting_initializers: FormatterCrash
|
||||
enhanced_enums/simple_fields: FormatterCrash
|
||||
enhanced_enums/simple_interfaces: FormatterCrash
|
||||
enhanced_enums/simple_mixins: FormatterCrash
|
||||
enhanced_enums/super_parameters/malformed_constructors: FormatterCrash
|
||||
enhanced_enums/supertype_resolved_before_checking: FormatterCrash
|
||||
extension_types/basic_show: FormatterCrash
|
||||
extension_types/call_not_get: FormatterCrash
|
||||
extension_types/keyword_in_show_hide_element: FormatterCrash
|
||||
@@ -231,22 +209,8 @@ regress/issue_37285: FormatterCrash
|
||||
regress/issue_39091_1: FormatterCrash
|
||||
regress/issue_41265.crash: Crash
|
||||
regress/issue_41265.crash: FormatterCrash
|
||||
super_parameters/circular_dependency_inference: FormatterCrash
|
||||
super_parameters/default_values: FormatterCrash
|
||||
super_parameters/issue47741: FormatterCrash
|
||||
super_parameters/issue47922: FormatterCrash
|
||||
super_parameters/issue47951: FormatterCrash
|
||||
super_parameters/issue48142: FormatterCrash
|
||||
super_parameters/issue48286: FormatterCrash
|
||||
super_parameters/simple: FormatterCrash
|
||||
super_parameters/simple_inference: FormatterCrash
|
||||
super_parameters/simple_named_super_parameters: FormatterCrash
|
||||
super_parameters/simple_positional_super_parameters: FormatterCrash
|
||||
super_parameters/super_parameters_with_types_and_default_values: FormatterCrash
|
||||
super_parameters/synthesized_super_constructor_with_parameters: FormatterCrash
|
||||
super_parameters/type_alias_in_supertype: FormatterCrash
|
||||
super_parameters/typed_super_parameter: FormatterCrash
|
||||
super_parameters/typed_super_parameters: FormatterCrash
|
||||
triple_shift/invalid_operator: FormatterCrash
|
||||
variance/class_type_parameter_modifier: FormatterCrash
|
||||
variance/generic_covariance_sound_variance: FormatterCrash
|
||||
|
||||
@@ -104,8 +104,8 @@ void main() {
|
||||
Expect.equals(0, EnumAll.v1.instanceMethod());
|
||||
Expect.identical(EnumAll.v4, EnumAll.v3 ^ EnumAll.v2);
|
||||
|
||||
Expect.equals("EnumAll.v1:EnumMixin<num>:ObjectMixin:this",
|
||||
EnumAll.v1.thisAndSuper());
|
||||
Expect.equals(
|
||||
"EnumAll.v1:EnumMixin<num>:ObjectMixin:this", EnumAll.v1.thisAndSuper());
|
||||
|
||||
// Which can reference type parameters.
|
||||
Expect.isTrue(EnumAll.v2.test(2)); // does `is T` with `T` being `int`.
|
||||
@@ -157,13 +157,18 @@ enum EnumPlainTrailingComma {
|
||||
// Also if using type parameters, mixins or interfaces.
|
||||
// It only matters whether there is something after the values.
|
||||
enum EnumNoSemicolon<T extends num> with ObjectMixin implements Interface {
|
||||
v1, v2, v3
|
||||
v1,
|
||||
v2,
|
||||
v3
|
||||
}
|
||||
|
||||
|
||||
// Allows semicolon after values, even when not needed.
|
||||
// Without trailing comma.
|
||||
enum EnumPlainSemicolon { v1, v2, v3; }
|
||||
enum EnumPlainSemicolon {
|
||||
v1,
|
||||
v2,
|
||||
v3;
|
||||
}
|
||||
|
||||
// With trailing comma.
|
||||
enum EnumPlainTrailingCommaSemicolon {
|
||||
@@ -202,6 +207,7 @@ enum EnumAll<S extends num, T extends num>
|
||||
static late var sLateVarInit = v3;
|
||||
static EnumAll? sVar;
|
||||
static EnumAll sVarInit = v3;
|
||||
|
||||
/// Static getters, setters and methods
|
||||
static EnumAll<int, int> get staticGetSet => v3;
|
||||
static set staticGetSet(EnumAll<int, int> _) {}
|
||||
@@ -210,10 +216,13 @@ enum EnumAll<S extends num, T extends num>
|
||||
// Constructors.
|
||||
// Generative, non-redirecting, unnamed.
|
||||
const EnumAll({T? y})
|
||||
: constructor = "unnamed", this.x = 0 as S, y = y ?? (0 as T);
|
||||
: constructor = "unnamed",
|
||||
this.x = 0 as S,
|
||||
y = y ?? (0 as T);
|
||||
// Generative, non-redirecting, named.
|
||||
const EnumAll.named(this.x, {T? y, String? constructor})
|
||||
: constructor = constructor ?? "named", y = y ?? (0 as T);
|
||||
: constructor = constructor ?? "named",
|
||||
y = y ?? (0 as T);
|
||||
// Generative, redirecting.
|
||||
const EnumAll.renamed(S x, {T? y})
|
||||
: this.named(x, y: y, constructor: "renamed");
|
||||
@@ -266,6 +275,7 @@ extension EnumAllExtension on EnumAll {
|
||||
Expect.fail("Unreachable");
|
||||
return "not";
|
||||
}
|
||||
|
||||
String get extension => "extension";
|
||||
}
|
||||
|
||||
@@ -282,6 +292,7 @@ enum EnumNoUnnamedConstructor {
|
||||
|
||||
enum NewNamedConstructor {
|
||||
v1;
|
||||
|
||||
const NewNamedConstructor.new();
|
||||
}
|
||||
|
||||
@@ -301,13 +312,16 @@ enum Canonical<T> {
|
||||
v1<int>(1),
|
||||
v2<num>(1),
|
||||
v3<num>(1);
|
||||
|
||||
final T value;
|
||||
const Canonical(this.value);
|
||||
}
|
||||
|
||||
// Both `toString` and `index` are inherited from superclass.
|
||||
enum OverrideEnum {
|
||||
v1, v2;
|
||||
v1,
|
||||
v2;
|
||||
|
||||
// Cannot override index
|
||||
int get superIndex => super.index;
|
||||
String toString() => "FakeString";
|
||||
@@ -318,6 +332,7 @@ enum OverrideEnum {
|
||||
enum SelfRefEnum {
|
||||
e1(null),
|
||||
e2(e1);
|
||||
|
||||
final SelfRefEnum? previous;
|
||||
const SelfRefEnum(this.previous);
|
||||
}
|
||||
@@ -343,9 +358,7 @@ mixin GenericEnumMixin<T> on Enum {
|
||||
String toString() => "${super.toString()}:EnumMixin<$T>";
|
||||
}
|
||||
|
||||
abstract class Interface {
|
||||
|
||||
}
|
||||
abstract class Interface {}
|
||||
|
||||
abstract class GenericInterface<T> {
|
||||
// Implemented by mixins.
|
||||
|
||||
@@ -150,7 +150,8 @@ abstract class ImplementsEnum implements MyEnum {
|
||||
// [analyzer] COMPILE_TIME_ERROR.IMPLEMENTS_NON_CLASS
|
||||
}
|
||||
|
||||
abstract class MixesInEnum with MyEnum { // It's not a mixin!
|
||||
// It's not a mixin!
|
||||
abstract class MixesInEnum with MyEnum {
|
||||
// ^
|
||||
// [cfe] 'MyEnum' is an enum and can't be extended or implemented.
|
||||
// [cfe] Can't use 'MyEnum' as a mixin because it has constructors.
|
||||
|
||||
@@ -5,13 +5,18 @@
|
||||
import 'package:expect/expect.dart';
|
||||
|
||||
enum Enum1 { _ }
|
||||
|
||||
enum Enum2 { A }
|
||||
|
||||
enum Enum3 { B, C }
|
||||
|
||||
enum Enum4 {
|
||||
D,
|
||||
E,
|
||||
}
|
||||
|
||||
enum Enum5 { F, G, H }
|
||||
|
||||
enum _Enum6 { I, _J }
|
||||
|
||||
enum _IsNot { IsNot }
|
||||
|
||||
@@ -8,6 +8,4 @@
|
||||
// Test that `enum` is considered a keyword and therefore invalid as the name of
|
||||
// declarations.
|
||||
|
||||
main() {
|
||||
|
||||
}
|
||||
main() {}
|
||||
|
||||
@@ -21,5 +21,4 @@ enum Enum1 {
|
||||
main() {
|
||||
Expect.equals('Enum1._A,Enum1._B', Enum1.values.join(','));
|
||||
Expect.equals('Enum2._A,Enum2._B', Enum2.values.join(','));
|
||||
|
||||
}
|
||||
|
||||
@@ -20,6 +20,4 @@ enum Enum1 {
|
||||
|
||||
main() {
|
||||
Expect.equals('Enum1._A,Enum1._B', Enum1.values.join(','));
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -216,8 +216,8 @@ test(dynamic d, Function f, A a) {
|
||||
z: evaluate(false), w: evaluate(3.14));
|
||||
});
|
||||
runAndCheckEvaluationOrder([1, false, "2", 3.14], () {
|
||||
a.property(evaluate(1),
|
||||
z: evaluate(false), evaluate("2"), w: evaluate(3.14));
|
||||
a.property(
|
||||
evaluate(1), z: evaluate(false), evaluate("2"), w: evaluate(3.14));
|
||||
});
|
||||
runAndCheckEvaluationOrder([false, 1, "2", 3.14], () {
|
||||
a.property(
|
||||
@@ -228,8 +228,8 @@ test(dynamic d, Function f, A a) {
|
||||
w: evaluate(3.14), evaluate(1), evaluate("2"), z: evaluate(false));
|
||||
});
|
||||
runAndCheckEvaluationOrder([1, 3.14, "2", false], () {
|
||||
a.property(evaluate(1),
|
||||
w: evaluate(3.14), evaluate("2"), z: evaluate(false));
|
||||
a.property(
|
||||
evaluate(1), w: evaluate(3.14), evaluate("2"), z: evaluate(false));
|
||||
});
|
||||
runAndCheckEvaluationOrder([1, 3.14, "2"], () {
|
||||
a.property(evaluate(1), w: evaluate(3.14), evaluate("2"));
|
||||
@@ -306,8 +306,8 @@ test(dynamic d, Function f, A a) {
|
||||
z: evaluate(false), w: evaluate(3.14));
|
||||
});
|
||||
runAndCheckEvaluationOrder([1, false, "2", 3.14], () {
|
||||
A.redirFactory(evaluate(1),
|
||||
z: evaluate(false), evaluate("2"), w: evaluate(3.14));
|
||||
A.redirFactory(
|
||||
evaluate(1), z: evaluate(false), evaluate("2"), w: evaluate(3.14));
|
||||
});
|
||||
runAndCheckEvaluationOrder([false, 1, "2", 3.14], () {
|
||||
A.redirFactory(
|
||||
@@ -318,8 +318,8 @@ test(dynamic d, Function f, A a) {
|
||||
w: evaluate(3.14), evaluate(1), evaluate("2"), z: evaluate(false));
|
||||
});
|
||||
runAndCheckEvaluationOrder([1, 3.14, "2", false], () {
|
||||
A.redirFactory(evaluate(1),
|
||||
w: evaluate(3.14), evaluate("2"), z: evaluate(false));
|
||||
A.redirFactory(
|
||||
evaluate(1), w: evaluate(3.14), evaluate("2"), z: evaluate(false));
|
||||
});
|
||||
runAndCheckEvaluationOrder([1, 3.14, "2"], () {
|
||||
A.redirFactory(evaluate(1), w: evaluate(3.14), evaluate("2"));
|
||||
@@ -373,8 +373,8 @@ class Test extends A {
|
||||
: super(evaluate(1), evaluate("2"),
|
||||
z: evaluate(false), w: evaluate(3.14));
|
||||
Test.super2()
|
||||
: super(evaluate(1),
|
||||
z: evaluate(false), evaluate("2"), w: evaluate(3.14));
|
||||
: super(
|
||||
evaluate(1), z: evaluate(false), evaluate("2"), w: evaluate(3.14));
|
||||
Test.super3()
|
||||
: super(
|
||||
z: evaluate(false), evaluate(1), evaluate("2"), w: evaluate(3.14));
|
||||
@@ -382,8 +382,8 @@ class Test extends A {
|
||||
: super(
|
||||
w: evaluate(3.14), evaluate(1), evaluate("2"), z: evaluate(false));
|
||||
Test.super5()
|
||||
: super(evaluate(1),
|
||||
w: evaluate(3.14), evaluate("2"), z: evaluate(false));
|
||||
: super(
|
||||
evaluate(1), w: evaluate(3.14), evaluate("2"), z: evaluate(false));
|
||||
Test.super6() : super(evaluate(1), w: evaluate(3.14), evaluate("2"));
|
||||
|
||||
test() {
|
||||
@@ -392,8 +392,8 @@ class Test extends A {
|
||||
z: evaluate(false), w: evaluate(3.14));
|
||||
});
|
||||
runAndCheckEvaluationOrder([1, false, "2", 3.14], () {
|
||||
super.bar(evaluate(1),
|
||||
z: evaluate(false), evaluate("2"), w: evaluate(3.14));
|
||||
super.bar(
|
||||
evaluate(1), z: evaluate(false), evaluate("2"), w: evaluate(3.14));
|
||||
});
|
||||
runAndCheckEvaluationOrder([false, 1, "2", 3.14], () {
|
||||
super.bar(
|
||||
@@ -404,8 +404,8 @@ class Test extends A {
|
||||
w: evaluate(3.14), evaluate(1), evaluate("2"), z: evaluate(false));
|
||||
});
|
||||
runAndCheckEvaluationOrder([1, 3.14, "2", false], () {
|
||||
super.bar(evaluate(1),
|
||||
w: evaluate(3.14), evaluate("2"), z: evaluate(false));
|
||||
super.bar(
|
||||
evaluate(1), w: evaluate(3.14), evaluate("2"), z: evaluate(false));
|
||||
});
|
||||
runAndCheckEvaluationOrder([1, 3.14, "2"], () {
|
||||
super.bar(evaluate(1), w: evaluate(3.14), evaluate("2"));
|
||||
|
||||
@@ -7,13 +7,18 @@
|
||||
import 'package:expect/expect.dart';
|
||||
|
||||
enum Enum1 { _ }
|
||||
|
||||
enum Enum2 { A }
|
||||
|
||||
enum Enum3 { B, C }
|
||||
|
||||
enum Enum4 {
|
||||
D,
|
||||
E,
|
||||
}
|
||||
|
||||
enum Enum5 { F, G, H }
|
||||
|
||||
enum _Enum6 { I, _J }
|
||||
|
||||
enum _IsNot { IsNot }
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user