IDEA-121400

This commit is contained in:
Anna Kozlova
2014-03-27 20:51:45 +01:00
parent b55c83742b
commit 84451e644a
5 changed files with 26 additions and 8 deletions

View File

@@ -512,7 +512,11 @@ public class PsiOldInferenceHelper implements PsiInferenceHelper {
PsiType patternType,
final ConstraintType constraintType,
final int depth) {
if (arg instanceof PsiCapturedWildcardType && (depth < 2 || constraintType != ConstraintType.EQUALS)) arg = ((PsiCapturedWildcardType)arg).getWildcard(); //reopen
if (arg instanceof PsiCapturedWildcardType && (depth < 2 ||
constraintType != ConstraintType.EQUALS ||
param instanceof PsiWildcardType)) {
arg = ((PsiCapturedWildcardType)arg).getWildcard(); //reopen
}
if (patternType.equals(param)) {
return processArgType(arg, constraintType, depth < 2);

View File

@@ -0,0 +1,13 @@
import java.util.*;
class Test<K,V> {
private final Map<? extends K, ? extends V> m = null;
{
f(m.entrySet());
}
private static <A, B> void f(Set<? extends Map.Entry<? extends A, ? extends B>> s) {}
}

View File

@@ -4,7 +4,7 @@ class A<T> {
}
void bar(A<?> x){
baz<error descr="'baz(A<A<? extends S>>)' in 'A' cannot be applied to '(A<A<capture<?>>>)'">(x.foo())</error>;
baz<error descr="'baz(A<A<?>>)' in 'A' cannot be applied to '(A<A<capture<?>>>)'">(x.foo())</error>;
}
<S> void baz(A<A<? extends S>> x){}

View File

@@ -17,14 +17,14 @@ class B<T> extends A<A<T>> {
foo2(sb);
foo2(s);
foo3<error descr="'foo3(A<A<? extends T>>)' in 'B' cannot be applied to '(B<capture<?>>)'">(b)</error>;
foo3<error descr="'foo3(A<A<? extends T>>)' in 'B' cannot be applied to '(B<capture<? extends java.lang.String>>)'">(eb)</error>;
foo3<error descr="'foo3(A<A<? extends T>>)' in 'B' cannot be applied to '(B<capture<? super java.lang.String>>)'">(sb)</error>;
foo3<error descr="'foo3(A<A<?>>)' in 'B' cannot be applied to '(B<capture<?>>)'">(b)</error>;
foo3<error descr="'foo3(A<A<? extends java.lang.String>>)' in 'B' cannot be applied to '(B<capture<? extends java.lang.String>>)'">(eb)</error>;
foo3<error descr="'foo3(A<A<?>>)' in 'B' cannot be applied to '(B<capture<? super java.lang.String>>)'">(sb)</error>;
foo3<error descr="'foo3(A<A<? extends java.lang.String>>)' in 'B' cannot be applied to '(B<java.lang.String>)'">(s)</error>;
foo4<error descr="'foo4(A<A<? super T>>)' in 'B' cannot be applied to '(B<capture<?>>)'">(b)</error>;
foo4<error descr="'foo4(A<A<? super T>>)' in 'B' cannot be applied to '(B<capture<? extends java.lang.String>>)'">(eb)</error>;
foo4<error descr="'foo4(A<A<? super T>>)' in 'B' cannot be applied to '(B<capture<? super java.lang.String>>)'">(sb)</error>;
foo4<error descr="'foo4(A<A<? super java.lang.Object>>)' in 'B' cannot be applied to '(B<capture<?>>)'">(b)</error>;
foo4<error descr="'foo4(A<A<? super java.lang.Object>>)' in 'B' cannot be applied to '(B<capture<? extends java.lang.String>>)'">(eb)</error>;
foo4<error descr="'foo4(A<A<? super java.lang.String>>)' in 'B' cannot be applied to '(B<capture<? super java.lang.String>>)'">(sb)</error>;
foo4<error descr="'foo4(A<A<? super java.lang.String>>)' in 'B' cannot be applied to '(B<java.lang.String>)'">(s)</error>;
foo5(b);

View File

@@ -339,6 +339,7 @@ public class GenericsHighlightingTest extends LightDaemonAnalyzerTestCase {
public void testIDEA118527() { doTest(LanguageLevel.JDK_1_7, JavaSdkVersion.JDK_1_7, false); }
public void testIDEA120153() { doTest(LanguageLevel.JDK_1_7, JavaSdkVersion.JDK_1_7, false); }
public void testIDEA120563() { doTest(LanguageLevel.JDK_1_7, JavaSdkVersion.JDK_1_7, false); }
public void testIDEA121400() { doTest(LanguageLevel.JDK_1_7, JavaSdkVersion.JDK_1_7, false); }
public void testJavaUtilCollections_NoVerify() throws Exception {
PsiClass collectionsClass = getJavaFacade().findClass("java.util.Collections", GlobalSearchScope.moduleWithLibrariesScope(getModule()));