mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
SOE (IDEA-57264)
This commit is contained in:
@@ -18,8 +18,7 @@ package com.intellij.psi.util;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.roots.ProjectRootModificationTracker;
|
||||
import com.intellij.openapi.util.Comparing;
|
||||
import com.intellij.openapi.util.Key;
|
||||
import com.intellij.openapi.util.*;
|
||||
import com.intellij.pom.java.LanguageLevel;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.search.GlobalSearchScope;
|
||||
@@ -933,7 +932,9 @@ public class TypeConversionUtil {
|
||||
return true;
|
||||
}
|
||||
|
||||
public static boolean typesAgree(PsiType typeLeft, PsiType typeRight, boolean allowUncheckedConversion) {
|
||||
private static final RecursionGuard ourGuard = RecursionManager.createGuard("isAssignable");
|
||||
|
||||
public static boolean typesAgree(PsiType typeLeft, PsiType typeRight, final boolean allowUncheckedConversion) {
|
||||
if (typeLeft instanceof PsiWildcardType) {
|
||||
final PsiWildcardType leftWildcard = (PsiWildcardType)typeLeft;
|
||||
final PsiType leftBound = leftWildcard.getBound();
|
||||
@@ -949,7 +950,18 @@ public class TypeConversionUtil {
|
||||
return rightWildcard.isExtends() && isAssignable(leftBound, rightWildcard.getBound(), allowUncheckedConversion);
|
||||
}
|
||||
else { //isSuper
|
||||
return rightWildcard.isSuper() && isAssignable(rightWildcard.getBound(), leftBound, allowUncheckedConversion);
|
||||
if (rightWildcard.isSuper()) {
|
||||
final Boolean assignable = ourGuard.doPreventingRecursion(rightWildcard, true, new NotNullComputable<Boolean>() {
|
||||
@Override
|
||||
public Boolean compute() {
|
||||
return isAssignable(rightWildcard.getBound(), leftBound, allowUncheckedConversion);
|
||||
}
|
||||
});
|
||||
if (assignable != null && assignable.booleanValue()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
class A1<T> {}
|
||||
class B1<T extends A1<? super A1<? super T>>>{
|
||||
{
|
||||
T a = null;
|
||||
A1<? super T> b = a;
|
||||
}
|
||||
}
|
||||
|
||||
class A<T> {}
|
||||
class B<T extends A<? super A<? super T>>> {
|
||||
|
||||
void bar(T x){
|
||||
foo(x);
|
||||
}
|
||||
void foo(A<? super T> x){}
|
||||
void foo(Object x){}
|
||||
}
|
||||
@@ -170,6 +170,7 @@ public class GenericsHighlightingTest extends LightDaemonAnalyzerTestCase {
|
||||
public void testIDEA57495() throws Exception { doTest(false); }
|
||||
public void testIDEA57494() throws Exception { doTest(false); }
|
||||
public void testIDEA57496() throws Exception { doTest(false); }
|
||||
public void testIDEA57264() throws Exception { doTest(false); }
|
||||
public void testInconvertibleTypes() throws Exception { doTest(false); }
|
||||
public void testIncompatibleReturnType() throws Exception { doTest(false); }
|
||||
public void testContinueInferenceAfterFirstRawResult() throws Exception { doTest(false); }
|
||||
|
||||
Reference in New Issue
Block a user