| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 // Test that instanceof works correctly with type variables. | 4 // Test that instanceof works correctly with type variables. |
| 5 | 5 |
| 6 part of GenericInstanceofTest.dart; |
| 7 |
| 6 class Foo<T> { | 8 class Foo<T> { |
| 7 Foo() {} | 9 Foo() {} |
| 8 | 10 |
| 9 bool isT(x) { // Untyped parameter to ensure that the static type | 11 bool isT(x) { // Untyped parameter to ensure that the static type |
| 10 // does not affect the result. | 12 // does not affect the result. |
| 11 return x is T; | 13 return x is T; |
| 12 } | 14 } |
| 13 | 15 |
| 14 bool isListT(x) { | 16 bool isListT(x) { |
| 15 return x is List<T>; | 17 return x is List<T>; |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 { | 120 { |
| 119 Foo foo = new Foo<String>(); | 121 Foo foo = new Foo<String>(); |
| 120 Expect.equals(true, foo.isListT(new List(5))); | 122 Expect.equals(true, foo.isListT(new List(5))); |
| 121 Expect.equals(false, foo.isListT(new List<Object>(5))); | 123 Expect.equals(false, foo.isListT(new List<Object>(5))); |
| 122 Expect.equals(false, foo.isListT(new List<int>(5))); | 124 Expect.equals(false, foo.isListT(new List<int>(5))); |
| 123 Expect.equals(false, foo.isListT(new List<num>(5))); | 125 Expect.equals(false, foo.isListT(new List<num>(5))); |
| 124 Expect.equals(true, foo.isListT(new List<String>(5))); | 126 Expect.equals(true, foo.isListT(new List<String>(5))); |
| 125 } | 127 } |
| 126 } | 128 } |
| 127 } | 129 } |
| OLD | NEW |