inference: ensure don't walk through explicitly specified type

This commit is contained in:
Anna.Kozlova
2017-02-08 17:16:37 +01:00
parent 9b0b5774a5
commit 2fc0560169
3 changed files with 25 additions and 1 deletions

View File

@@ -825,7 +825,7 @@ public class LambdaUtil {
break;
}
final PsiCall psiCall = PsiTreeUtil.getParentOfType(parent, PsiCall.class, false, PsiMember.class);
final PsiCall psiCall = PsiTreeUtil.getParentOfType(parent, PsiCall.class, false, PsiMember.class, PsiVariable.class);
if (psiCall == null) {
break;
}

View File

@@ -0,0 +1,20 @@
import java.util.function.Supplier;
interface DuallyParametric<A0> {
default <R> R match(Supplier<R> bFn) {
return null;
}
static <Ab> DuallyParametric<Ab> b() {
return null;
}
static void foldLeft(Runnable fn) {}
default void merge(DuallyParametric<A0> first) {
foldLeft(() -> {
Supplier<DuallyParametric<A0>> bDuallyParametricFunction = () -> first.match(() -> b());
});
}
}

View File

@@ -39,6 +39,10 @@ public class NewInferenceCollectingAdditionalConstraintsTest extends LightDaemon
doTest();
}
public void testNestedLambdaExpressionsWithTopStandaloneMethod() throws Exception {
doTest();
}
private void doTest() {
IdeaTestUtil.setTestVersion(JavaSdkVersion.JDK_1_8, getModule(), getTestRootDisposable());
doTest(BASE_PATH + "/" + getTestName(false) + ".java", true, false);