OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2016, 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 _unique_method() => "foo"; |
| 9 bar() => "A"; |
| 10 } |
| 11 |
| 12 class B { |
| 13 noSuchMethod(invocation) => "nsm"; |
| 14 bar() => "B"; |
| 15 } |
| 16 |
| 17 confuse(x) { |
| 18 try { |
| 19 throw x; |
| 20 } catch (e) { |
| 21 return e; |
| 22 } |
| 23 return null; |
| 24 } |
| 25 |
| 26 main() { |
| 27 var a = confuse(new A()); |
| 28 Expect.equals("foo", a._unique_method()); |
| 29 Expect.equals("A", a.bar()); |
| 30 |
| 31 var b = confuse(new B()); |
| 32 Expect.equals("nsm", b._unique_method()); |
| 33 Expect.equals("B", b.bar()); // Don't propagate type A to b. |
| 34 } |
OLD | NEW |