boolean (PsiFunctionalExpression functionalExpression, final Consumer<? super PsiType> overloadProcessor) { LOG.assertTrue(PsiTypesUtil.getExpectedTypeByParent(functionalExpression) == null); PsiElement parent = functionalExpression.getParent(); PsiElement expr = functionalExpression; while (parent instanceof PsiParenthesizedExpression || parent instanceof PsiConditionalExpression) { if (parent instanceof PsiConditionalExpression && ((PsiConditionalExpression)parent).getThenExpression() != expr && ((PsiConditionalExpression)parent).getElseExpression() != expr) break; expr = parent; parent = parent.getParent(); } if (parent instanceof PsiExpressionList) { final PsiExpressionList expressionList = (PsiExpressionList)parent; final int lambdaIdx = getLambdaIdx(expressionList, functionalExpression); if (lambdaIdx > -1) { PsiElement gParent = expressionList.getParent(); if (gParent instanceof PsiAnonymousClass) { gParent = gParent.getParent(); } JavaResolveResult[] results = null; if (gParent instanceof PsiMethodCallExpression) { results = ((PsiMethodCallExpression)gParent).getMethodExpression().multiResolve(true); } else if (gParent instanceof PsiConstructorCall){ results = getConstructorCandidates((PsiConstructorCall)gParent); } if (results != null) { final Set<PsiType> types = new HashSet<>(); for (JavaResolveResult result : results) { Computable<PsiType> computeType = () -> getSubstitutedType(functionalExpression, true, lambdaIdx, result); final PsiType functionalExpressionType = results.length == 1 ? computeType.compute() : MethodCandidateInfo.ourOverloadGuard.doPreventingRecursion(functionalExpression, false, computeType); if (functionalExpressionType != null && types.add(functionalExpressionType)) { overloadProcessor.consume(functionalExpressionType); } } return true; } } } return false; }