mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
inference: propagate variable renames through the call hierarchy; calculate tooltips in tests (IDEA-151948)
This commit is contained in:
+34
@@ -16,11 +16,17 @@
|
||||
package com.intellij.codeInsight.daemon.lambda;
|
||||
|
||||
import com.intellij.codeInsight.daemon.LightDaemonAnalyzerTestCase;
|
||||
import com.intellij.codeInsight.daemon.impl.HighlightInfo;
|
||||
import com.intellij.lang.annotation.HighlightSeverity;
|
||||
import com.intellij.openapi.projectRoots.JavaSdkVersion;
|
||||
import com.intellij.openapi.projectRoots.Sdk;
|
||||
import com.intellij.testFramework.IdeaTestUtil;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
public class GraphInferenceHighlightingTest extends LightDaemonAnalyzerTestCase {
|
||||
@NonNls static final String BASE_PATH = "/codeInsight/daemonCodeAnalyzer/lambda/graphInference";
|
||||
|
||||
@@ -399,6 +405,34 @@ public class GraphInferenceHighlightingTest extends LightDaemonAnalyzerTestCase
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testVariableNamesOfNestedCalls() throws Exception {
|
||||
IdeaTestUtil.setTestVersion(JavaSdkVersion.JDK_1_8, getModule(), getTestRootDisposable());
|
||||
String filePath = BASE_PATH + "/" + getTestName(false) + ".java";
|
||||
configureByFile(filePath);
|
||||
Collection<HighlightInfo> infos = doHighlighting();
|
||||
|
||||
List<String> tooltips = new ArrayList<>();
|
||||
|
||||
for (HighlightInfo info : infos) {
|
||||
if (info.getSeverity() == HighlightSeverity.ERROR) {
|
||||
tooltips.add(info.getToolTip());
|
||||
}
|
||||
}
|
||||
|
||||
assertTrue(tooltips.contains("<html><body><table border=0><tr><td>" +
|
||||
"<b>identity( ) </b></td><td colspan=1>in <b>Function</b> cannot be applied</td></tr><tr><td>to</td><td><b>()</b> " +
|
||||
|
||||
"</td></tr></table><br/>" +
|
||||
"reason: no instance(s) of type variable(s) K, U exist so that Map<K, U> conforms to Function<U, V>" +
|
||||
"</body></html>"));
|
||||
assertTrue(tooltips.contains(
|
||||
"<html><body><table border=0><tr><td>" +
|
||||
"<b>identity( ) </b></td><td colspan=1>in <b>Function</b> cannot be applied</td></tr><tr><td>to</td><td><b>()</b> " +
|
||||
"</td></tr></table><br/>" +
|
||||
"reason: no instance(s) of type variable(s) K, U exist so that Map<K, U> conforms to Function<U, V>" +
|
||||
"</body></html>"));
|
||||
}
|
||||
|
||||
private void doTest() throws Exception {
|
||||
doTest(false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user