hide "illegal forward reference" warning for lambda (IDEA-91986)

This commit is contained in:
anna
2012-09-25 11:09:20 +02:00
parent db73ee1ae1
commit 5c170f7eb5
3 changed files with 16 additions and 1 deletions

View File

@@ -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;

View File

@@ -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);
}
}

View File

@@ -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);
}