new inference: capture nested call case fixed (~Collections)

This commit is contained in:
Anna Kozlova
2014-03-21 13:16:46 +01:00
parent ccd70ec219
commit 9845ef2fd8
4 changed files with 20 additions and 8 deletions
@@ -0,0 +1,15 @@
import java.util.Iterator;
class Test<K, V> {
private final Iterator<? extends Foo<? extends K, ? extends V>> i = null;
public Foo<K, V> next() {
return new Bar<>(i.next());
}
interface Foo<T, K> {}
private static class Bar<K, V> implements Foo<K, V> {
Bar(Foo<? extends K, ? extends V> e) {}
}
}
@@ -142,7 +142,7 @@ class S1 {
}
void bar(List<? extends S1> k) {
f<error descr="'f(java.util.List<capture<? extends S1>>, capture<? extends S1>)' in 'S1' cannot be applied to '(java.util.List<capture<? extends S1>>, capture<? extends S1>)'">(k, k.get(0))</error>;
f<error descr="'f(java.util.List<capture<? extends S1>>, capture<? extends S1>)' in 'S1' cannot be applied to '(java.util.List<capture<? extends S1>>, S1)'">(k, k.get(0))</error>;
}
}