| 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 // VMOptions=--generic-method-syntax,--error-on-bad-type | 5 // VMOptions=--generic-method-syntax,--error-on-bad-type |
| 6 | 6 |
| 7 // Verify that function type parameter S can be resolved in bar. | 7 // Verify that function type parameter S can be resolved in bar. |
| 8 | 8 |
| 9 import "package:expect/expect.dart"; | 9 import "package:expect/expect.dart"; |
| 10 | 10 |
| 11 T foo<T extends num>(int i, T t) => i + t; | 11 T foo<T extends num>(int i, T t) => i + t; |
| 12 | 12 |
| 13 List<T Function<T extends num>(S, T)> bar<S extends num>() { | 13 List<T Function<T extends num>(S, T)> bar<S extends int>() { |
| 14 return <T Function<T extends num>(S, T)>[foo, foo]; | 14 return <T Function<T extends num>(S, T)>[foo, foo]; |
| 15 } | 15 } |
| 16 | 16 |
| 17 void main() { | 17 void main() { |
| 18 var list = bar<int>(); | 18 var list = bar<int>(); |
| 19 print(list[0] | 19 print(list[0] |
| 20 .runtimeType); // "(int, int) => int" when reifying generic functions. | 20 .runtimeType); // "<T extends num>(int, T) => T" when reifying generic fun
ctions. |
| 21 Expect.equals(123, list[1]<int>(100, 23)); | 21 Expect.equals(123, list[1]<int>(100, 23)); |
| 22 } | 22 } |
| OLD | NEW |