OLD | NEW |
| (Empty) |
1 class A {} | |
2 | |
3 class B {} | |
4 | |
5 class AB1 extends A implements B {} | |
6 | |
7 class AB2 extends A implements B {} | |
8 | |
9 class BA1 extends B implements A {} | |
10 | |
11 class BA2 extends B implements A {} | |
12 | |
13 takeSubclassOfA(obj) { | |
14 // 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 | |
16 // there is one besides Object. | |
17 } | |
18 | |
19 takeSubclassOfB(obj) { | |
20 // Likewise, the analysis should infer that 'obj' is a subclass of B. | |
21 } | |
22 | |
23 main() { | |
24 takeSubclassOfA(new AB1()); | |
25 takeSubclassOfA(new AB2()); | |
26 | |
27 takeSubclassOfB(new BA1()); | |
28 takeSubclassOfB(new BA2()); | |
29 } | |
OLD | NEW |