mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
lambda: inference param types for assignment and cast context
This commit is contained in:
@@ -2630,8 +2630,11 @@ public class HighlightUtil {
|
||||
public static HighlightInfo checkLambdaFeature(final PsiLambdaExpression expression) {
|
||||
final HighlightInfo info = checkFeature(expression, Feature.LAMBDA_EXPRESSIONS);
|
||||
if (info != null) return info;
|
||||
// todo[r.sh] stub; remove after implementing support in TypeConversionUtil
|
||||
final String message = "Lambda expressions type check is not yet implemented";
|
||||
return HighlightInfo.createHighlightInfo(HighlightInfoType.WEAK_WARNING, expression, message);
|
||||
if (expression.getParent() instanceof PsiExpressionList) {
|
||||
// todo[r.sh] stub; remove after implementing support in TypeConversionUtil
|
||||
final String message = "Lambda expressions type check is not yet implemented";
|
||||
return HighlightInfo.createHighlightInfo(HighlightInfoType.WEAK_WARNING, expression, message);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
+6
-7
@@ -36,13 +36,12 @@ public class JavaHighlightInfoFilter implements HighlightInfoFilter {
|
||||
|
||||
final PsiElement element = file.findElementAt(info.getStartOffset());
|
||||
if (element == null) return true;
|
||||
|
||||
return !isInsideLambda(element) &&
|
||||
!isLambdaInAmbiguousCall(info, element);
|
||||
}
|
||||
|
||||
private static boolean isInsideLambda(final PsiElement element) {
|
||||
return PsiTreeUtil.getParentOfType(element, PsiLambdaExpression.class, false) != null;
|
||||
final PsiLambdaExpression lambdaExpression = PsiTreeUtil.getParentOfType(element, PsiLambdaExpression.class, false);
|
||||
if (lambdaExpression != null) {
|
||||
if (lambdaExpression.getParent() instanceof PsiExpressionList) return false;
|
||||
if (isLambdaInAmbiguousCall(info, element)) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private static boolean isLambdaInAmbiguousCall(final HighlightInfo info, final PsiElement element) {
|
||||
|
||||
Reference in New Issue
Block a user