| OLD | NEW |
| 1 // Copyright (c) 2017, 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 |
| 1 class A {} | 5 class A {} |
| 2 | 6 |
| 3 class B {} | 7 class B {} |
| 4 | 8 |
| 5 class AB1 extends A implements B {} | 9 class AB1 extends A implements B {} |
| 6 | 10 |
| 7 class AB2 extends A implements B {} | 11 class AB2 extends A implements B {} |
| 8 | 12 |
| 9 class BA1 extends B implements A {} | 13 class BA1 extends B implements A {} |
| 10 | 14 |
| 11 class BA2 extends B implements A {} | 15 class BA2 extends B implements A {} |
| 12 | 16 |
| 13 takeSubclassOfA(obj) { | 17 takeSubclassOfA(obj) { |
| 14 // The analysis should at least infer that 'obj' is a subclass of A, | 18 // The analysis should at least infer that 'obj' is a subclass of A, |
| 15 // When the upper bound is ambiguous, it should use the common superclass, if | 19 // When the upper bound is ambiguous, it should use the common superclass, if |
| 16 // there is one besides Object. | 20 // there is one besides Object. |
| 17 } | 21 } |
| 18 | 22 |
| 19 takeSubclassOfB(obj) { | 23 takeSubclassOfB(obj) { |
| 20 // Likewise, the analysis should infer that 'obj' is a subclass of B. | 24 // Likewise, the analysis should infer that 'obj' is a subclass of B. |
| 21 } | 25 } |
| 22 | 26 |
| 23 main() { | 27 main() { |
| 24 takeSubclassOfA(new AB1()); | 28 takeSubclassOfA(new AB1()); |
| 25 takeSubclassOfA(new AB2()); | 29 takeSubclassOfA(new AB2()); |
| 26 | 30 |
| 27 takeSubclassOfB(new BA1()); | 31 takeSubclassOfB(new BA1()); |
| 28 takeSubclassOfB(new BA2()); | 32 takeSubclassOfB(new BA2()); |
| 29 } | 33 } |
| OLD | NEW |