mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-05 01:50:56 +07:00
hide "illegal forward reference" warning for lambda (IDEA-91986)
This commit is contained in:
@@ -1729,7 +1729,7 @@ public class HighlightUtil {
|
||||
if (element == field.getInitializer()) return field;
|
||||
if (field instanceof PsiEnumConstant && element == ((PsiEnumConstant)field).getArgumentList()) return field;
|
||||
}
|
||||
if (element instanceof PsiClass || element instanceof PsiMethod) return null;
|
||||
if (element instanceof PsiClass || element instanceof PsiMethod || parent instanceof PsiLambdaExpression) return null;
|
||||
element = parent;
|
||||
}
|
||||
return null;
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
public class LambdaTest {
|
||||
Op lambda_fib = (n) -> (n < 2) ? 1 : lambda_fib.op(n - 1) + lambda_fib.op(n - 2);
|
||||
|
||||
{
|
||||
Op lambda_fib = (n) -> (n < 2) ? 1 : <error descr="Variable 'lambda_fib' might not have been initialized">lambda_fib</error>.op(n - 1) + lambda_fib.op(n - 2);
|
||||
}
|
||||
|
||||
interface Op {
|
||||
int op(int n);
|
||||
}
|
||||
}
|
||||
@@ -149,6 +149,10 @@ public class LambdaHighlightingTest extends LightDaemonAnalyzerTestCase {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testRecursiveAccess() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
private void doTest() throws Exception {
|
||||
doTest(BASE_PATH + "/" + getTestName(false) + ".java", false, false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user