| OLD | NEW |
| 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 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 | 251 |
| 252 } | 252 } |
| 253 | 253 |
| 254 // All of the above as instance members in a class. | 254 // All of the above as instance members in a class. |
| 255 class B { | 255 class B { |
| 256 covariant /// 40: ok | 256 covariant /// 40: ok |
| 257 int x40; | 257 int x40; |
| 258 | 258 |
| 259 covariant int covariant; /// 40b: ok | 259 covariant int covariant; /// 40b: ok |
| 260 | 260 |
| 261 int covariant; /// 40c: ok | 261 int covariant; // /// 40c: ok |
| 262 | 262 |
| 263 // Getters may never have `covariant`. | 263 // Getters may never have `covariant`. |
| 264 covariant /// 41: compile-time error | 264 covariant /// 41: compile-time error |
| 265 int get x41 => 499; | 265 int get x41 => 499; |
| 266 | 266 |
| 267 void set x42( | 267 void set x42( |
| 268 covariant /// 42: ok | 268 covariant /// 42: ok |
| 269 int val) {} | 269 int val) {} |
| 270 | 270 |
| 271 // `covariant` in the wrong position. | 271 // `covariant` in the wrong position. |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 415 use(b.f51()); | 415 use(b.f51()); |
| 416 use(b.f52(2)); | 416 use(b.f52(2)); |
| 417 use(b.f53(2)); | 417 use(b.f53(2)); |
| 418 use(b.f54(3)); | 418 use(b.f54(3)); |
| 419 use(b.f55(3)); | 419 use(b.f55(3)); |
| 420 use(b.f56(3)); | 420 use(b.f56(3)); |
| 421 use(b.f57(3)); | 421 use(b.f57(3)); |
| 422 Expect.equals(12345, b.f58(12345)); | 422 Expect.equals(12345, b.f58(12345)); |
| 423 use(B.covariant); /// 59: continued | 423 use(B.covariant); /// 59: continued |
| 424 } | 424 } |
| OLD | NEW |