| 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 // Test that instanceof works correctly with type variables. | 4 // Test that instanceof works correctly with type variables. | 
| 5 | 5 | 
| 6 // Test that partially typed generic instances are correctly constructed. | 6 // Test that partially typed generic instances are correctly constructed. | 
| 7 | 7 | 
| 8 // Test factory case. | 8 // Test factory case. | 
| 9 class Foo<K, V> { | 9 class Foo<K, V> { | 
| 10   Foo() { } | 10   Foo() { } | 
| (...skipping 20 matching lines...) Expand all  Loading... | 
| 31   var foo_int_num = new Foo<int, num>(); | 31   var foo_int_num = new Foo<int, num>(); | 
| 32   Expect.isTrue(foo_int_num is Foo<int, num>); | 32   Expect.isTrue(foo_int_num is Foo<int, num>); | 
| 33   Expect.isTrue(foo_int_num is !Foo<int, String>); | 33   Expect.isTrue(foo_int_num is !Foo<int, String>); | 
| 34   // foo_int_num.FooString() returns a Foo<int, String> | 34   // foo_int_num.FooString() returns a Foo<int, String> | 
| 35   Expect.isTrue(foo_int_num.FooString() is !Foo<int, num>); | 35   Expect.isTrue(foo_int_num.FooString() is !Foo<int, num>); | 
| 36   Expect.isTrue(foo_int_num.FooString() is Foo<int, String>); | 36   Expect.isTrue(foo_int_num.FooString() is Foo<int, String>); | 
| 37 | 37 | 
| 38   var foo_raw = new Foo(); | 38   var foo_raw = new Foo(); | 
| 39   Expect.isTrue(foo_raw is Foo<int, num>); | 39   Expect.isTrue(foo_raw is Foo<int, num>); | 
| 40   Expect.isTrue(foo_raw is Foo<int, String>); | 40   Expect.isTrue(foo_raw is Foo<int, String>); | 
| 41   // foo_raw.FooString() returns a Foo<Dynamic, String> | 41   // foo_raw.FooString() returns a Foo<dynamic, String> | 
| 42   Expect.isTrue(foo_raw.FooString() is !Foo<int, num>); | 42   Expect.isTrue(foo_raw.FooString() is !Foo<int, num>); | 
| 43   Expect.isTrue(foo_raw.FooString() is Foo<int, String>); | 43   Expect.isTrue(foo_raw.FooString() is Foo<int, String>); | 
| 44 | 44 | 
| 45   var moo_int_num = new Moo<int, num>(); | 45   var moo_int_num = new Moo<int, num>(); | 
| 46   Expect.isTrue(moo_int_num is Moo<int, num>); | 46   Expect.isTrue(moo_int_num is Moo<int, num>); | 
| 47   Expect.isTrue(moo_int_num is !Moo<int, String>); | 47   Expect.isTrue(moo_int_num is !Moo<int, String>); | 
| 48   // moo_int_num.MooString() returns a Moo<int, String> | 48   // moo_int_num.MooString() returns a Moo<int, String> | 
| 49   Expect.isTrue(moo_int_num.MooString() is !Moo<int, num>); | 49   Expect.isTrue(moo_int_num.MooString() is !Moo<int, num>); | 
| 50   Expect.isTrue(moo_int_num.MooString() is Moo<int, String>); | 50   Expect.isTrue(moo_int_num.MooString() is Moo<int, String>); | 
| 51 | 51 | 
| 52   var moo_raw = new Moo(); | 52   var moo_raw = new Moo(); | 
| 53   Expect.isTrue(moo_raw is Moo<int, num>); | 53   Expect.isTrue(moo_raw is Moo<int, num>); | 
| 54   Expect.isTrue(moo_raw is Moo<int, String>); | 54   Expect.isTrue(moo_raw is Moo<int, String>); | 
| 55   // moo_raw.MooString() returns a Moo<Dynamic, String> | 55   // moo_raw.MooString() returns a Moo<dynamic, String> | 
| 56   Expect.isTrue(moo_raw.MooString() is !Moo<int, num>); | 56   Expect.isTrue(moo_raw.MooString() is !Moo<int, num>); | 
| 57   Expect.isTrue(moo_raw.MooString() is Moo<int, String>); | 57   Expect.isTrue(moo_raw.MooString() is Moo<int, String>); | 
| 58 } | 58 } | 
| 59 | 59 | 
| 60 | 60 | 
| 61 main() { | 61 main() { | 
| 62   // Repeat type checks so that inlined tests can be tested as well. | 62   // Repeat type checks so that inlined tests can be tested as well. | 
| 63   for (int i = 0; i < 5; i++) { | 63   for (int i = 0; i < 5; i++) { | 
| 64     testAll(); | 64     testAll(); | 
| 65   } | 65   } | 
| 66 } | 66 } | 
| OLD | NEW | 
|---|