mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-05 01:50:56 +07:00
lambda: process lambda as parameter for anonymous class (IDEA-116987)
This commit is contained in:
@@ -455,7 +455,12 @@ public class LambdaUtil {
|
||||
if (!tryToSubstitute) return cachedType;
|
||||
}
|
||||
|
||||
final PsiElement gParent = expressionList.getParent();
|
||||
PsiElement gParent = expressionList.getParent();
|
||||
|
||||
if (gParent instanceof PsiAnonymousClass) {
|
||||
gParent = gParent.getParent();
|
||||
}
|
||||
|
||||
if (gParent instanceof PsiCall) {
|
||||
final PsiCall contextCall = (PsiCall)gParent;
|
||||
final JavaResolveResult resolveResult = contextCall.resolveMethodGenerics();
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
interface I<T> {
|
||||
void accept(T t);
|
||||
}
|
||||
|
||||
class LamdbaTest<T> {
|
||||
|
||||
public void f() {
|
||||
new A<T>(t -> g(t)) {};
|
||||
}
|
||||
|
||||
private void g(T t) {
|
||||
}
|
||||
|
||||
class A<T2> {
|
||||
public A(I<T> editor) {
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -82,6 +82,10 @@ public class NewLambdaHighlightingTest extends LightDaemonAnalyzerTestCase {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testArgumentOfAnonymousClass() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
private void doTest() {
|
||||
doTest(false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user