explicit type -> diamond: don't walk up throw lambda with explicit type

This commit is contained in:
Anna Kozlova
2017-09-06 10:53:10 +03:00
parent 18d71a7378
commit c14959d04c
@@ -153,9 +153,8 @@ public class PsiDiamondTypeUtil {
typeElement = ((PsiVariable)gParent).getTypeElement();
}
else if (gParent instanceof PsiReturnStatement) {
PsiMethod method = PsiTreeUtil.getParentOfType(gParent, PsiMethod.class);
LOG.assertTrue(method != null);
typeElement = method.getReturnTypeElement();
PsiElement method = PsiTreeUtil.getParentOfType(gParent, PsiMethod.class, PsiLambdaExpression.class);
typeElement = method instanceof PsiMethod ? ((PsiMethod)method).getReturnTypeElement() : null;
}
return typeElement != null && PsiAugmentProvider.getInferredType(typeElement) != null;
}