Skip to content

Commit a02d5bb

Browse files
munificentCommit Queue
authored and
Commit Queue
committed
Reformat tests/language/f-l using the 3.8 style.
Change-Id: I7dafd578cf8da38616ae25e5ce8dbbc7e3213014 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/425185 Reviewed-by: Lasse Nielsen <[email protected]> Commit-Queue: Lasse Nielsen <[email protected]> Auto-Submit: Bob Nystrom <[email protected]>
1 parent 159de51 commit a02d5bb

File tree

41 files changed

+339
-452
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+339
-452
lines changed

tests/language/function/literals_test.dart

+12-2
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,18 @@ class FunctionLiteralsTest {
4949
}
5050

5151
void testArrowArrow() {
52-
checkIntFuncFunction(84, (x) => (y) => (x as int) + (y as int), 42);
53-
checkIntFuncFunction(84, (dynamic x) => (y) => x + y, 42);
52+
checkIntFuncFunction(
53+
84,
54+
(x) =>
55+
(y) => (x as int) + (y as int),
56+
42,
57+
);
58+
checkIntFuncFunction(
59+
84,
60+
(dynamic x) =>
61+
(y) => x + y,
62+
42,
63+
);
5464
}
5565

5666
void testArrowBlock() {

tests/language/function_type/test_generator.dart

+35-41
Original file line numberDiff line numberDiff line change
@@ -439,47 +439,41 @@ List<FunctionType> buildFunctionTypes() {
439439
// new NominalType("List", "", [new NominalType("Function")]),
440440
];
441441

442-
List<TypeLike?> basicsPlusNull =
443-
[
444-
basicTypes,
445-
<TypeLike?>[null],
446-
].expand((x) => x).toList();
447-
448-
List<TypeLike?> basicsPlusNullPlusVoid =
449-
[
450-
basicsPlusNull,
451-
[NominalType("void")],
452-
].expand((x) => x).toList();
453-
454-
List<TypeLike?> basicsPlusNullPlusB =
455-
[
456-
basicsPlusNull,
457-
[
458-
NominalType("B"),
459-
NominalType("List", "", [NominalType("B")]),
460-
],
461-
].expand((x) => x).toList();
462-
463-
List<TypeLike?> basicsPlusNullPlusBPlusVoid =
464-
[
465-
basicsPlusNullPlusB,
466-
[NominalType("void")],
467-
].expand((x) => x).toList();
468-
469-
List<TypeLike?> basicsPlusNullPlusA =
470-
[
471-
basicsPlusNull,
472-
[
473-
NominalType("A"),
474-
NominalType("List", "", [NominalType("A")]),
475-
],
476-
].expand((x) => x).toList();
477-
478-
List<TypeLike?> basicsPlusNullPlusAPlusVoid =
479-
[
480-
basicsPlusNullPlusA,
481-
[NominalType("void")],
482-
].expand((x) => x).toList();
442+
List<TypeLike?> basicsPlusNull = [
443+
basicTypes,
444+
<TypeLike?>[null],
445+
].expand((x) => x).toList();
446+
447+
List<TypeLike?> basicsPlusNullPlusVoid = [
448+
basicsPlusNull,
449+
[NominalType("void")],
450+
].expand((x) => x).toList();
451+
452+
List<TypeLike?> basicsPlusNullPlusB = [
453+
basicsPlusNull,
454+
[
455+
NominalType("B"),
456+
NominalType("List", "", [NominalType("B")]),
457+
],
458+
].expand((x) => x).toList();
459+
460+
List<TypeLike?> basicsPlusNullPlusBPlusVoid = [
461+
basicsPlusNullPlusB,
462+
[NominalType("void")],
463+
].expand((x) => x).toList();
464+
465+
List<TypeLike?> basicsPlusNullPlusA = [
466+
basicsPlusNull,
467+
[
468+
NominalType("A"),
469+
NominalType("List", "", [NominalType("A")]),
470+
],
471+
].expand((x) => x).toList();
472+
473+
List<TypeLike?> basicsPlusNullPlusAPlusVoid = [
474+
basicsPlusNullPlusA,
475+
[NominalType("void")],
476+
].expand((x) => x).toList();
483477

484478
List<FunctionType> buildFunctionTypes(
485479
TypeLike? returnType,

tests/language/generic/functions_test.dart

+4-6
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,8 @@ class BinaryTreeNode<K extends Comparable<K>, V> {
2727
BinaryTreeNode<K, V> insert(K key, V value) {
2828
int c = key.compareTo(_key);
2929
if (c == 0) return this;
30-
var _insert =
31-
(BinaryTreeNode<K, V>? t, K key, V value) =>
32-
insertOpt<K, V>(t, key, value);
30+
var _insert = (BinaryTreeNode<K, V>? t, K key, V value) =>
31+
insertOpt<K, V>(t, key, value);
3332
BinaryTreeNode<K, V>? left = _left;
3433
BinaryTreeNode<K, V>? right = _right;
3534
if (c < 0) {
@@ -51,9 +50,8 @@ class BinaryTreeNode<K extends Comparable<K>, V> {
5150
}
5251

5352
S foldPre<S>(S init, S f(V t, S s)) {
54-
var _fold =
55-
(BinaryTreeNode<K, V>? t, S s, S f(V t, S s)) =>
56-
foldPreOpt<K, V, S>(t, s, f);
53+
var _fold = (BinaryTreeNode<K, V>? t, S s, S f(V t, S s)) =>
54+
foldPreOpt<K, V, S>(t, s, f);
5755
S s = init;
5856
s = f(_value, s);
5957
s = _fold(_left, s, f);

tests/language/generic/type_argument_substitution_test.dart

+3-4
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,8 @@ class B extends A<K> {}
1616
class X<T> {}
1717

1818
main() {
19-
var v =
20-
new DateTime.now().millisecondsSinceEpoch != 42
21-
? new X<B>()
22-
: new X<A<String>>();
19+
var v = new DateTime.now().millisecondsSinceEpoch != 42
20+
? new X<B>()
21+
: new X<A<String>>();
2322
Expect.isFalse(v is X<A<String>>);
2423
}

tests/language/generic_methods/generic_methods_test.dart

+4-6
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,8 @@ class BinaryTreeNode<K extends Comparable<K>, V> {
3636
BinaryTreeNode<K, V> insert(K key, V value) {
3737
int c = key.compareTo(_key);
3838
if (c == 0) return this;
39-
var _insert =
40-
(BinaryTreeNode<K, V>? node, K key, V value) =>
41-
insertOpt<K, V>(node, key, value);
39+
var _insert = (BinaryTreeNode<K, V>? node, K key, V value) =>
40+
insertOpt<K, V>(node, key, value);
4241
BinaryTreeNode<K, V>? left = _left;
4342
BinaryTreeNode<K, V>? right = _right;
4443
if (c < 0) {
@@ -77,9 +76,8 @@ class BinaryTreeNode<K extends Comparable<K>, V> {
7776
}
7877

7978
S foldPre<S>(S init, S f(V t, S s)) {
80-
var _fold =
81-
(BinaryTreeNode<K, V>? t, S s, S f(V t, S s)) =>
82-
foldPreOpt<K, V, S>(t, s, f);
79+
var _fold = (BinaryTreeNode<K, V>? t, S s, S f(V t, S s)) =>
80+
foldPreOpt<K, V, S>(t, s, f);
8381
S s = init;
8482
s = f(_value, s);
8583
s = _fold(_left, s, f);

tests/language/implicit_creation/implicit_const_context_list_test.dart

+9-12
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,15 @@ main() {
2424
const c1 = <int>[42];
2525

2626
// Inside const expression.
27-
var c2 =
28-
(const [
29-
<int>[42],
30-
])[0]; // List element.
31-
var c3 =
32-
(const {
33-
<int>[42]: 0,
34-
}).keys.first; // Map key.
35-
var c4 =
36-
(const {
37-
0: <int>[42],
38-
}).values.first; // Map value.
27+
var c2 = (const [
28+
<int>[42],
29+
])[0]; // List element.
30+
var c3 = (const {
31+
<int>[42]: 0,
32+
}).keys.first; // Map key.
33+
var c4 = (const {
34+
0: <int>[42],
35+
}).values.first; // Map value.
3936
var c5 = (const C(<int>[42])).x; // Constructor argument.
4037

4138
Expect.identical(c0, c1);

tests/language/implicit_creation/implicit_const_context_map_test.dart

+9-12
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,15 @@ main() {
2424
const c1 = <int, int>{37: 87};
2525

2626
// Inside const expression.
27-
var c2 =
28-
(const [
29-
<int, int>{37: 87},
30-
])[0]; // List element.
31-
var c3 =
32-
(const {
33-
<int, int>{37: 87}: 0,
34-
}).keys.first; // Map key.
35-
var c4 =
36-
(const {
37-
0: <int, int>{37: 87},
38-
}).values.first; // Map value.
27+
var c2 = (const [
28+
<int, int>{37: 87},
29+
])[0]; // List element.
30+
var c3 = (const {
31+
<int, int>{37: 87}: 0,
32+
}).keys.first; // Map key.
33+
var c4 = (const {
34+
0: <int, int>{37: 87},
35+
}).values.first; // Map value.
3936
var c5 = (const C(<int, int>{37: 87})).x; // Constructor argument.
4037

4138
Expect.identical(c0, c1);

tests/language/inference_update_1/horizontal_inference_invocation_types_test.dart

+2-3
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,8 @@ import 'package:expect/static_type_helper.dart';
88

99
testFunctionExpressionInvocation() {
1010
(<T>(T t, void Function(T) f) => t)(0, (x) {
11-
x.expectStaticType<Exactly<int>>();
12-
})
13-
.expectStaticType<Exactly<int>>();
11+
x.expectStaticType<Exactly<int>>();
12+
}).expectStaticType<Exactly<int>>();
1413
}
1514

1615
testInstanceCreation() {

tests/language/inference_update_2/promotion_narrows_interface_test.dart

+2-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ class A {
1717
}
1818

1919
class B extends A {
20-
int Function(num) get getter => (_) => 0;
20+
int Function(num) get getter =>
21+
(_) => 0;
2122
int method(num value) => 0;
2223
int call(num value) => 0;
2324
int operator [](num index) => 0;

tests/language/inference_update_2/top_level_type_inference_test.dart

+5-5
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,17 @@ class C {
2929

3030
late final instancePromotableViaThis = _promotable != null ? _promotable : 0;
3131

32-
late final instanceNotPromotableViaThis =
33-
_notPromotable != null ? _notPromotable : 0;
32+
late final instanceNotPromotableViaThis = _notPromotable != null
33+
? _notPromotable
34+
: 0;
3435
}
3536

3637
class D {
3738
int? _notPromotable;
3839
}
3940

40-
final topLevelPromotable = ((C c) => c._promotable != null ? c._promotable : 0)(
41-
new C(0),
42-
);
41+
final topLevelPromotable = ((C c) =>
42+
c._promotable != null ? c._promotable : 0)(new C(0));
4343

4444
final topLevelNotPromotable = ((C c) =>
4545
c._notPromotable != null ? c._notPromotable : 0)(new C(0));

tests/language/inference_update_2/why_not_promoted_conflict_error_test.dart

+3-3
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ class E {
2626
}
2727

2828
class F implements C {
29-
// ^
30-
// [context 1] '_i' couldn't be promoted because there is a conflicting noSuchMethod forwarder in class 'F'. See http://dart.dev/go/non-promo-conflicting-noSuchMethod-forwarder
31-
// [context 2] '_i' couldn't be promoted because there is a conflicting noSuchMethod forwarder in class 'F'.
29+
// ^
30+
// [context 1] '_i' couldn't be promoted because there is a conflicting noSuchMethod forwarder in class 'F'. See http://dart.dev/go/non-promo-conflicting-noSuchMethod-forwarder
31+
// [context 2] '_i' couldn't be promoted because there is a conflicting noSuchMethod forwarder in class 'F'.
3232
@override
3333
noSuchMethod(Invocation invocation) => 0;
3434
}

tests/language/inference_update_2/why_not_promoted_mixin_error_test.dart

+9-9
Original file line numberDiff line numberDiff line change
@@ -87,15 +87,15 @@ class C6 {
8787
}
8888

8989
class C7 implements C6 {
90-
// ^^
91-
// [context 6] '_conflictingNsmForwarder' couldn't be promoted because there is a conflicting noSuchMethod forwarder in class 'C7'. See http://dart.dev/go/non-promo-conflicting-noSuchMethod-forwarder
92-
// [context 12] '_conflictingNsmForwarder' couldn't be promoted because there is a conflicting noSuchMethod forwarder in class 'C7'. See http://dart.dev/go/non-promo-conflicting-noSuchMethod-forwarder
93-
// [context 18] '_conflictingNsmForwarder' couldn't be promoted because there is a conflicting noSuchMethod forwarder in class 'C7'. See http://dart.dev/go/non-promo-conflicting-noSuchMethod-forwarder
94-
// [context 24] '_conflictingNsmForwarder' couldn't be promoted because there is a conflicting noSuchMethod forwarder in class 'C7'. See http://dart.dev/go/non-promo-conflicting-noSuchMethod-forwarder
95-
// [context 30] '_conflictingNsmForwarder' couldn't be promoted because there is a conflicting noSuchMethod forwarder in class 'C7'.
96-
// [context 36] '_conflictingNsmForwarder' couldn't be promoted because there is a conflicting noSuchMethod forwarder in class 'C7'.
97-
// [context 42] '_conflictingNsmForwarder' couldn't be promoted because there is a conflicting noSuchMethod forwarder in class 'C7'.
98-
// [context 48] '_conflictingNsmForwarder' couldn't be promoted because there is a conflicting noSuchMethod forwarder in class 'C7'.
90+
// ^^
91+
// [context 6] '_conflictingNsmForwarder' couldn't be promoted because there is a conflicting noSuchMethod forwarder in class 'C7'. See http://dart.dev/go/non-promo-conflicting-noSuchMethod-forwarder
92+
// [context 12] '_conflictingNsmForwarder' couldn't be promoted because there is a conflicting noSuchMethod forwarder in class 'C7'. See http://dart.dev/go/non-promo-conflicting-noSuchMethod-forwarder
93+
// [context 18] '_conflictingNsmForwarder' couldn't be promoted because there is a conflicting noSuchMethod forwarder in class 'C7'. See http://dart.dev/go/non-promo-conflicting-noSuchMethod-forwarder
94+
// [context 24] '_conflictingNsmForwarder' couldn't be promoted because there is a conflicting noSuchMethod forwarder in class 'C7'. See http://dart.dev/go/non-promo-conflicting-noSuchMethod-forwarder
95+
// [context 30] '_conflictingNsmForwarder' couldn't be promoted because there is a conflicting noSuchMethod forwarder in class 'C7'.
96+
// [context 36] '_conflictingNsmForwarder' couldn't be promoted because there is a conflicting noSuchMethod forwarder in class 'C7'.
97+
// [context 42] '_conflictingNsmForwarder' couldn't be promoted because there is a conflicting noSuchMethod forwarder in class 'C7'.
98+
// [context 48] '_conflictingNsmForwarder' couldn't be promoted because there is a conflicting noSuchMethod forwarder in class 'C7'.
9999
noSuchMethod(invocation) => 0;
100100
}
101101

tests/language/inference_update_3/conditional_expression_test.dart

+3-4
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,9 @@ test(bool b) {
4545
Object? o;
4646
o = '' as Object?;
4747
if (o is String) {
48-
o =
49-
b
50-
? (contextType('')..expectStaticType<Exactly<String>>())
51-
: (contextType('')..expectStaticType<Exactly<String>>());
48+
o = b
49+
? (contextType('')..expectStaticType<Exactly<String>>())
50+
: (contextType('')..expectStaticType<Exactly<String>>());
5251
}
5352
}
5453

tests/language/inference_update_3/if_null_assignment_explicit_extension_index_expression_test.dart

+15-21
Original file line numberDiff line numberDiff line change
@@ -234,9 +234,8 @@ main() {
234234
// The fact that T2' <!: S precludes using S as static type.
235235
// Therefore the type of `e` is T = num.
236236
// We avoid having a compile-time error because `o` can be demoted.
237-
o =
238-
(Extension(Indexable<int?, Object?>(null))[0] ??= d)
239-
..expectStaticType<Exactly<num>>();
237+
o = (Extension(Indexable<int?, Object?>(null))[0] ??= d)
238+
..expectStaticType<Exactly<num>>();
240239
}
241240
o = 0 as Object?;
242241
if (o is int?) {
@@ -254,9 +253,8 @@ main() {
254253
// The fact that NonNull(T1) <!: S precludes using S as static type.
255254
// Therefore the type of `e` is T = num?.
256255
// We avoid having a compile-time error because `o` can be demoted.
257-
o =
258-
(Extension(Indexable<double?, Object?>(null))[0] ??= intQuestion)
259-
..expectStaticType<Exactly<num?>>();
256+
o = (Extension(Indexable<double?, Object?>(null))[0] ??= intQuestion)
257+
..expectStaticType<Exactly<num?>>();
260258
}
261259
o = '' as Object?;
262260
if (o is String?) {
@@ -275,9 +273,8 @@ main() {
275273
// static type.
276274
// Therefore the type of `e` is T = num.
277275
// We avoid having a compile-time error because `o` can be demoted.
278-
o =
279-
(Extension(Indexable<int?, Object?>(null))[0] ??= d)
280-
..expectStaticType<Exactly<num>>();
276+
o = (Extension(Indexable<int?, Object?>(null))[0] ??= d)
277+
..expectStaticType<Exactly<num>>();
281278
}
282279

283280
var callableClassC2Int = CallableClass<C2<int>>();
@@ -298,10 +295,9 @@ main() {
298295
// The fact that T2' <!: S precludes using S as static type.
299296
// Therefore the type of `e` is T = A Function().
300297
// We avoid having a compile-time error because `o` can be demoted.
301-
o =
302-
(Extension(Indexable<C1<int> Function()?, Function?>(null))[0] ??=
303-
callableClassC2Int)
304-
..expectStaticType<Exactly<A Function()>>();
298+
o = (Extension(
299+
Indexable<C1<int> Function()?, Function?>(null),
300+
)[0] ??= callableClassC2Int)..expectStaticType<Exactly<A Function()>>();
305301
}
306302

307303
o = (() => C2<int>()) as Object?;
@@ -321,10 +317,9 @@ main() {
321317
// The fact that NonNull(T1) <!: S precludes using S as static type.
322318
// Therefore the type of `e` is T = A Function().
323319
// We avoid having a compile-time error because `o` can be demoted.
324-
o =
325-
(Extension(Indexable<C1<int> Function()?, Function?>(null))[0] ??=
326-
callableClassC2Int)
327-
..expectStaticType<Exactly<A Function()>>();
320+
o = (Extension(
321+
Indexable<C1<int> Function()?, Function?>(null),
322+
)[0] ??= callableClassC2Int)..expectStaticType<Exactly<A Function()>>();
328323
}
329324

330325
o = 0 as Object?;
@@ -344,10 +339,9 @@ main() {
344339
// The fact that NonNull(T1) <!: S precludes using S as static type.
345340
// Therefore the type of `e` is T = A Function().
346341
// We avoid having a compile-time error because `o` can be demoted.
347-
o =
348-
(Extension(Indexable<C1<int> Function()?, Function?>(null))[0] ??=
349-
callableClassC2Int)
350-
..expectStaticType<Exactly<A Function()>>();
342+
o = (Extension(
343+
Indexable<C1<int> Function()?, Function?>(null),
344+
)[0] ??= callableClassC2Int)..expectStaticType<Exactly<A Function()>>();
351345
}
352346
}
353347
}

0 commit comments

Comments
 (0)