boolean (PsiExpression expression, PsiType type, PsiType returnType) { if (returnType.isAssignableFrom(type)) return true; if (!(type instanceof PsiClassType) || !(returnType instanceof PsiClassType)) return false; if (!returnType.isAssignableFrom(TypeConversionUtil.erasure(type))) return false; PsiExpression copy = (PsiExpression)LambdaUtil.copyWithExpectedType(expression, returnType); PsiType copyType = copy.getType(); return copyType != null && returnType.isAssignableFrom(copyType); }