accept intersection types in casts for 1.8 (IDEA-115720)

This commit is contained in:
anna
2013-10-31 16:35:38 +01:00
parent 47fee8e129
commit 5eb0e62d58
@@ -179,7 +179,15 @@ public class TypeConversionUtil {
}
return false;
}
else if (toType instanceof PsiIntersectionType) return false;
else if (toType instanceof PsiIntersectionType) {
if (fromType instanceof PsiClassType && ((PsiClassType)fromType).getLanguageLevel().isAtLeast(LanguageLevel.JDK_1_8)) {
for (PsiType conjunct : ((PsiIntersectionType)toType).getConjuncts()) {
if (!isNarrowingReferenceConversionAllowed(fromType, conjunct)) return false;
}
return true;
}
return false;
}
if (fromType instanceof PsiDisjunctionType) {
return isNarrowingReferenceConversionAllowed(((PsiDisjunctionType)fromType).getLeastUpperBound(), toType);