Reformat tests/language/a-e using 3.8 style.
Change-Id: I5cfab9212bb78809967de323b60ebb06913b84d1 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/425149 Auto-Submit: Bob Nystrom <rnystrom@google.com> Reviewed-by: Lasse Nielsen <lrn@google.com> Commit-Queue: Lasse Nielsen <lrn@google.com>
This commit is contained in:
committed by
Commit Queue
parent
a02d5bb211
commit
361cf93984
@@ -52,17 +52,15 @@ void main() {
|
||||
/// Tests that overriding either the getter or setter with an abstract member
|
||||
/// has no effect.
|
||||
/// Regression test for https://github.com/dart-lang/sdk/issues/29914
|
||||
var c1 =
|
||||
AbstractGetterOverride1()
|
||||
..foo = 123
|
||||
..bar = 456;
|
||||
var c1 = AbstractGetterOverride1()
|
||||
..foo = 123
|
||||
..bar = 456;
|
||||
Expect.equals(c1.foo, 123);
|
||||
Expect.equals(c1.bar, 456);
|
||||
|
||||
var c2 =
|
||||
AbstractGetterOverride2()
|
||||
..foo = 123
|
||||
..bar = 456;
|
||||
var c2 = AbstractGetterOverride2()
|
||||
..foo = 123
|
||||
..bar = 456;
|
||||
Expect.equals(c2.foo, 123);
|
||||
Expect.equals(c2.bar, 456);
|
||||
}
|
||||
|
||||
@@ -96,14 +96,13 @@ void test(int x, int y) {
|
||||
bool assertionsEnabled = false;
|
||||
assert(assertionsEnabled = true);
|
||||
|
||||
void Function(C Function()) doTest =
|
||||
(assertionsEnabled && x >= y)
|
||||
? (f) {
|
||||
Expect.throwsAssertionError(f);
|
||||
}
|
||||
: (f) {
|
||||
Expect.equals(x, f().x);
|
||||
};
|
||||
void Function(C Function()) doTest = (assertionsEnabled && x >= y)
|
||||
? (f) {
|
||||
Expect.throwsAssertionError(f);
|
||||
}
|
||||
: (f) {
|
||||
Expect.equals(x, f().x);
|
||||
};
|
||||
|
||||
doTest(() => new C.c01(x, y));
|
||||
doTest(() => new C.c02(x, y));
|
||||
|
||||
@@ -106,11 +106,11 @@ main() {
|
||||
}
|
||||
};
|
||||
|
||||
Future<A> Function() f_expressionSyntax_B =
|
||||
() async => false ? new A() : new B();
|
||||
Future<A> Function() f_expressionSyntax_B = () async =>
|
||||
false ? new A() : new B();
|
||||
|
||||
Future<A> Function() f_expressionSyntax_FutureB =
|
||||
() async => false ? futureA() : futureB();
|
||||
Future<A> Function() f_expressionSyntax_FutureB = () async =>
|
||||
false ? futureA() : futureB();
|
||||
|
||||
// Not executed
|
||||
void checkStaticTypes() {
|
||||
|
||||
@@ -56,8 +56,9 @@ main() async {
|
||||
|
||||
// Target of a property set
|
||||
(await ((null as Future<B>?) ??
|
||||
(Future.value(C())..expectStaticType<Exactly<Future<C>>>())))
|
||||
.prop = 0;
|
||||
(Future.value(C())..expectStaticType<Exactly<Future<C>>>())))
|
||||
.prop =
|
||||
0;
|
||||
|
||||
// Target of a property get
|
||||
(await ((null as Future<B>?) ??
|
||||
|
||||
@@ -113,7 +113,7 @@ void testIfNull() {
|
||||
bFalse
|
||||
? d
|
||||
: ((c ?? a) // ignore: dead_null_aware_expression
|
||||
..expectStaticType<Exactly<A>>()),
|
||||
..expectStaticType<Exactly<A>>()),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -132,7 +132,7 @@ void testIfNull() {
|
||||
bFalse
|
||||
? d
|
||||
: (((c) ?? a) // ignore: dead_null_aware_expression
|
||||
..expectStaticType<Exactly<A>>()),
|
||||
..expectStaticType<Exactly<A>>()),
|
||||
),
|
||||
);
|
||||
Expect.throws(
|
||||
@@ -145,7 +145,7 @@ void testIfNull() {
|
||||
bFalse
|
||||
? d
|
||||
: ((((c)) ?? a) // ignore: dead_null_aware_expression
|
||||
..expectStaticType<Exactly<A>>()),
|
||||
..expectStaticType<Exactly<A>>()),
|
||||
),
|
||||
);
|
||||
Expect.throws(
|
||||
|
||||
@@ -5,16 +5,14 @@
|
||||
|
||||
import "package:expect/expect.dart";
|
||||
|
||||
makeMap() =>
|
||||
new Map()
|
||||
..[3] = 4
|
||||
..[0] = 11;
|
||||
makeMap() => new Map()
|
||||
..[3] = 4
|
||||
..[0] = 11;
|
||||
|
||||
class MyClass {
|
||||
foo() =>
|
||||
this
|
||||
..bar(3)
|
||||
..baz(4);
|
||||
foo() => this
|
||||
..bar(3)
|
||||
..baz(4);
|
||||
bar(x) => x;
|
||||
baz(y) => y * 2;
|
||||
}
|
||||
|
||||
@@ -14,14 +14,12 @@ class B {
|
||||
final y;
|
||||
|
||||
B(a)
|
||||
: x =
|
||||
a
|
||||
..foo()
|
||||
..bar(),
|
||||
y =
|
||||
a
|
||||
..foo()
|
||||
..bar() {}
|
||||
: x = a
|
||||
..foo()
|
||||
..bar(),
|
||||
y = a
|
||||
..foo()
|
||||
..bar() {}
|
||||
}
|
||||
|
||||
main() {
|
||||
|
||||
@@ -14,10 +14,9 @@ class Bar {
|
||||
}
|
||||
|
||||
main() {
|
||||
var bar =
|
||||
new Bar()
|
||||
..foo = (new Foo()..x = 42)
|
||||
..y = 38;
|
||||
var bar = new Bar()
|
||||
..foo = (new Foo()..x = 42)
|
||||
..y = 38;
|
||||
Expect.isTrue(bar is Bar);
|
||||
Expect.isTrue(bar.foo is Foo);
|
||||
Expect.equals(bar.foo.x, 42);
|
||||
|
||||
@@ -2,11 +2,10 @@
|
||||
// for details. All rights reserved. Use of this source code is governed by a
|
||||
// BSD-style license that can be found in the LICENSE file.
|
||||
|
||||
final List<String> list =
|
||||
[]
|
||||
..add("foo")
|
||||
..add("bar")
|
||||
..add("baz");
|
||||
final List<String> list = []
|
||||
..add("foo")
|
||||
..add("bar")
|
||||
..add("baz");
|
||||
|
||||
main() {
|
||||
print(list);
|
||||
|
||||
@@ -171,19 +171,17 @@ main() {
|
||||
Box originalBox = box;
|
||||
// Should parse as:
|
||||
// box = (box..x = (a.value == 21 ? b : c)..x.test(117));
|
||||
box =
|
||||
box
|
||||
..x = a.value == 21 ? b : c
|
||||
..x.test(117);
|
||||
box = box
|
||||
..x = a.value == 21 ? b : c
|
||||
..x.test(117);
|
||||
Expect.equals(originalBox, box);
|
||||
Expect.equals(box.value, b);
|
||||
|
||||
// New cascades are allowed inside an expressionWithoutCascade if properly
|
||||
// delimited.
|
||||
box
|
||||
..x =
|
||||
(a
|
||||
..set(42)
|
||||
..test(42))
|
||||
..x = (a
|
||||
..set(42)
|
||||
..test(42))
|
||||
..x.test(42);
|
||||
}
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
// Test that class with a cyclic hierarchy doesn't cause a loop in dart2js.
|
||||
|
||||
class A extends A {
|
||||
// ^
|
||||
// [analyzer] COMPILE_TIME_ERROR.RECURSIVE_INTERFACE_INHERITANCE
|
||||
// [cfe] 'A' is a supertype of itself.
|
||||
// ^
|
||||
// [analyzer] COMPILE_TIME_ERROR.RECURSIVE_INTERFACE_INHERITANCE
|
||||
// [cfe] 'A' is a supertype of itself.
|
||||
|
||||
// When checking that foo isn't overriding an instance method in the
|
||||
// superclass, dart2js might loop.
|
||||
|
||||
@@ -16,4 +16,3 @@ class BOutside extends BaseClass {}
|
||||
// ^^^^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.SUBTYPE_OF_BASE_OR_FINAL_IS_NOT_BASE_FINAL_OR_SEALED
|
||||
// [cfe] The type 'BOutside' must be 'base', 'final' or 'sealed' because the supertype 'BaseClass' is 'base'.
|
||||
|
||||
|
||||
@@ -22,4 +22,3 @@ enum EnumOutside implements ClassForEnum { x }
|
||||
// ^^^^^^^^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.INVALID_USE_OF_TYPE_OUTSIDE_LIBRARY
|
||||
// [cfe] The class 'ClassForEnum' can't be implemented outside of its library because it's a base class.
|
||||
|
||||
|
||||
-1
@@ -68,4 +68,3 @@ class IndirectSubtype extends SubtypeOfBase {}
|
||||
// ^^^^^^^^^^^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.SUBTYPE_OF_BASE_OR_FINAL_IS_NOT_BASE_FINAL_OR_SEALED
|
||||
// [cfe] The type 'IndirectSubtype' must be 'base', 'final' or 'sealed' because the supertype 'BaseClass' is 'base'.
|
||||
|
||||
|
||||
@@ -22,4 +22,3 @@ enum EnumOutside implements MixinForEnum { x }
|
||||
// ^^^^^^^^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.INVALID_USE_OF_TYPE_OUTSIDE_LIBRARY
|
||||
// [cfe] The mixin 'MixinForEnum' can't be implemented outside of its library because it's a base mixin.
|
||||
|
||||
|
||||
@@ -16,4 +16,3 @@ class BOutside with BaseMixin {}
|
||||
// ^^^^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.SUBTYPE_OF_BASE_OR_FINAL_IS_NOT_BASE_FINAL_OR_SEALED
|
||||
// [cfe] The type 'BOutside' must be 'base', 'final' or 'sealed' because the supertype 'BaseMixin' is 'base'.
|
||||
|
||||
|
||||
@@ -22,4 +22,3 @@ enum EnumOutside implements ClassForEnum { x }
|
||||
// ^^^^^^^^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.INVALID_USE_OF_TYPE_OUTSIDE_LIBRARY
|
||||
// [cfe] The class 'ClassForEnum' can't be implemented outside of its library because it's a final class.
|
||||
|
||||
|
||||
-1
@@ -49,4 +49,3 @@ class IndirectSubtype extends SubtypeOfFinal {}
|
||||
// ^^^^^^^^^^^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.SUBTYPE_OF_BASE_OR_FINAL_IS_NOT_BASE_FINAL_OR_SEALED
|
||||
// [cfe] The type 'IndirectSubtype' must be 'base', 'final' or 'sealed' because the supertype 'FinalClass' is 'final'.
|
||||
|
||||
|
||||
-1
@@ -11,4 +11,3 @@ class ATypeDef extends InterfaceClassTypeDef {}
|
||||
// ^^^^^^^^^^^^^^^^^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.INVALID_USE_OF_TYPE_OUTSIDE_LIBRARY
|
||||
// [cfe] The class 'InterfaceClass' can't be extended outside of its library because it's an interface class.
|
||||
|
||||
|
||||
-1
@@ -14,4 +14,3 @@ class A extends ATypeDef {}
|
||||
// ^^^^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.INVALID_USE_OF_TYPE_OUTSIDE_LIBRARY
|
||||
// [cfe] The class 'InterfaceClass' can't be extended outside of its library because it's an interface class.
|
||||
|
||||
|
||||
-1
@@ -18,4 +18,3 @@ abstract class AbstractClassMixingCtorClass with GenerativeConstructorClass {}
|
||||
// [cfe] Can't use 'GenerativeConstructorClass' as a mixin because it has constructors.
|
||||
// ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.MIXIN_CLASS_DECLARES_CONSTRUCTOR
|
||||
|
||||
|
||||
-1
@@ -18,4 +18,3 @@ abstract class AbstractMixinClass with NonObjectSuperclassClass {}
|
||||
// ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.MIXIN_INHERITS_FROM_NOT_OBJECT
|
||||
// [cfe] The class 'NonObjectSuperclassClass' can't be used as a mixin because it extends a class other than 'Object'.
|
||||
|
||||
|
||||
-1
@@ -40,4 +40,3 @@ class OutsideG with AbstractClass {}
|
||||
// ^^^^^^^^^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.CLASS_USED_AS_MIXIN
|
||||
// [cfe] The class 'AbstractClass' can't be used as a mixin because it isn't a mixin class nor a mixin.
|
||||
|
||||
|
||||
@@ -47,12 +47,10 @@ test3() {
|
||||
var f2 = (Pair<int, Pair<int, int>> pr) => pr.snd.fst + 2;
|
||||
|
||||
// Closures with function type with nested parameterized types.
|
||||
var ap1 =
|
||||
(f(Pair<int, Pair<int, int>> pr1), Pair<int, Pair<int, int>> pr) =>
|
||||
f(pr) * 10;
|
||||
var ap2 =
|
||||
(f(Pair<int, Pair<int, int>> pr1), Pair<int, Pair<int, int>> pr) =>
|
||||
f(pr) * 100;
|
||||
var ap1 = (f(Pair<int, Pair<int, int>> pr1), Pair<int, Pair<int, int>> pr) =>
|
||||
f(pr) * 10;
|
||||
var ap2 = (f(Pair<int, Pair<int, int>> pr1), Pair<int, Pair<int, int>> pr) =>
|
||||
f(pr) * 100;
|
||||
|
||||
var e = new Pair<int, Pair<int, int>>(100, new Pair<int, int>(200, 300));
|
||||
|
||||
|
||||
@@ -12,7 +12,8 @@ class A {
|
||||
class B extends A {
|
||||
int get a => 54;
|
||||
returnSuper() => super.a;
|
||||
returnSuperInClosure() => () => super.a;
|
||||
returnSuperInClosure() =>
|
||||
() => super.a;
|
||||
}
|
||||
|
||||
main() {
|
||||
|
||||
@@ -9,21 +9,19 @@ import "package:expect/expect.dart";
|
||||
const C1 = true;
|
||||
const C2 = false;
|
||||
|
||||
const nephew =
|
||||
C1
|
||||
? C2
|
||||
? "Tick"
|
||||
: "Trick"
|
||||
: "Track";
|
||||
const nephew = C1
|
||||
? C2
|
||||
? "Tick"
|
||||
: "Trick"
|
||||
: "Track";
|
||||
|
||||
main() {
|
||||
const a = true ? 5 : 10;
|
||||
const b =
|
||||
C2
|
||||
? "Track"
|
||||
: C1
|
||||
? "Trick"
|
||||
: "Tick";
|
||||
const b = C2
|
||||
? "Track"
|
||||
: C1
|
||||
? "Trick"
|
||||
: "Tick";
|
||||
|
||||
Expect.equals(5, a);
|
||||
Expect.equals("Trick", nephew);
|
||||
|
||||
@@ -59,12 +59,11 @@ class A<U extends num> {
|
||||
x3 = b ? ((b ? prefix.f1 : f2))<U> : ((b ? prefix.f1 : f2))<int>,
|
||||
x4 = b ? ((b ? c01 : prefix.c02))<U> : ((b ? c01 : prefix.c02))<int>,
|
||||
x5 = b ? (null ?? f1)<U> : (null ?? f1)<int>,
|
||||
x6 =
|
||||
b
|
||||
? ((c01 as dynamic)
|
||||
as void Function<X extends num>(X, [num, List<X>]))<U>
|
||||
: ((c01 as dynamic)
|
||||
as void Function<X extends num>(X, [num, List<X>]))<int>,
|
||||
x6 = b
|
||||
? ((c01 as dynamic)
|
||||
as void Function<X extends num>(X, [num, List<X>]))<U>
|
||||
: ((c01 as dynamic)
|
||||
as void Function<X extends num>(X, [num, List<X>]))<int>,
|
||||
x7 = b ? f1 : f2,
|
||||
x8 = b ? c01 : c02,
|
||||
x9 = null ?? c02,
|
||||
|
||||
@@ -29,10 +29,9 @@ class T {
|
||||
const T.length2(dynamic l, int defaultValue)
|
||||
: value = l is! String ? defaultValue : l.length;
|
||||
const T.sum(dynamic o1, dynamic o2)
|
||||
: value =
|
||||
((o1 is num) & (o2 is num)) | ((o1 is String) & (o2 is String))
|
||||
? o1 + o2
|
||||
: o1;
|
||||
: value = ((o1 is num) & (o2 is num)) | ((o1 is String) & (o2 is String))
|
||||
? o1 + o2
|
||||
: o1;
|
||||
}
|
||||
|
||||
class C {
|
||||
|
||||
@@ -409,7 +409,9 @@ class AllocatorContextNormalParamAndTypeParamCapturedInBodyAndTypeParamInInitial
|
||||
Function f2;
|
||||
int a;
|
||||
|
||||
AllocatorContextNormalParamAndTypeParamCapturedInBodyAndTypeParamInInitializer(int a) : this.a = a,
|
||||
AllocatorContextNormalParamAndTypeParamCapturedInBodyAndTypeParamInInitializer(
|
||||
int a,
|
||||
) : this.a = a,
|
||||
f1 = (() {
|
||||
Expect.identical(T, int);
|
||||
}),
|
||||
@@ -439,7 +441,9 @@ class AllocatorContextNormalParamAndTypeParamCapturedInBodyAndNormalParamInIniti
|
||||
Function f2;
|
||||
int a;
|
||||
|
||||
AllocatorContextNormalParamAndTypeParamCapturedInBodyAndNormalParamInInitializer(int a) : this.a = a,
|
||||
AllocatorContextNormalParamAndTypeParamCapturedInBodyAndNormalParamInInitializer(
|
||||
int a,
|
||||
) : this.a = a,
|
||||
f1 = (() {
|
||||
a++;
|
||||
Expect.equals(++expectedValueOfA, a);
|
||||
@@ -1005,9 +1009,10 @@ void main() {
|
||||
|
||||
expectedValueOfA = 123;
|
||||
AllocatorContextNormalParamCapturedInBodyAndNormalAndTypeParamInInitializer
|
||||
k = AllocatorContextNormalParamCapturedInBodyAndNormalAndTypeParamInInitializer<
|
||||
int
|
||||
>(expectedValueOfA);
|
||||
k =
|
||||
AllocatorContextNormalParamCapturedInBodyAndNormalAndTypeParamInInitializer<
|
||||
int
|
||||
>(expectedValueOfA);
|
||||
k.runAssertions();
|
||||
|
||||
expectedValueOfA = 123;
|
||||
@@ -1019,14 +1024,18 @@ void main() {
|
||||
|
||||
expectedValueOfA = 123;
|
||||
AllocatorContextNormalParamAndTypeParamCapturedInBodyAndTypeParamInInitializer
|
||||
m = AllocatorContextNormalParamAndTypeParamCapturedInBodyAndTypeParamInInitializer<
|
||||
int
|
||||
>(expectedValueOfA);
|
||||
m =
|
||||
AllocatorContextNormalParamAndTypeParamCapturedInBodyAndTypeParamInInitializer<
|
||||
int
|
||||
>(expectedValueOfA);
|
||||
m.runAssertions();
|
||||
|
||||
expectedValueOfA = 123;
|
||||
AllocatorContextNormalParamAndTypeParamCapturedInBodyAndNormalParamInInitializer
|
||||
n = AllocatorContextNormalParamAndTypeParamCapturedInBodyAndNormalParamInInitializer<int>(expectedValueOfA);
|
||||
n =
|
||||
AllocatorContextNormalParamAndTypeParamCapturedInBodyAndNormalParamInInitializer<
|
||||
int
|
||||
>(expectedValueOfA);
|
||||
n.runAssertions();
|
||||
|
||||
expectedValueOfA = 123;
|
||||
|
||||
@@ -116,8 +116,8 @@ testFieldOfFunctionType() {
|
||||
}
|
||||
|
||||
testFieldOfGenericFunctionType() {
|
||||
FnChecks<Object> c =
|
||||
new FnChecks<num>()..g = <S extends num>(S s) => s.isNegative;
|
||||
FnChecks<Object> c = new FnChecks<num>()
|
||||
..g = <S extends num>(S s) => s.isNegative;
|
||||
|
||||
Expect.throwsTypeError(() {
|
||||
G<Object> g = c.g;
|
||||
|
||||
@@ -431,13 +431,11 @@ main() {
|
||||
Expect.identical(0.0, v1);
|
||||
v2 = 1..toString();
|
||||
Expect.identical(1.0, v2);
|
||||
v3 =
|
||||
-0
|
||||
..toString();
|
||||
v3 = -0
|
||||
..toString();
|
||||
Expect.identical(-0.0, v3);
|
||||
v4 =
|
||||
-1
|
||||
..toString();
|
||||
v4 = -1
|
||||
..toString();
|
||||
Expect.identical(-1.0, v4);
|
||||
v5 = 9223372036854775808..toString();
|
||||
Expect.identical(9223372036854775808.0, v5);
|
||||
@@ -445,9 +443,8 @@ main() {
|
||||
Expect.identical(18446744073709551616.0, v6);
|
||||
v7 = 0x02..toString(); // Hex literal.
|
||||
Expect.identical(2.0, v7);
|
||||
v8 =
|
||||
-0x02
|
||||
..toString(); // Hex literal.
|
||||
v8 = -0x02
|
||||
..toString(); // Hex literal.
|
||||
Expect.identical(-2.0, v8);
|
||||
|
||||
// Nexted context, double assignment.
|
||||
@@ -554,9 +551,8 @@ main() {
|
||||
{
|
||||
// Check that the correct value is used as receiver for the cascade.
|
||||
var collector = StringBuffer();
|
||||
double tricky =
|
||||
-42
|
||||
..toString().codeUnits.forEach(collector.writeCharCode);
|
||||
double tricky = -42
|
||||
..toString().codeUnits.forEach(collector.writeCharCode);
|
||||
Expect.equals("${-42.0}", collector.toString());
|
||||
}
|
||||
|
||||
@@ -566,8 +562,11 @@ main() {
|
||||
// The context type of "4.toString..." is not double, and the `-`
|
||||
// is not having a literal as operand.
|
||||
Expect.throws(() {
|
||||
double tricky =
|
||||
-4.toString().codeUnits.firstWhere((c) => !isDigit(c)).toDouble();
|
||||
double tricky = -4
|
||||
.toString()
|
||||
.codeUnits
|
||||
.firstWhere((c) => !isDigit(c))
|
||||
.toDouble();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,8 @@
|
||||
|
||||
export 'ambiguous_main_a.dart';
|
||||
export 'ambiguous_main_b.dart';
|
||||
// [error column 1]
|
||||
|
||||
// [error line 6, column 1]
|
||||
// [cfe] 'main' is exported from both 'tests/language/export/ambiguous_main_a.dart' and 'tests/language/export/ambiguous_main_b.dart'.
|
||||
// ^^^^^^^^^^^^^^^^^^^^^^^
|
||||
// [error line 6, column 8]
|
||||
// [analyzer] COMPILE_TIME_ERROR.AMBIGUOUS_EXPORT
|
||||
|
||||
@@ -38,12 +38,13 @@ testVariable(C? c) {
|
||||
E(c)?.extensionProperty = c..expectStaticType<Exactly<C>>();
|
||||
E(c)?.extensionProperty += c..expectStaticType<Exactly<C>>();
|
||||
E(c)?.nullableExtensionProperty ??= c..expectStaticType<Exactly<C>>();
|
||||
E(c)?[c
|
||||
..expectStaticType<Exactly<C>>()].method(c..expectStaticType<Exactly<C>>());
|
||||
E(c)?[c..expectStaticType<Exactly<C>>()].method(
|
||||
c..expectStaticType<Exactly<C>>(),
|
||||
);
|
||||
E(c)?[c..expectStaticType<Exactly<C>>()] = c..expectStaticType<Exactly<C>>();
|
||||
E(c)?[c..expectStaticType<Exactly<C>>()] += c..expectStaticType<Exactly<C>>();
|
||||
E2(c)?[c..expectStaticType<Exactly<C>>()] ??=
|
||||
c..expectStaticType<Exactly<C>>();
|
||||
E2(c)?[c..expectStaticType<Exactly<C>>()] ??= c
|
||||
..expectStaticType<Exactly<C>>();
|
||||
}
|
||||
|
||||
testProperty(B b) {
|
||||
@@ -55,12 +56,12 @@ testProperty(B b) {
|
||||
E(b._c)?[b._c..expectStaticType<Exactly<C>>()].method(
|
||||
b._c..expectStaticType<Exactly<C>>(),
|
||||
);
|
||||
E(b._c)?[b._c..expectStaticType<Exactly<C>>()] =
|
||||
b._c..expectStaticType<Exactly<C>>();
|
||||
E(b._c)?[b._c..expectStaticType<Exactly<C>>()] +=
|
||||
b._c..expectStaticType<Exactly<C>>();
|
||||
E2(b._c)?[b._c..expectStaticType<Exactly<C>>()] ??=
|
||||
b._c..expectStaticType<Exactly<C>>();
|
||||
E(b._c)?[b._c..expectStaticType<Exactly<C>>()] = b._c
|
||||
..expectStaticType<Exactly<C>>();
|
||||
E(b._c)?[b._c..expectStaticType<Exactly<C>>()] += b._c
|
||||
..expectStaticType<Exactly<C>>();
|
||||
E2(b._c)?[b._c..expectStaticType<Exactly<C>>()] ??= b._c
|
||||
..expectStaticType<Exactly<C>>();
|
||||
}
|
||||
|
||||
main() {
|
||||
|
||||
@@ -7,7 +7,8 @@ import "package:expect/expect.dart";
|
||||
// Tests the resolution of a bare type variable with bounded or promoted type.
|
||||
|
||||
extension E<T> on T {
|
||||
T Function(T) get f => (_) => this;
|
||||
T Function(T) get f =>
|
||||
(_) => this;
|
||||
}
|
||||
|
||||
class A<S extends num> {
|
||||
|
||||
@@ -112,7 +112,10 @@ void main() {
|
||||
V32(({int x = 0, String y = "0"}) {})._;
|
||||
V33((int x, {required String y}) {})._;
|
||||
V34(({required int x, String y = "0"}) {})._;
|
||||
V35(() => (Function f) => f)._;
|
||||
V35(
|
||||
() =>
|
||||
(Function f) => f,
|
||||
)._;
|
||||
V36<Type>(int)._;
|
||||
V37<Type>([int])._;
|
||||
V38<Type>(int)._;
|
||||
|
||||
+6
-8
@@ -46,10 +46,9 @@ String Function(E<String>) producingFunctionE() => ((E<String> e) => "");
|
||||
|
||||
// In type constraint generation, E<String> is compared against ET2<T>,
|
||||
// yielding the constraint String <: T.
|
||||
test4() =>
|
||||
acceptingFunctionET2(
|
||||
producingFunctionE(),
|
||||
).expectStaticType<Exactly<String>>();
|
||||
test4() => acceptingFunctionET2(
|
||||
producingFunctionE(),
|
||||
).expectStaticType<Exactly<String>>();
|
||||
|
||||
extension type ET3<Y>(A<Y> it) implements ET1<Y> {}
|
||||
|
||||
@@ -81,10 +80,9 @@ T acceptingFunctionET4<T>(Function(ET4<T>) f) => f(ET4<T>(producingE<T>()));
|
||||
|
||||
// In type constraint generation, E<String> is compared against ET4<T>,
|
||||
// yielding the constraint String <: T.
|
||||
test8() =>
|
||||
acceptingFunctionET4(
|
||||
producingFunctionE(),
|
||||
).expectStaticType<Exactly<String>>();
|
||||
test8() => acceptingFunctionET4(
|
||||
producingFunctionE(),
|
||||
).expectStaticType<Exactly<String>>();
|
||||
|
||||
main() {
|
||||
test1();
|
||||
|
||||
@@ -71,15 +71,15 @@ class C3 {
|
||||
}
|
||||
|
||||
class C4 implements C3 {
|
||||
// ^^
|
||||
// [context 6] '_conflictingNsmForwarder' couldn't be promoted because there is a conflicting noSuchMethod forwarder in class 'C4'. See http://dart.dev/go/non-promo-conflicting-noSuchMethod-forwarder
|
||||
// [context 12] '_conflictingNsmForwarder' couldn't be promoted because there is a conflicting noSuchMethod forwarder in class 'C4'. See http://dart.dev/go/non-promo-conflicting-noSuchMethod-forwarder
|
||||
// [context 18] '_conflictingNsmForwarder' couldn't be promoted because there is a conflicting noSuchMethod forwarder in class 'C4'. See http://dart.dev/go/non-promo-conflicting-noSuchMethod-forwarder
|
||||
// [context 24] '_conflictingNsmForwarder' couldn't be promoted because there is a conflicting noSuchMethod forwarder in class 'C4'. See http://dart.dev/go/non-promo-conflicting-noSuchMethod-forwarder
|
||||
// [context 30] '_conflictingNsmForwarder' couldn't be promoted because there is a conflicting noSuchMethod forwarder in class 'C4'.
|
||||
// [context 36] '_conflictingNsmForwarder' couldn't be promoted because there is a conflicting noSuchMethod forwarder in class 'C4'.
|
||||
// [context 42] '_conflictingNsmForwarder' couldn't be promoted because there is a conflicting noSuchMethod forwarder in class 'C4'.
|
||||
// [context 48] '_conflictingNsmForwarder' couldn't be promoted because there is a conflicting noSuchMethod forwarder in class 'C4'.
|
||||
// ^^
|
||||
// [context 6] '_conflictingNsmForwarder' couldn't be promoted because there is a conflicting noSuchMethod forwarder in class 'C4'. See http://dart.dev/go/non-promo-conflicting-noSuchMethod-forwarder
|
||||
// [context 12] '_conflictingNsmForwarder' couldn't be promoted because there is a conflicting noSuchMethod forwarder in class 'C4'. See http://dart.dev/go/non-promo-conflicting-noSuchMethod-forwarder
|
||||
// [context 18] '_conflictingNsmForwarder' couldn't be promoted because there is a conflicting noSuchMethod forwarder in class 'C4'. See http://dart.dev/go/non-promo-conflicting-noSuchMethod-forwarder
|
||||
// [context 24] '_conflictingNsmForwarder' couldn't be promoted because there is a conflicting noSuchMethod forwarder in class 'C4'. See http://dart.dev/go/non-promo-conflicting-noSuchMethod-forwarder
|
||||
// [context 30] '_conflictingNsmForwarder' couldn't be promoted because there is a conflicting noSuchMethod forwarder in class 'C4'.
|
||||
// [context 36] '_conflictingNsmForwarder' couldn't be promoted because there is a conflicting noSuchMethod forwarder in class 'C4'.
|
||||
// [context 42] '_conflictingNsmForwarder' couldn't be promoted because there is a conflicting noSuchMethod forwarder in class 'C4'.
|
||||
// [context 48] '_conflictingNsmForwarder' couldn't be promoted because there is a conflicting noSuchMethod forwarder in class 'C4'.
|
||||
noSuchMethod(invocation) => 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -7,15 +7,15 @@
|
||||
// context message.
|
||||
|
||||
extension type E(int? i) {
|
||||
// ^
|
||||
// [context 1] 'i' refers to a public property so it couldn't be promoted. See http://dart.dev/go/non-promo-public-field
|
||||
// [context 2] 'i' refers to a public property so it couldn't be promoted. See http://dart.dev/go/non-promo-public-field
|
||||
// [context 3] 'i' refers to a public property so it couldn't be promoted. See http://dart.dev/go/non-promo-public-field
|
||||
// [context 4] 'i' refers to a public property so it couldn't be promoted. See http://dart.dev/go/non-promo-public-field
|
||||
// [context 5] 'i' refers to a public property so it couldn't be promoted.
|
||||
// [context 6] 'i' refers to a public property so it couldn't be promoted.
|
||||
// [context 7] 'i' refers to a public property so it couldn't be promoted.
|
||||
// [context 8] 'i' refers to a public property so it couldn't be promoted.
|
||||
// ^
|
||||
// [context 1] 'i' refers to a public property so it couldn't be promoted. See http://dart.dev/go/non-promo-public-field
|
||||
// [context 2] 'i' refers to a public property so it couldn't be promoted. See http://dart.dev/go/non-promo-public-field
|
||||
// [context 3] 'i' refers to a public property so it couldn't be promoted. See http://dart.dev/go/non-promo-public-field
|
||||
// [context 4] 'i' refers to a public property so it couldn't be promoted. See http://dart.dev/go/non-promo-public-field
|
||||
// [context 5] 'i' refers to a public property so it couldn't be promoted.
|
||||
// [context 6] 'i' refers to a public property so it couldn't be promoted.
|
||||
// [context 7] 'i' refers to a public property so it couldn't be promoted.
|
||||
// [context 8] 'i' refers to a public property so it couldn't be promoted.
|
||||
void viaImplicitThis() {
|
||||
if (i != null) {
|
||||
i.isEven;
|
||||
|
||||
@@ -27,18 +27,18 @@ void test1() {
|
||||
}
|
||||
|
||||
void test2() {
|
||||
final B1<num, num> a =
|
||||
kTrue
|
||||
? (B1<int, double>() as B1<num, num>)
|
||||
: (B2<double>() as B1<num, num>);
|
||||
final B1<num, num> a = kTrue
|
||||
? (B1<int, double>() as B1<num, num>)
|
||||
: (B2<double>() as B1<num, num>);
|
||||
Expect.isFalse(a is B2<int>);
|
||||
Expect.isFalse(a is B2<double>);
|
||||
Expect.isFalse(a is B2<num>); // Should be optimized to cid-range check.
|
||||
}
|
||||
|
||||
void test3() {
|
||||
final B1<int, num> a =
|
||||
kTrue ? (B1<int, double>() as B1<int, num>) : (B2<int>() as B1<int, num>);
|
||||
final B1<int, num> a = kTrue
|
||||
? (B1<int, double>() as B1<int, num>)
|
||||
: (B2<int>() as B1<int, num>);
|
||||
Expect.isFalse(a is B2<int>);
|
||||
Expect.isFalse(a is B2<double>);
|
||||
Expect.isFalse(a is B2<num>);
|
||||
@@ -66,8 +66,9 @@ void test6() {
|
||||
}
|
||||
|
||||
void test7() {
|
||||
final B1<List<int>, List<int>> a =
|
||||
kTrue ? B2<List<int>>() : B1<List<int>, List<int>>();
|
||||
final B1<List<int>, List<int>> a = kTrue
|
||||
? B2<List<int>>()
|
||||
: B1<List<int>, List<int>>();
|
||||
Expect.isTrue(a is B2<List<num>>); // Should be optimized to cid-range check.
|
||||
Expect.isTrue(a is B2<List<int>>); // Should be optimized to cid-range check.
|
||||
Expect.isFalse(a is B2<List<double>>);
|
||||
@@ -82,8 +83,9 @@ class X<T extends num> {
|
||||
}
|
||||
|
||||
void test2() {
|
||||
final B1<List<T>, List<T>> a =
|
||||
kTrue ? B2<List<T>>() : B1<List<T>, List<T>>();
|
||||
final B1<List<T>, List<T>> a = kTrue
|
||||
? B2<List<T>>()
|
||||
: B1<List<T>, List<T>>();
|
||||
Expect.isTrue(a is B2<List<T>>); // Should be optimized to cid-range check.
|
||||
Expect.isTrue(
|
||||
a is B2<List<num>>,
|
||||
|
||||
@@ -14,9 +14,12 @@ typedef GG = FF Function();
|
||||
@pragma('weak-tearoff-reference')
|
||||
GG? weakRef(GG? x) => x;
|
||||
|
||||
FF foo1() => ({int x = 100, int y = 10}) => 1000 + x + y;
|
||||
FF foo2() => ({int x = 200, int y = 20}) => 2000 + x + y;
|
||||
FF foo3() => ({int x = 300, int y = 30}) => 3000 + x + y;
|
||||
FF foo1() =>
|
||||
({int x = 100, int y = 10}) => 1000 + x + y;
|
||||
FF foo2() =>
|
||||
({int x = 200, int y = 20}) => 2000 + x + y;
|
||||
FF foo3() =>
|
||||
({int x = 300, int y = 30}) => 3000 + x + y;
|
||||
|
||||
main() {
|
||||
print(foo1()());
|
||||
|
||||
Reference in New Issue
Block a user