PsiExpression (PsiExpression operand, PsiType expectedTypeByParent) { if (expectedTypeByParent != null && !(operand instanceof PsiFunctionalExpression)) { try { final PsiExpression initializer = (PsiExpression)LambdaUtil.copyWithExpectedType(operand, expectedTypeByParent); if (initializer instanceof PsiMethodCallExpression) { JavaResolveResult newResult = ((PsiMethodCallExpression)initializer).resolveMethodGenerics(); if (newResult instanceof MethodCandidateInfo && ((MethodCandidateInfo)newResult).getInferenceErrorMessage() != null) { return null; } } return initializer; } catch (IncorrectOperationException ignore) {} } return operand; }