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

Side by Side Diff: pkg/front_end/testcases/runtime_checks/covariant_generic_parameter_complex.dart

Issue 3006463002: Test some more complex cases of covariant generic parameters. (Closed)
Patch Set: Created 3 years, 4 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
« no previous file with comments | « no previous file | pkg/front_end/testcases/runtime_checks/covariant_generic_parameter_complex.dart.direct.expect » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 /*@testedFeatures=checks*/
6 library test;
7
8 class C<T> {
9 // List<T> is covariant in T so it needs checking
10 void f1(List<T> /*@checkFormal=semiSafe*/ x) {}
11
12 // () -> T is covariant in T so it needs checking
13 void f2(T /*@checkFormal=semiSafe*/ callback()) {}
14
15 // (T) -> T is partially covariant in T so it needs checking
16 void f3(T /*@checkFormal=semiSafe*/ callback(T x)) {}
17
18 // (T) -> void is contravariant in T so it doesn't need checking
19 void f4(void callback(T x)) {}
20 }
21
22 void g1(C<num> c, List<num> l) {
23 c.f1 /*@checkCall=interface(semiTyped:0)*/ (l);
24 }
25
26 void g2(C<num> c, num callback()) {
27 c.f2 /*@checkCall=interface(semiTyped:0)*/ (callback);
28 }
29
30 void g3(C<num> c, num callback(num x)) {
31 c.f3 /*@checkCall=interface(semiTyped:0)*/ (callback);
32 }
33
34 void g4(C<num> c, void callback(num x)) {
35 c.f4(callback);
36 }
37
38 main() {}
OLDNEW
« no previous file with comments | « no previous file | pkg/front_end/testcases/runtime_checks/covariant_generic_parameter_complex.dart.direct.expect » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698