mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-05-06 05:10:22 +07:00
new inference: capture nested call case fixed (~Collections)
This commit is contained in:
@@ -494,13 +494,6 @@ public class PsiImplUtil {
|
||||
return PsiUtil.captureToplevelWildcards(type, expression);
|
||||
}
|
||||
|
||||
final PsiElement parent = toplevel.getParent();
|
||||
if (parent instanceof PsiExpressionList &&
|
||||
PsiUtil.isLanguageLevel8OrHigher(parent) &&
|
||||
parent.getParent() instanceof PsiCallExpression) {
|
||||
return PsiUtil.captureToplevelWildcards(type, expression);
|
||||
}
|
||||
|
||||
final PsiType normalized = doNormalizeWildcardByPosition(type, expression, toplevel);
|
||||
LOG.assertTrue(normalized.isValid(), type);
|
||||
if (normalized instanceof PsiClassType && !PsiUtil.isAccessedForWriting(toplevel)) {
|
||||
|
||||
@@ -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>;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -747,6 +747,10 @@ public class GenericsHighlighting8Test extends LightDaemonAnalyzerTestCase {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testCaptureInsideNestedCalls() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
private void doTest() {
|
||||
doTest(false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user