new inference: captures should stay closed inside nested calls

This commit is contained in:
Anna Kozlova
2014-02-28 20:07:08 +01:00
parent e683dc8fc1
commit d8b3e5c7fd
4 changed files with 28 additions and 1 deletions
@@ -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>>, 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>>, capture<? extends S1>)'">(k, k.get(0))</error>;
}
}
@@ -0,0 +1,16 @@
class Test {
class Foo<K> {}
void test(Foo<? extends String> p) {
foo(bar(p)) ;
}
<T> T bar(Foo<T> p) {
return null;
}
<K> K foo(K p) {
return null;
}
}