Skip to content

Commit 0d63c97

Browse files
munificentCommit Queue
authored andcommitted
Reformat files in the top level of tests/language/.
Change-Id: I21e39caac0239bfe388e7c7f149723f3deafb87c Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/400221 Auto-Submit: Bob Nystrom <rnystrom@google.com> Commit-Queue: Lasse Nielsen <lrn@google.com> Reviewed-by: Lasse Nielsen <lrn@google.com>
1 parent bc521ee commit 0d63c97

6 files changed

+59
-39
lines changed

tests/language/explicit_type_instantiation_parsing_test.dart

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,9 @@ void main() {
169169

170170
// Parsed as instantiation, can't access statics on instantiated type literal.
171171
expect1<Class>(Z<X, X>.instance);
172-
// ^^^^^^^^
173-
// [analyzer] unspecified
172+
// ^^^^^^^^^^^^^^^^
173+
// [analyzer] COMPILE_TIME_ERROR.CLASS_INSTANTIATION_ACCESS_TO_MEMBER
174+
// ^
174175
// [cfe] Cannot access static member on an instantiated generic class.
175176

176177

@@ -260,13 +261,15 @@ void main() {
260261

261262
// This would be invalid even if `X` had an `any` member. See next.
262263
X<X>.any; // Invalid, Class does not have any static `any` member.
263-
// ^^^
264-
// [analyzer] unspecified
264+
// [error column 3, length 8]
265+
// [analyzer] COMPILE_TIME_ERROR.CLASS_INSTANTIATION_ACCESS_TO_MEMBER
266+
// ^
265267
// [cfe] Member not found: 'any'.
266268

267269
X<X>.instance; // Does have static `instance` member, can't access this way.
268-
// ^^^^^^^^
269-
// [analyzer] unspecified
270+
// [error column 3, length 13]
271+
// [analyzer] COMPILE_TIME_ERROR.CLASS_INSTANTIATION_ACCESS_TO_MEMBER
272+
// ^
270273
// [cfe] Cannot access static member on an instantiated generic class.
271274

272275
// Parse error.

tests/language/record_literal_test.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5+
// Don't let the formatter remove the trailing commas.
6+
// dart format off
7+
58
main() {
69
var record1 = (1, 2, a: 3, b: 4);
710
print(record1);

tests/language/record_type_test.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5+
// Don't let the formatter remove the trailing commas.
6+
// dart format off
7+
58
main() {
69
(int, int) record1 = (1, 2);
710
print(record1);

tests/language/regress_54994_test.dart

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,10 @@ void test1() {
2727
}
2828

2929
void test2() {
30-
final B1<num, num> a = kTrue
31-
? (B1<int, double>() as B1<num, num>)
32-
: (B2<double>() as B1<num, num>);
30+
final B1<num, num> a =
31+
kTrue
32+
? (B1<int, double>() as B1<num, num>)
33+
: (B2<double>() as B1<num, num>);
3334
Expect.isFalse(a is B2<int>);
3435
Expect.isFalse(a is B2<double>);
3536
Expect.isFalse(a is B2<num>); // Should be optimized to cid-range check.
@@ -85,7 +86,8 @@ class X<T extends num> {
8586
kTrue ? B2<List<T>>() : B1<List<T>, List<T>>();
8687
Expect.isTrue(a is B2<List<T>>); // Should be optimized to cid-range check.
8788
Expect.isTrue(
88-
a is B2<List<num>>); // Should be optimized to cid-range check.
89+
a is B2<List<num>>,
90+
); // Should be optimized to cid-range check.
8991
Expect.isTrue(a is B2<List<int>>);
9092
Expect.isFalse(a is B2<List<double>>);
9193
}

tests/language/static_weak_reference_error_test.dart

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ class A {
6161

6262
@pragma('weak-tearoff-reference')
6363
external T Function()? weakReference12<T>(T Function()? x);
64-
// ^
65-
// [cfe] Weak reference pragma can be used on a static method only.
64+
// ^
65+
// [cfe] Weak reference pragma can be used on a static method only.
6666
}
6767

6868
class B {
@@ -83,42 +83,42 @@ void main() {
8383
validWeakRef(B.validTarget); // OK
8484

8585
validWeakRef(B.new);
86-
//^
87-
// [cfe] The target of weak reference should be a tearoff of a static method.
86+
// [error column 3]
87+
// [cfe] The target of weak reference should be a tearoff of a static method.
8888

8989
validWeakRef(B.bar);
90-
//^
91-
// [cfe] The target of weak reference should be a tearoff of a static method.
90+
// [error column 3]
91+
// [cfe] The target of weak reference should be a tearoff of a static method.
9292

9393
validWeakRef(B.baz);
94-
//^
95-
// [cfe] The target of weak reference should be a tearoff of a static method.
94+
// [error column 3]
95+
// [cfe] The target of weak reference should be a tearoff of a static method.
9696

9797
validWeakRef(B().instanceMethod);
98-
//^
99-
// [cfe] The target of weak reference should be a tearoff of a static method.
98+
// [error column 3]
99+
// [cfe] The target of weak reference should be a tearoff of a static method.
100100

101101
final x = B.validTarget;
102102
validWeakRef(x);
103-
//^
104-
// [cfe] The target of weak reference should be a tearoff of a static method.
103+
// [error column 3]
104+
// [cfe] The target of weak reference should be a tearoff of a static method.
105105

106106
const y = B.validTarget;
107107
validWeakRef(y); // OK
108108

109109
validWeakRef(B.arg1);
110-
//^
111-
// [cfe] The target of weak reference should not take parameters.
110+
// [error column 3]
111+
// [cfe] The target of weak reference should not take parameters.
112112

113113
validWeakRef(B.arg2);
114-
//^
115-
// [cfe] The target of weak reference should not take parameters.
114+
// [error column 3]
115+
// [cfe] The target of weak reference should not take parameters.
116116

117117
validWeakRef(B.arg3);
118-
//^
119-
// [cfe] The target of weak reference should not take parameters.
118+
// [error column 3]
119+
// [cfe] The target of weak reference should not take parameters.
120120

121121
validWeakRef(B.arg4);
122-
//^
123-
// [cfe] The target of weak reference should not take parameters.
122+
// [error column 3]
123+
// [cfe] The target of weak reference should not take parameters.
124124
}

tests/language/syntax_helper.dart

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,17 @@ String syntax(Object? x) {
2828
return '{${x.map(syntax).join(', ')}}';
2929
} else if (x is Map) {
3030
if (x.isEmpty) return '{}';
31-
var entries = x.entries
32-
.map((entry) => '${syntax(entry.key)}: ${syntax(entry.value)}');
31+
var entries = x.entries.map(
32+
(entry) => '${syntax(entry.key)}: ${syntax(entry.value)}',
33+
);
3334
return '{ ${entries.join(', ')} }';
3435
} else if (x is String) {
3536
return json.encode(x);
3637
} else {
37-
throw UnimplementedError('Unknown syntax for $x. '
38-
'Consider adding to `SyntaxTracker.known`.');
38+
throw UnimplementedError(
39+
'Unknown syntax for $x. '
40+
'Consider adding to `SyntaxTracker.known`.',
41+
);
3942
}
4043
}
4144

@@ -58,18 +61,23 @@ class SyntaxTracker {
5861
static Map<Object?, String> known = {
5962
true: 'true',
6063
false: 'false',
61-
null: 'null'
64+
null: 'null',
6265
};
6366
}
6467

6568
/// Extension allowing us to detect the syntax of most operations performed on
6669
/// arbitrary types.
6770
extension SyntaxTrackingExtension on Object? {
68-
Object? method<T, U>([Object? x = absent, Object? y = absent]) => SyntaxTracker(
69-
'${syntax(this)}.method${SyntaxTracker.typeArgs(T, U)}${SyntaxTracker.args(x, y)}');
71+
Object? method<T, U>([
72+
Object? x = absent,
73+
Object? y = absent,
74+
]) => SyntaxTracker(
75+
'${syntax(this)}.method${SyntaxTracker.typeArgs(T, U)}${SyntaxTracker.args(x, y)}',
76+
);
7077

7178
Object? call<T, U>([Object? x = absent, Object? y = absent]) => SyntaxTracker(
72-
'${syntax(this)}${SyntaxTracker.typeArgs(T, U)}${SyntaxTracker.args(x, y)}');
79+
'${syntax(this)}${SyntaxTracker.typeArgs(T, U)}${SyntaxTracker.args(x, y)}',
80+
);
7381

7482
Object? get getter => SyntaxTracker('${syntax(this)}.getter');
7583

@@ -131,6 +139,7 @@ void checkSyntax(Object? x, String expectedSyntax) {
131139
}
132140

133141
Object? f<T, U>([Object? x = absent, Object? y = absent]) => SyntaxTracker(
134-
'f${SyntaxTracker.typeArgs(T, U)}${SyntaxTracker.args(x, y)}');
142+
'f${SyntaxTracker.typeArgs(T, U)}${SyntaxTracker.args(x, y)}',
143+
);
135144

136145
Object? x = SyntaxTracker('x');

0 commit comments

Comments
 (0)