mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
process intersection types correctly
This commit is contained in:
@@ -889,10 +889,10 @@ public class TypeConversionUtil {
|
||||
}
|
||||
else {
|
||||
if (leftWildcard.isExtends()) {
|
||||
return isAssignable(leftBound, typeRight, allowUncheckedConversion && !leftBound.accept(new WildcardDetector()));
|
||||
return isAssignable(leftBound, typeRight, allowUncheckedConversion && !containsWildcards(leftBound));
|
||||
}
|
||||
else { // isSuper
|
||||
return isAssignable(typeRight, leftBound, allowUncheckedConversion && !leftBound.accept(new WildcardDetector()));
|
||||
return isAssignable(typeRight, leftBound, allowUncheckedConversion && !containsWildcards(leftBound));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -901,6 +901,18 @@ public class TypeConversionUtil {
|
||||
}
|
||||
}
|
||||
|
||||
private static Boolean containsWildcards(PsiType leftBound) {
|
||||
final WildcardDetector wildcardDetector = new WildcardDetector();
|
||||
if (leftBound instanceof PsiIntersectionType) {
|
||||
for (PsiType conjunctType :((PsiIntersectionType)leftBound).getConjuncts()) {
|
||||
if (!conjunctType.accept(wildcardDetector)) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
return leftBound.accept(wildcardDetector);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static PsiSubstitutor getClassSubstitutor(@NotNull PsiClass superClassCandidate,
|
||||
@NotNull PsiClass derivedClassCandidate,
|
||||
@@ -1712,6 +1724,7 @@ public class TypeConversionUtil {
|
||||
|
||||
@Override
|
||||
public Boolean visitType(PsiType type) {
|
||||
//todo intersection types
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user