Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(496)

Side by Side Diff: tests/language/covariant_test.dart

Issue 2771453003: Format all tests. (Closed)
Patch Set: Format files Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 // Test that `covariant` can be parsed (and ignored) by 5 // Test that `covariant` can be parsed (and ignored) by
6 // dart2js and the VM. 6 // dart2js and the VM.
7 // This test only checks for non-strong mode behavior. 7 // This test only checks for non-strong mode behavior.
8 // 8 //
9 // Generally, `covariant` should be ignored, when it is used in the right 9 // Generally, `covariant` should be ignored, when it is used in the right
10 // places. 10 // places.
(...skipping 26 matching lines...) Expand all
37 covariant // //# 03: compile-time error 37 covariant // //# 03: compile-time error
38 x3; 38 x3;
39 39
40 int 40 int
41 covariant // //# 04: compile-time error 41 covariant // //# 04: compile-time error
42 get x4 => 499; 42 get x4 => 499;
43 43
44 void set x5( 44 void set x5(
45 int 45 int
46 covariant //# 05: compile-time error 46 covariant //# 05: compile-time error
47 val) {} 47 val) {}
48 48
49 // Same without types. 49 // Same without types.
50 50
51 // Since `covariant` is a built-in identifier, it is not allowed here. 51 // Since `covariant` is a built-in identifier, it is not allowed here.
52 covariant x6; // //# 06: compile-time error 52 covariant x6; // //# 06: compile-time error
53 53
54 covariant covariant; // //# 06b: compile-time error 54 covariant covariant; // //# 06b: compile-time error
55 55
56 // Getters may never have `covariant`. 56 // Getters may never have `covariant`.
57 covariant // //# 07: compile-time error 57 covariant // //# 07: compile-time error
(...skipping 20 matching lines...) Expand all
78 // It's a minor (acceptable) bug to not error out here. 78 // It's a minor (acceptable) bug to not error out here.
79 int f12( 79 int f12(
80 covariant //# 12: compile-time error 80 covariant //# 12: compile-time error
81 int x) => 81 int x) =>
82 499; 82 499;
83 83
84 // `Covariant` must be in front of the types. 84 // `Covariant` must be in front of the types.
85 int f13( 85 int f13(
86 int 86 int
87 covariant //# 13: compile-time error 87 covariant //# 13: compile-time error
88 x) => 88 x) =>
89 499; 89 499;
90 90
91 // Covariant should not work on top-level methods. 91 // Covariant should not work on top-level methods.
92 // It's a minor (acceptable) bug to not error out here. 92 // It's a minor (acceptable) bug to not error out here.
93 int f14( 93 int f14(
94 covariant //# 14: compile-time error 94 covariant //# 14: compile-time error
95 final x) => 95 final x) =>
96 499; 96 499;
97 97
98 // `Covariant` must be in front of modifiers. 98 // `Covariant` must be in front of modifiers.
99 int f15( 99 int f15(
100 final 100 final
101 covariant //# 15: compile-time error 101 covariant //# 15: compile-time error
102 x) => 102 x) =>
103 499; 103 499;
104 104
105 // Covariant should not work on top-level methods. 105 // Covariant should not work on top-level methods.
106 // It's a minor (acceptable) bug to not error out here. 106 // It's a minor (acceptable) bug to not error out here.
107 int f16( 107 int f16(
108 covariant //# 16: compile-time error 108 covariant //# 16: compile-time error
109 final int x) => 109 final int x) =>
110 499; 110 499;
111 111
112 // `Covariant` must be in front of modifiers. 112 // `Covariant` must be in front of modifiers.
113 int f17( 113 int f17(
114 final 114 final
115 covariant //# 17: compile-time error 115 covariant //# 17: compile-time error
116 int x) => 116 int
117 x) =>
117 499; 118 499;
118 119
119 // On its own, `covariant` is just a parameter name. 120 // On its own, `covariant` is just a parameter name.
120 int f18(covariant) => covariant; 121 int f18(covariant) => covariant;
121 122
122 covariant; // //# 19: compile-time error 123 covariant; // //# 19: compile-time error
123 124
124 // All of the above as statics in a class. 125 // All of the above as statics in a class.
125 class A { 126 class A {
126 // Static fields may not have a covariant. 127 // Static fields may not have a covariant.
(...skipping 28 matching lines...) Expand all
155 covariant // //# 23: compile-time error 156 covariant // //# 23: compile-time error
156 x23; 157 x23;
157 158
158 static int 159 static int
159 covariant // //# 24: compile-time error 160 covariant // //# 24: compile-time error
160 get x24 => 499; 161 get x24 => 499;
161 162
162 static void set x25( 163 static void set x25(
163 int 164 int
164 covariant //# 25: compile-time error 165 covariant //# 25: compile-time error
165 val) {} 166 val) {}
166 167
167 // Since `covariant` is a built-in identifier, it is not allowed here. 168 // Since `covariant` is a built-in identifier, it is not allowed here.
168 static covariant x26; //# 26: compile-time error 169 static covariant x26; //# 26: compile-time error
169 static covariant covariant; //# 26b: compile-time error 170 static covariant covariant; //# 26b: compile-time error
170 171
171 // Getters may never have `covariant`. 172 // Getters may never have `covariant`.
172 static 173 static
173 covariant // //# 27: compile-time error 174 covariant // //# 27: compile-time error
174 get x27 => 499; 175 get x27 => 499;
175 176
(...skipping 29 matching lines...) Expand all
205 // It's a minor (acceptable) bug to not error out here. 206 // It's a minor (acceptable) bug to not error out here.
206 static int f32( 207 static int f32(
207 covariant //# 32: compile-time error 208 covariant //# 32: compile-time error
208 int x) => 209 int x) =>
209 499; 210 499;
210 211
211 // `Covariant` must be in front of the types. 212 // `Covariant` must be in front of the types.
212 static int f33( 213 static int f33(
213 int 214 int
214 covariant //# 33: compile-time error 215 covariant //# 33: compile-time error
215 x) => 216 x) =>
216 499; 217 499;
217 218
218 // Covariant should not work on top-level methods. 219 // Covariant should not work on top-level methods.
219 // It's a minor (acceptable) bug to not error out here. 220 // It's a minor (acceptable) bug to not error out here.
220 static int f34( 221 static int f34(
221 covariant //# 34: compile-time error 222 covariant //# 34: compile-time error
222 final x) => 223 final x) =>
223 499; 224 499;
224 225
225 // `Covariant` must be in front of modifiers. 226 // `Covariant` must be in front of modifiers.
226 static int f35( 227 static int f35(
227 final 228 final
228 covariant //# 35: compile-time error 229 covariant //# 35: compile-time error
229 x) => 230 x) =>
230 499; 231 499;
231 232
232 // Covariant should not work on top-level methods. 233 // Covariant should not work on top-level methods.
233 // It's a minor (acceptable) bug to not error out here. 234 // It's a minor (acceptable) bug to not error out here.
234 static int f36( 235 static int f36(
235 covariant //# 36: compile-time error 236 covariant //# 36: compile-time error
236 final int x) => 237 final int x) =>
237 499; 238 499;
238 239
239 // `Covariant` must be in front of modifiers. 240 // `Covariant` must be in front of modifiers.
240 static int f37( 241 static int f37(
241 final 242 final
242 covariant //# 37: compile-time error 243 covariant //# 37: compile-time error
243 int x) => 244 int
245 x) =>
244 499; 246 499;
245 247
246 // `Covariant` on its own is just a parameter name. 248 // `Covariant` on its own is just a parameter name.
247 static int f38(covariant) => covariant; 249 static int f38(covariant) => covariant;
248 250
249 static covariant; // //# 39: compile-time error 251 static covariant; // //# 39: compile-time error
250 252
251 } 253 }
252 254
253 // All of the above as instance members in a class. 255 // All of the above as instance members in a class.
(...skipping 19 matching lines...) Expand all
273 x43; 275 x43;
274 276
275 // `covariant` in the wrong position. 277 // `covariant` in the wrong position.
276 int 278 int
277 covariant // //# 44: compile-time error 279 covariant // //# 44: compile-time error
278 get x44 => 499; 280 get x44 => 499;
279 281
280 void set x45( 282 void set x45(
281 int 283 int
282 covariant //# 45: compile-time error 284 covariant //# 45: compile-time error
283 val) {} 285 val) {}
284 286
285 // Since `covariant` is a built-in identifier, it is not allowed here. 287 // Since `covariant` is a built-in identifier, it is not allowed here.
286 covariant x46; //# 46: compile-time error 288 covariant x46; //# 46: compile-time error
287 covariant covariant; //# 46b: compile-time error 289 covariant covariant; //# 46b: compile-time error
288 290
289 // Getters may never have `covariant`. 291 // Getters may never have `covariant`.
290 covariant // //# 47: compile-time error 292 covariant // //# 47: compile-time error
291 get x47 => 499; 293 get x47 => 499;
292 294
293 void set x48( 295 void set x48(
(...skipping 13 matching lines...) Expand all
307 309
308 int f52( 310 int f52(
309 covariant // //# 52: ok 311 covariant // //# 52: ok
310 int x) => 312 int x) =>
311 499; 313 499;
312 314
313 // `Covariant` must be in front of the types. 315 // `Covariant` must be in front of the types.
314 int f53( 316 int f53(
315 int 317 int
316 covariant //# 53: compile-time error 318 covariant //# 53: compile-time error
317 x) => 319 x) =>
318 499; 320 499;
319 321
320 int f54( 322 int f54(
321 covariant // //# 54: ok 323 covariant // //# 54: ok
322 final x) => 324 final x) =>
323 499; 325 499;
324 326
325 // `Covariant` must be in front of modifiers. 327 // `Covariant` must be in front of modifiers.
326 int f55( 328 int f55(
327 final 329 final
328 covariant //# 55: compile-time error 330 covariant //# 55: compile-time error
329 x) => 331 x) =>
330 499; 332 499;
331 333
332 int f56( 334 int f56(
333 covariant // //# 56: ok 335 covariant // //# 56: ok
334 final int x) => 336 final int x) =>
335 499; 337 499;
336 338
337 // `Covariant` must be in front of modifiers. 339 // `Covariant` must be in front of modifiers.
338 int f57( 340 int f57(
339 final 341 final
340 covariant //# 57: compile-time error 342 covariant //# 57: compile-time error
341 int x) => 343 int
344 x) =>
342 499; 345 499;
343 346
344 // `Covariant` on its own is just a parameter name. 347 // `Covariant` on its own is just a parameter name.
345 int f58(covariant) => covariant; 348 int f58(covariant) => covariant;
346 349
347 covariant; // //# 59: compile-time error 350 covariant; // //# 59: compile-time error
348 } 351 }
349 352
350 void use(x) {} 353 void use(x) {}
351 354
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
419 use(b.f51()); 422 use(b.f51());
420 use(b.f52(2)); 423 use(b.f52(2));
421 use(b.f53(2)); 424 use(b.f53(2));
422 use(b.f54(3)); 425 use(b.f54(3));
423 use(b.f55(3)); 426 use(b.f55(3));
424 use(b.f56(3)); 427 use(b.f56(3));
425 use(b.f57(3)); 428 use(b.f57(3));
426 Expect.equals(12345, b.f58(12345)); 429 Expect.equals(12345, b.f58(12345));
427 use(B.covariant); // //# 59: continued 430 use(B.covariant); // //# 59: continued
428 } 431 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698