lambda: do not start inference from void type (IDEA-127596)

This commit is contained in:
Anna Kozlova
2014-07-21 12:12:28 +02:00
parent 6de6ee120b
commit 9b4912c5a0
3 changed files with 14 additions and 1 deletions
@@ -379,7 +379,7 @@ public class InferenceSession {
PsiType returnType = method.getReturnType();
if (!PsiType.VOID.equals(returnType) && returnType != null) {
PsiType targetType = getTargetType(context);
if (targetType != null) {
if (targetType != null && !PsiType.VOID.equals(targetType)) {
registerReturnTypeConstraints(PsiUtil.isRawSubstitutor(method, mySiteSubstitutor) ? returnType : mySiteSubstitutor.substitute(returnType), targetType);
}
}
@@ -0,0 +1,9 @@
class Executor<E> {
<K> void bar(Executor<K> e) {
Runnable r = () -> foo(e);
}
private <T> T foo(final Executor<T> e) {
return null;
}
}
@@ -88,6 +88,10 @@ public class NewLambdaHighlightingTest extends LightDaemonAnalyzerTestCase {
public void testIDEA126109() { doTest(); }
public void testIDEA126809() { doTest(); }
public void testIDEA127596() throws Exception {
doTest();
}
private void doTest() {
doTest(false);
}