Skip to content

Commit a2c7cd6

Browse files
munificentCommit Queue
authored andcommitted
Reformat tests/language/a*.
(There are so many subdirectories under language/ that I figure going a letter at a time is easier to review than going a subdirectory at a time and sending out a huge flurry of tiny CLs.) Change-Id: Ie899b93c5a5f502ca67953b722cecb68c5c6d233 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/400146 Auto-Submit: Bob Nystrom <[email protected]> Reviewed-by: Lasse Nielsen <[email protected]> Commit-Queue: Lasse Nielsen <[email protected]>
1 parent 1a8afa6 commit a2c7cd6

File tree

86 files changed

+1326
-1064
lines changed

Some content is hidden

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

86 files changed

+1326
-1064
lines changed

tests/language/async/and_or_test.dart

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ testEvaluation(Future<void> fn()) async {
4747
test2() async {
4848
await testEvaluation(() async {
4949
Expect.isFalse(
50-
await confuse(traceA(false)) && await confuse(traceB(false)));
50+
await confuse(traceA(false)) && await confuse(traceB(false)),
51+
);
5152
Expect.equals("a", trace);
5253
});
5354
await testEvaluation(() async {
@@ -65,7 +66,8 @@ test2() async {
6566

6667
await testEvaluation(() async {
6768
Expect.isFalse(
68-
await confuse(traceA(false)) || await confuse(traceB(false)));
69+
await confuse(traceA(false)) || await confuse(traceB(false)),
70+
);
6971
Expect.equals("ab", trace);
7072
});
7173
await testEvaluation(() async {

tests/language/async/await_foreign_test.dart

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,18 @@ class ForeignFuture implements Future<Null> {
2121

2222
Future<S> then<S>(FutureOr<S> onValue(Null _), {Function? onError}) {
2323
assert(_future != null);
24-
return _future!.then((_) {
25-
_future = null;
26-
return onValue(null);
27-
}, onError: (error, trace) {
28-
_future = null;
29-
if (onError != null) {
30-
onError(error, trace);
31-
}
32-
});
24+
return _future!.then(
25+
(_) {
26+
_future = null;
27+
return onValue(null);
28+
},
29+
onError: (error, trace) {
30+
_future = null;
31+
if (onError != null) {
32+
onError(error, trace);
33+
}
34+
},
35+
);
3336
}
3437

3538
Stream<Null> asStream() {

tests/language/async/await_incompatible_test.dart

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ extension type SFE2(SFE _) implements SFE {}
3737
void main() async {
3838
// 1 (use rule 1).
3939
await N(Future<int>.value(1));
40-
//^^^^^
41-
// [analyzer] COMPILE_TIME_ERROR.AWAIT_OF_INCOMPATIBLE_TYPE
42-
// ^^^^^^^^^^^^^^^^^^^^^^^
43-
// [cfe] The 'await' expression can't be used for an expression with an extension type that is not a subtype of 'Future'.
40+
// [error column 3, length 5]
41+
// [analyzer] COMPILE_TIME_ERROR.AWAIT_OF_INCOMPATIBLE_TYPE
42+
// ^
43+
// [cfe] The 'await' expression can't be used for an expression with an extension type that is not a subtype of 'Future'.
4444
await F(Future<int>.value(1));
4545

4646
N n = N(Future<int>.value(1));
@@ -50,10 +50,10 @@ void main() async {
5050

5151
// 2.1 (use rule 2 which in turn uses rule 1).
5252
await nq;
53-
//^^^^^
54-
// [analyzer] COMPILE_TIME_ERROR.AWAIT_OF_INCOMPATIBLE_TYPE
55-
// ^
56-
// [cfe] The 'await' expression can't be used for an expression with an extension type that is not a subtype of 'Future'.
53+
// [error column 3, length 5]
54+
// [analyzer] COMPILE_TIME_ERROR.AWAIT_OF_INCOMPATIBLE_TYPE
55+
// ^
56+
// [cfe] The 'await' expression can't be used for an expression with an extension type that is not a subtype of 'Future'.
5757

5858
await fq;
5959

@@ -70,34 +70,34 @@ void main() async {
7070
await fofq;
7171

7272
var fut = Future<int>.value(1);
73-
foo<Object?, N, F, N?, F?, FutureOr<N>, FutureOr<F>, FutureOr<N>?,
74-
FutureOr<F>?>(
75-
fut,
76-
N(fut),
77-
F(fut),
78-
null,
79-
null,
80-
N(fut),
81-
F(fut),
82-
N(fut),
83-
F(fut),
84-
);
73+
foo<
74+
Object?,
75+
N,
76+
F,
77+
N?,
78+
F?,
79+
FutureOr<N>,
80+
FutureOr<F>,
81+
FutureOr<N>?,
82+
FutureOr<F>?
83+
>(fut, N(fut), F(fut), null, null, N(fut), F(fut), N(fut), F(fut));
8584

8685
var sfe2 = SFE2(SFE(SF()));
8786
await sfe2;
8887
}
8988

9089
// Test type parameter types.
9190
void foo<
92-
X,
93-
XN extends N,
94-
XF extends F,
95-
XNQ extends N?,
96-
XFQ extends F?,
97-
XFoN extends FutureOr<N>,
98-
XFoF extends FutureOr<F>,
99-
XFoNQ extends FutureOr<N>?,
100-
XFoFQ extends FutureOr<F>?>(
91+
X,
92+
XN extends N,
93+
XF extends F,
94+
XNQ extends N?,
95+
XFQ extends F?,
96+
XFoN extends FutureOr<N>,
97+
XFoF extends FutureOr<F>,
98+
XFoNQ extends FutureOr<N>?,
99+
XFoFQ extends FutureOr<F>?
100+
>(
101101
X x,
102102
XN xn,
103103
XF xf,
@@ -112,10 +112,10 @@ void foo<
112112

113113
// 4.1.
114114
await xn;
115-
//^^^^^
116-
// [analyzer] COMPILE_TIME_ERROR.AWAIT_OF_INCOMPATIBLE_TYPE
117-
// ^^
118-
// [cfe] The 'await' expression can't be used for an expression with an extension type that is not a subtype of 'Future'.
115+
// [error column 3, length 5]
116+
// [analyzer] COMPILE_TIME_ERROR.AWAIT_OF_INCOMPATIBLE_TYPE
117+
// ^
118+
// [cfe] The 'await' expression can't be used for an expression with an extension type that is not a subtype of 'Future'.
119119

120120
await xf;
121121
await xfon;
@@ -125,10 +125,10 @@ void foo<
125125

126126
// 4.2.
127127
await xnq;
128-
//^^^^^
129-
// [analyzer] COMPILE_TIME_ERROR.AWAIT_OF_INCOMPATIBLE_TYPE
130-
// ^^^
131-
// [cfe] The 'await' expression can't be used for an expression with an extension type that is not a subtype of 'Future'.
128+
// [error column 3, length 5]
129+
// [analyzer] COMPILE_TIME_ERROR.AWAIT_OF_INCOMPATIBLE_TYPE
130+
// ^
131+
// [cfe] The 'await' expression can't be used for an expression with an extension type that is not a subtype of 'Future'.
132132

133133
await xfq;
134134

tests/language/async/await_user_defined_future_soundness_test.dart

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,14 @@ class CustomFuture2<S, T> implements Future<T> {
5353

5454
void main() async {
5555
bool seenError = false;
56-
runZoned(() {
57-
foo(CustomFuture1());
58-
}, onError: (e, st) {
59-
seenError = true;
60-
});
56+
runZoned(
57+
() {
58+
foo(CustomFuture1());
59+
},
60+
onError: (e, st) {
61+
seenError = true;
62+
},
63+
);
6164
Expect.listEquals(<String>['Checkpoint 1', 'Checkpoint 2'], executionTrace);
6265
Expect.isTrue(seenError);
6366

tests/language/async/congruence_local_runtime_test.dart

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,12 +102,10 @@ main() {
102102
// `Future<Object>` but not `Future<int>`.
103103
Future<Object> v1 = f_inferred_futureObject();
104104

105-
106105
// Check that f_inferred_A's static return type is `Future<A>`, by verifying
107106
// that its return value can be assigned to `Future<A>` but not
108107
// `Future<B>`.
109108
Future<A> v3 = f_inferred_A();
110-
111109
}
112110

113111
checkFutureObject(f_inferred_futureObject);

tests/language/async/congruence_local_test.dart

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,6 @@ main() {
101101
Future<int> v2 = f_inferred_futureObject();
102102
// ^^^^^^^^^^^^^^^^^^^^^^^^^
103103
// [analyzer] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT
104-
// ^
105104
// [cfe] A value of type 'Future<Object>' can't be assigned to a variable of type 'Future<int>'.
106105

107106
// Check that f_inferred_A's static return type is `Future<A>`, by verifying
@@ -111,7 +110,6 @@ main() {
111110
Future<B> v4 = f_inferred_A();
112111
// ^^^^^^^^^^^^^^
113112
// [analyzer] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT
114-
// ^
115113
// [cfe] A value of type 'Future<A>' can't be assigned to a variable of type 'Future<B>'.
116114
}
117115

tests/language/async/congruence_method_runtime_test.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ void checkStaticTypes(C c) {
7979
// that its return value can be assigned to `Future<A>` but not
8080
// `Future<B>`.
8181
Future<A> v1 = c.f_inferred_A();
82-
8382
}
8483

8584
void checkDynamic(dynamic tearoff) {

tests/language/async/congruence_unnamed_runtime_test.dart

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,12 +122,10 @@ main() {
122122
// `Future<Object>` but not `Future<int>`.
123123
Future<Object> v1 = f_inferred_futureObject();
124124

125-
126125
// Check that f_inferred_A's static return type is `Future<A>`, by verifying
127126
// that its return value can be assigned to `Future<A>` but not
128127
// `Future<B>`.
129128
Future<A> v3 = f_inferred_A();
130-
131129
}
132130

133131
checkFutureObject(f_inferred_futureObject);

tests/language/async/control_structures_test.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ asyncTryCatchLoop() async {
6363
}
6464

6565
asyncImplicitReturn() async {
66-
try {} catch (e) {} finally {}
66+
try {} catch (e) {
67+
} finally {}
6768
}
6869

6970
main() {

0 commit comments

Comments
 (0)