mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
lambda recursive calls
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package com.intellij.psi;
|
||||
|
||||
import com.intellij.openapi.util.Computable;
|
||||
import com.intellij.psi.util.MethodSignature;
|
||||
import com.intellij.psi.util.PsiUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -58,8 +59,13 @@ public class LambdaHighlightingUtil {
|
||||
}
|
||||
} else if (functionalInterfaceReturnType != null) {
|
||||
final List<PsiExpression> returnExpressions = LambdaUtil.getReturnExpressions(lambdaExpression);
|
||||
for (PsiExpression expression : returnExpressions) {
|
||||
final PsiType expressionType = expression.getType();
|
||||
for (final PsiExpression expression : returnExpressions) {
|
||||
final PsiType expressionType = PsiResolveHelper.ourGraphGuard.doPreventingRecursion(expression, true, new Computable<PsiType>() {
|
||||
@Override
|
||||
public PsiType compute() {
|
||||
return expression.getType();
|
||||
}
|
||||
});
|
||||
if (expressionType != null && !functionalInterfaceReturnType.isAssignableFrom(expressionType)) {
|
||||
return "Incompatible return type " + expressionType.getPresentableText() + " in lambda expression";
|
||||
}
|
||||
|
||||
+1
@@ -97,6 +97,7 @@ public class PsiConditionalExpressionImpl extends ExpressionPsiElement implement
|
||||
if (type2 == null) return null;
|
||||
}
|
||||
|
||||
if (type1 instanceof PsiLambdaParameterType || type2 instanceof PsiLambdaParameterType) return null;
|
||||
final PsiType leastUpperBound = GenericsUtil.getLeastUpperBound(type1, type2, getManager());
|
||||
return leastUpperBound != null ? PsiUtil.captureToplevelWildcards(leastUpperBound, this) : null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user