This commit is contained in:
Anna Kozlova
2014-04-22 13:37:47 +02:00
parent d5107d652f
commit 2c49817e26
3 changed files with 79 additions and 1 deletions

View File

@@ -65,7 +65,10 @@ public abstract class InputOutputConstraintFormula implements ConstraintFormula
}
}
collectReturnTypeVariables(session, psiExpression, substitutor.substitute(interfaceMethod.getReturnType()), result);
final PsiType returnType = interfaceMethod.getReturnType();
if (returnType != null) {
collectReturnTypeVariables(session, psiExpression, substitutor.substitute(returnType), result);
}
return result;
}

View File

@@ -0,0 +1,22 @@
class Test {
interface A {
A f();
}
interface B {}
static abstract class C implements A, B {}
static abstract class D implements A, B {}
interface I<T> {
<error descr="Invalid method declaration; return type required">m</error>(T arg);
}
void bar(C c) {
foo(c, x -> x.f());
foo(c, x -> x);
}
<T> void foo(T t1, I<T> t3) {}
}

View File

@@ -0,0 +1,53 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.codeInsight.daemon.lambda;
import com.intellij.codeInsight.daemon.LightDaemonAnalyzerTestCase;
import com.intellij.codeInspection.LocalInspectionTool;
import com.intellij.codeInspection.unusedSymbol.UnusedSymbolLocalInspection;
import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.testFramework.IdeaTestUtil;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
public class FunctionalExpressionIncompleteHighlightingTest extends LightDaemonAnalyzerTestCase {
@NonNls static final String BASE_PATH = "/codeInsight/daemonCodeAnalyzer/lambda/incomplete";
@NotNull
@Override
protected LocalInspectionTool[] configureLocalInspectionTools() {
return new LocalInspectionTool[]{
new UnusedSymbolLocalInspection(),
};
}
public void testMissedFunctionalInterfaceMethodReturnType() throws Exception {
doTest();
}
private void doTest() {
doTest(false);
}
private void doTest(final boolean checkWarnings) {
doTestNewInference(BASE_PATH + "/" + getTestName(false) + ".java", checkWarnings, false);
}
@Override
protected Sdk getProjectJDK() {
return IdeaTestUtil.getMockJdk18();
}
}