boolean (PsiExpression expression) { PsiElement gParent = PsiUtil.skipParenthesizedExprUp(expression.getParent()); PsiTypeElement typeElement = null; if (gParent instanceof PsiVariable) { typeElement = ((PsiVariable)gParent).getTypeElement(); } else if (gParent instanceof PsiReturnStatement) { PsiElement method = PsiTreeUtil.getParentOfType(gParent, PsiMethod.class, PsiLambdaExpression.class); typeElement = method instanceof PsiMethod ? ((PsiMethod)method).getReturnTypeElement() : null; } return typeElement != null && PsiAugmentProvider.getInferredType(typeElement) != null; }