PsiType () { final PsiElement parent = myPlaceToInferContext.getParent(); if (parent instanceof GrReturnStatement || myExitPoints.getValue().contains(myPlaceToInferContext)) { final GrMethod method = PsiTreeUtil.getParentOfType(parent, GrMethod.class, true, GrClosableBlock.class); if (method != null) { return method.getReturnType(); } } else if (parent instanceof GrAssignmentExpression && myPlaceToInferContext.equals(((GrAssignmentExpression)parent).getRValue())) { PsiElement lValue = PsiUtil.skipParentheses(((GrAssignmentExpression)parent).getLValue(), false); if ((lValue instanceof GrExpression) && !(lValue instanceof GrIndexProperty)) { return ((GrExpression)lValue).getNominalType(); } else { return null; } } else if (parent instanceof GrVariable) { return ((GrVariable)parent).getDeclaredType(); } return null; }