OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 // DartOptions=--generic-method-syntax | |
6 // VMOptions=--generic-method-syntax | 5 // VMOptions=--generic-method-syntax |
7 | 6 |
8 /// Dart test on the usage of method type arguments in a function typed | 7 /// Dart test on the usage of method type arguments in a function typed |
9 /// parameter declaration. | 8 /// parameter declaration. |
10 | 9 |
11 library generic_methods_function_type_test; | 10 library generic_methods_function_type_test; |
12 | 11 |
13 import "package:expect/expect.dart"; | 12 import "package:expect/expect.dart"; |
14 | 13 |
15 class C<V> { | 14 class C<V> { |
16 U m1<U>(U f(V v), V v) => f(v); | 15 U m1<U>(U f(V v), V v) => f(v); |
17 V m2<U>(V f(U v), U u) => f(u); | 16 V m2<U>(V f(U v), U u) => f(u); |
18 } | 17 } |
19 | 18 |
20 main() { | 19 main() { |
21 Expect.equals(new C<int>().m1<int>((x) => x, 10), 10); | 20 Expect.equals(new C<int>().m1<int>((x) => x, 10), 10); |
22 Expect.equals(new C<int>().m2<int>((x) => x, 20), 20); | 21 Expect.equals(new C<int>().m2<int>((x) => x, 20), 20); |
23 } | 22 } |
24 | 23 |
OLD | NEW |