OLD | NEW |
(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 // Test that F-bounded quantification works for generic methods. |
| 6 |
| 7 library generic_methods_recursive_bound_test; |
| 8 |
| 9 import "test_base.dart"; |
| 10 |
| 11 abstract class I<T> { |
| 12 bool fun(T x); |
| 13 } |
| 14 |
| 15 int foo<T extends I<T>>(List<T> a) { |
| 16 if (a.length > 1) { |
| 17 a[0].fun(a[1]); |
| 18 } |
| 19 return a.length; |
| 20 } |
| 21 |
| 22 class C implements I<C> { |
| 23 bool fun(C c) => true; |
| 24 } |
| 25 |
| 26 main() { |
| 27 expectTrue(foo<C>(<C>[new C(), new C()]) == 2); |
| 28 } |
OLD | NEW |