| 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 /*@testedFeatures=checks*/ | 5 /*@testedFeatures=checks*/ |
| 6 library test; | 6 library test; |
| 7 | 7 |
| 8 class C<T> { | 8 class C<T> { |
| 9 // List<T> is covariant in T so it needs checking | 9 // List<T> is covariant in T so it needs checking |
| 10 void f1(List<T> /*@checkFormal=semiSafe*/ x) {} | 10 void f1(List<T> /*@checkFormal=semiSafe*/ /*@checkInterface=semiTyped*/ x) {} |
| 11 | 11 |
| 12 // () -> T is covariant in T so it needs checking | 12 // () -> T is covariant in T so it needs checking |
| 13 void f2(T /*@checkFormal=semiSafe*/ callback()) {} | 13 void f2( |
| 14 T /*@checkFormal=semiSafe*/ /*@checkInterface=semiTyped*/ callback()) {} |
| 14 | 15 |
| 15 // (T) -> T is partially covariant in T so it needs checking | 16 // (T) -> T is partially covariant in T so it needs checking |
| 16 void f3(T /*@checkFormal=semiSafe*/ callback(T x)) {} | 17 void f3( |
| 18 T /*@checkFormal=semiSafe*/ /*@checkInterface=semiTyped*/ callback( |
| 19 T x)) {} |
| 17 | 20 |
| 18 // (T) -> void is contravariant in T so it doesn't need checking | 21 // (T) -> void is contravariant in T so it doesn't need checking |
| 19 void f4(void callback(T x)) {} | 22 void f4(void callback(T x)) {} |
| 20 } | 23 } |
| 21 | 24 |
| 22 void g1(C<num> c, List<num> l) { | 25 void g1(C<num> c, List<num> l) { |
| 23 c.f1 /*@checkCall=interface(semiTyped:0)*/ (l); | 26 c.f1(l); |
| 24 } | 27 } |
| 25 | 28 |
| 26 void g2(C<num> c, num callback()) { | 29 void g2(C<num> c, num callback()) { |
| 27 c.f2 /*@checkCall=interface(semiTyped:0)*/ (callback); | 30 c.f2(callback); |
| 28 } | 31 } |
| 29 | 32 |
| 30 void g3(C<num> c, num callback(num x)) { | 33 void g3(C<num> c, num callback(num x)) { |
| 31 c.f3 /*@checkCall=interface(semiTyped:0)*/ (callback); | 34 c.f3(callback); |
| 32 } | 35 } |
| 33 | 36 |
| 34 void g4(C<num> c, void callback(num x)) { | 37 void g4(C<num> c, void callback(num x)) { |
| 35 c.f4(callback); | 38 c.f4(callback); |
| 36 } | 39 } |
| 37 | 40 |
| 38 main() {} | 41 main() {} |
| OLD | NEW |