| 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 class A { | 5 class A { |
| 6 } | 6 } |
| 7 | 7 |
| 8 class B extends A { | 8 class B extends A { |
| 9 } | 9 } |
| 10 | 10 |
| 11 class C implements B { | 11 class C extends B { |
| 12 } | 12 } |
| 13 | 13 |
| 14 int inscrutable(int x) => x == 0 ? 0 : x | inscrutable(x & (x - 1)); | 14 class D implements C { |
| 15 } |
| 16 |
| 17 int inscrutable(int x) => (x == 0) ? 0 : (x | inscrutable(x & (x - 1))); |
| 15 | 18 |
| 16 main() { | 19 main() { |
| 17 var things = [new A(), new B(), new C()]; | 20 var things = [new A(), new B(), new C(), new D()]; |
| 18 | 21 |
| 19 var a = things[inscrutable(0)]; | 22 var a = things[inscrutable(0)]; |
| 20 Expect.isTrue(a is A); | 23 Expect.isTrue(a is A); |
| 21 Expect.isFalse(a is B); | 24 Expect.isFalse(a is B); |
| 22 Expect.isFalse(a is C); | 25 Expect.isFalse(a is C); |
| 26 Expect.isFalse(a is D); |
| 23 | 27 |
| 24 var b = things[inscrutable(1)]; | 28 var b = things[inscrutable(1)]; |
| 25 Expect.isTrue(b is A); | 29 Expect.isTrue(b is A); |
| 26 Expect.isTrue(b is B); | 30 Expect.isTrue(b is B); |
| 27 Expect.isFalse(b is C); | 31 Expect.isFalse(b is C); |
| 32 Expect.isFalse(b is D); |
| 28 | 33 |
| 29 var c = things[inscrutable(2)]; | 34 var c = things[inscrutable(2)]; |
| 30 Expect.isTrue(c is A); | 35 Expect.isTrue(c is A); |
| 31 Expect.isTrue(c is B); | 36 Expect.isTrue(c is B); |
| 32 Expect.isTrue(c is C); | 37 Expect.isTrue(c is C); |
| 38 Expect.isFalse(c is D); |
| 39 |
| 40 var d = things[inscrutable(3)]; |
| 41 Expect.isTrue(d is A); |
| 42 Expect.isTrue(d is B); |
| 43 Expect.isTrue(d is C); |
| 44 Expect.isTrue(d is D); |
| 33 } | 45 } |
| OLD | NEW |