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 import "package:expect/expect.dart"; | 5 import "package:expect/expect.dart"; |
6 | 6 |
7 // Regression test for recursive inheritance patterns | 7 // Regression test for recursive inheritance patterns |
8 abstract class Comparable<T> { | 8 abstract class Comparable<T> { |
9 int compare(T a); | 9 int compareTo(T a); |
10 } | 10 } |
11 class MI<T extends MI<T>> { | 11 class MI<T extends MI<T>> {} |
12 } | 12 |
| 13 class _MI extends MI<_MI> {} |
13 | 14 |
14 class PMI<T extends Comparable<T>> extends MI<PMI<T>> {} | 15 class PMI<T extends Comparable<T>> extends MI<PMI<T>> {} |
15 | 16 |
| 17 class _PMI extends PMI<_PMI> implements Comparable<_PMI> { |
| 18 int compareTo(_PMI other) => throw new UnimplementedError(); |
| 19 } |
| 20 |
16 void main() { | 21 void main() { |
17 var a = new MI(); | 22 MI a = new MI<_MI>(); |
18 var b = new PMI(); | 23 PMI b = new PMI<_PMI>(); |
19 a = b; | 24 a = b; |
20 Expect.isTrue(a is MI); | 25 Expect.isTrue(a is MI); |
21 Expect.isTrue(b is PMI); | 26 Expect.isTrue(b is PMI); |
22 Expect.isTrue(b is MI); | 27 Expect.isTrue(b is MI); |
23 Expect.isTrue(b is MI<PMI>); | 28 Expect.isTrue(b is MI<PMI>); |
24 } | 29 } |
OLD | NEW |