mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
forbid lambda in conditional inside cast context
This commit is contained in:
@@ -115,7 +115,7 @@ public class LambdaUtil {
|
||||
context instanceof PsiExpressionList ||
|
||||
context instanceof PsiParenthesizedExpression ||
|
||||
context instanceof PsiArrayInitializerExpression ||
|
||||
context instanceof PsiConditionalExpression;
|
||||
context instanceof PsiConditionalExpression && PsiTreeUtil.getParentOfType(context, PsiTypeCastExpression.class) == null;
|
||||
}
|
||||
|
||||
public static boolean isLambdaFullyInferred(PsiLambdaExpression expression, PsiType functionalInterfaceType) {
|
||||
|
||||
+1
@@ -23,5 +23,6 @@ interface II {
|
||||
class Test1 {
|
||||
void bar(boolean b){
|
||||
II ik = b ? (s)-> true : (s)->false;
|
||||
II ik1 = (II)(b ? <error descr="Lambda expression not expected here">(s)-> true</error> : <error descr="Lambda expression not expected here">(s)->false</error>);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user