| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2012, 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 // Dart test program for testing the instanceof operation. | |
| 5 | |
| 6 // Tests involving generics. | |
| 7 | |
| 8 interface I<T> { | |
| 9 } | |
| 10 | |
| 11 | |
| 12 class A implements I<bool> { | |
| 13 } | |
| 14 | |
| 15 | |
| 16 class B<T> implements I<bool> { | |
| 17 } | |
| 18 | |
| 19 | |
| 20 interface K<T> { | |
| 21 | |
| 22 } | |
| 23 | |
| 24 interface L<T> extends K<bool> { | |
| 25 | |
| 26 } | |
| 27 | |
| 28 | |
| 29 class C implements L<String> { | |
| 30 | |
| 31 } | |
| 32 | |
| 33 | |
| 34 class D implements B<String> { | |
| 35 | |
| 36 } | |
| 37 | |
| 38 | |
| 39 | |
| 40 main() { | |
| 41 var a = new A(); | |
| 42 var b = new B<String>(); | |
| 43 var c = new C(); | |
| 44 var d = new D(); | |
| 45 // Repeat type checks so that inlined tests can be tested as well. | |
| 46 for (int i = 0; i < 5; i++) { | |
| 47 Expect.isFalse(a is I<String>); | |
| 48 Expect.isTrue(a is I<bool>); | |
| 49 Expect.isFalse(b is I<String>); | |
| 50 Expect.isFalse(c is K<String>); | |
| 51 Expect.isFalse(c is K<String>); | |
| 52 Expect.isTrue(c is L<String>); | |
| 53 Expect.isFalse(c is L<bool>); | |
| 54 Expect.isTrue(c is K<bool>); | |
| 55 Expect.isFalse(c is K<String>); | |
| 56 Expect.isFalse(d is I<String>); | |
| 57 Expect.isTrue(d is I<bool>); | |
| 58 } | |
| 59 } | |
| OLD | NEW |