OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2013, 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 // Tests self referencing types. |
| 6 |
| 7 import "package:expect/expect.dart"; |
| 8 |
| 9 class Base<U, V> { |
| 10 get u => U; |
| 11 get v => V; |
| 12 } |
| 13 |
| 14 class Derived1<U, V> extends Base<Derived1<U, V>, |
| 15 Derived1<Derived2<V, U>, Derived2>> {} |
| 16 |
| 17 class Derived2<U, V> extends Base<Derived2<U, V>, |
| 18 Derived2<Derived1<V, U>, Derived1>> {} |
| 19 |
| 20 main() { |
| 21 var d = new Derived1<Derived1, Derived2>(); |
| 22 Expect.equals("Derived1<Derived1, Derived2>", d.u.toString()); |
| 23 Expect.equals("Derived1<Derived2<Derived2, Derived1>, Derived2>", |
| 24 d.v.toString()); |
| 25 Expect.isTrue(d is Derived1<Derived1, Derived2>); |
| 26 Expect.isFalse(d is Derived1<Derived1, Derived1>); |
| 27 Expect.isTrue(d is Base<Derived1<Derived1, Derived2>, |
| 28 Derived1<Derived2<Derived2, Derived1>, Derived2>>); |
| 29 Expect.isFalse(d is Base<Derived1<Derived1, Derived2>, |
| 30 Derived1<Derived2<Derived2, Derived2>, Derived2>>); |
| 31 } |
OLD | NEW |