boolean (@NotNull PsiTypeElement castTypeElement, @NotNull PsiType castType) { if (castType instanceof PsiIntersectionType) return true; return castType instanceof PsiClassType && PsiTreeUtil.getChildrenOfType(castTypeElement, PsiTypeElement.class) != null; }