OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2014, 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 import "package:expect/expect.dart"; |
| 6 |
| 7 class A { |
| 8 int call(String str) => 499; |
| 9 } |
| 10 |
| 11 typedef int F(String str); |
| 12 |
| 13 main() { |
| 14 var a = new A(); |
| 15 if (a is Function) { |
| 16 Expect.isTrue(a is A); |
| 17 } else { |
| 18 Expect.fail("a should be a Function"); |
| 19 } |
| 20 |
| 21 var a2 = new A(); |
| 22 if (a2 is F) { |
| 23 Expect.isTrue(a2 is A); |
| 24 } else { |
| 25 Expect.fail("a2 should be an F"); |
| 26 } |
| 27 |
| 28 Function a3 = new A(); |
| 29 // Dart2Js mistakenly assumed that Function and A couldn't be related and |
| 30 // returned false for a is A. |
| 31 Expect.isTrue(a3 is A); |
| 32 |
| 33 F a4 = new A(); |
| 34 Expect.isTrue(a4 is A); |
| 35 } |
OLD | NEW |