| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 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 | 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 // Test of parameterized types with invalid bounds. | 5 // Test of parameterized types with invalid bounds. |
| 6 | 6 |
| 7 interface I<T extends num> { } | 7 interface I<T extends num> { } |
| 8 | 8 |
| 9 interface J<T> { } | 9 interface J<T> { } |
| 10 | 10 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 J j = a; /// 01: static type error | 21 J j = a; /// 01: static type error |
| 22 K k = a; /// 02: dynamic type error | 22 K k = a; /// 02: dynamic type error |
| 23 | 23 |
| 24 // In production mode, A<String> is subtype of I, but error in checked mode. | 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 | 25 var x = a is I; /// 03: dynamic type error |
| 26 | 26 |
| 27 // In both production and checked modes, A<String> is a subtype of I. | 27 // In both production and checked modes, A<String> is a subtype of I. |
| 28 Expect.isTrue(a is J); /// 04: static type error | 28 Expect.isTrue(a is J); /// 04: static type error |
| 29 | 29 |
| 30 // In both production and checked modes, A<String> is not a subtype of K. | 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 | 31 // However, while unsuccessfully trying to prove that A<String> is a K, |
| 32 // a malformed type is encountered in checked mode, resulting in a dynamic |
| 33 // type error. |
| 34 Expect.isTrue(a is !K); /// 05: dynamic type error |
| 32 } | 35 } |
| 33 | 36 |
| 34 a = new A<int>(); | 37 a = new A<int>(); |
| 35 | 38 |
| 36 { | 39 { |
| 37 I i = a; | 40 I i = a; |
| 38 J j = a; | 41 J j = a; |
| 39 K k = a; /// 06: dynamic type error | 42 K k = a; /// 06: dynamic type error |
| 40 | 43 |
| 41 // In both production and checked modes, A<int> is a subtype of I. | 44 // In both production and checked modes, A<int> is a subtype of I. |
| 42 Expect.isTrue(a is I); | 45 Expect.isTrue(a is I); |
| 43 | 46 |
| 44 // In both production and checked modes, A<int> is a subtype of J. | 47 // In both production and checked modes, A<int> is a subtype of J. |
| 45 Expect.isTrue(a is J); | 48 Expect.isTrue(a is J); |
| 46 | 49 |
| 47 // In both production and checked modes, A<int> is not a subtype of K. | 50 // In both production and checked modes, A<int> is not a subtype of K. |
| 48 Expect.isTrue(a is !K); | 51 Expect.isTrue(a is !K); |
| 49 } | 52 } |
| 50 } | 53 } |
| OLD | NEW |