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 generic methods can be overridden. |
| 6 |
| 7 library generic_methods_overriding_test; |
| 8 |
| 9 import "test_base.dart"; |
| 10 |
| 11 class X {} |
| 12 |
| 13 class Y extends X {} |
| 14 |
| 15 class C { |
| 16 String fun<T extends Y>(T t) => "C"; |
| 17 } |
| 18 |
| 19 class D extends C { |
| 20 String fun<T extends Y>(T t) => "D"; |
| 21 } |
| 22 |
| 23 main() { |
| 24 Y y = new Y(); |
| 25 |
| 26 C c = new C(); |
| 27 D d = new D(); |
| 28 |
| 29 expectTrue(c.fun<Y>(y) == "C"); |
| 30 expectTrue(d.fun<Y>(y) == "D"); |
| 31 } |
OLD | NEW |