| 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 |
| 5 // Test of parameterized types with invalid bounds. |
| 6 |
| 7 interface I<T extends num> { } |
| 8 |
| 9 interface J<T> { } |
| 10 |
| 11 interface K<T> { } |
| 12 |
| 13 class A<T> implements I<T>, J<T> { |
| 14 } |
| 15 |
| 16 main() { |
| 17 var a = new A<String>(); |
| 18 |
| 19 { |
| 20 I i = a; /// 00: dynamic type error |
| 21 J j = a; /// 01: static type error |
| 22 K k = a; /// 02: dynamic type error |
| 23 |
| 24 // In production mode, A<String> is subtype of I, but error in checked mode. |
| 25 var x = a is I; /// 03: dynamic type error |
| 26 |
| 27 // In both production and checked modes, A<String> is a subtype of I. |
| 28 Expect.isTrue(a is J); /// 04: static type error |
| 29 |
| 30 // In both production and checked modes, A<String> is not a subtype of K. |
| 31 Expect.isTrue(a is !K); /// 05: static type error |
| 32 } |
| 33 |
| 34 a = new A<int>(); |
| 35 |
| 36 { |
| 37 I i = a; |
| 38 J j = a; |
| 39 K k = a; /// 06: dynamic type error |
| 40 |
| 41 // In both production and checked modes, A<int> is a subtype of I. |
| 42 Expect.isTrue(a is I); |
| 43 |
| 44 // In both production and checked modes, A<int> is a subtype of J. |
| 45 Expect.isTrue(a is J); |
| 46 |
| 47 // In both production and checked modes, A<int> is not a subtype of K. |
| 48 Expect.isTrue(a is !K); |
| 49 } |
| 50 } |
| OLD | NEW |