mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
incompatible types tooltip: ensure vararg parameter is shown when first arg is compatible
GitOrigin-RevId: 70cc20169203f5dc857e73a84548089b6ebebc3c
This commit is contained in:
committed by
intellij-monorepo-bot
parent
1ccce974ac
commit
628624c0c8
+10
-2
@@ -1036,12 +1036,20 @@ public class HighlightMethodUtil {
|
||||
parameterNameStyle += "background-color: " + ColorUtil.toHtmlColor(paramBgColor) + ";";
|
||||
}
|
||||
|
||||
boolean varargAdded = false;
|
||||
for (int i = 0; i < Math.max(parameters.length, expressions.length); i++) {
|
||||
PsiParameter parameter = i < parameters.length ? parameters[i] : null;
|
||||
PsiExpression expression = i < expressions.length ? expressions[i] : null;
|
||||
boolean varargs = info != null && info.isVarargs();
|
||||
if (assignmentCompatible(i, parameters, expressions, substitutor, varargs)) continue;
|
||||
PsiParameter parameter = null;
|
||||
if (i < parameters.length) {
|
||||
parameter = parameters[i];
|
||||
}
|
||||
else if (!varargAdded) {
|
||||
parameter = parameters[parameters.length - 1];
|
||||
varargAdded = true;
|
||||
}
|
||||
PsiType parameterType = substitutor.substitute(PsiTypesUtil.getParameterType(parameters, i, varargs));
|
||||
PsiExpression expression = i < expressions.length ? expressions[i] : null;
|
||||
boolean showShortType = HighlightUtil.showShortType(parameterType,
|
||||
expression != null ? expression.getType() : null);
|
||||
s.append("<tr>");
|
||||
|
||||
+1
-1
@@ -4,6 +4,6 @@ class MyTest {
|
||||
}
|
||||
|
||||
void test() {
|
||||
processStrings(<error descr="'processStrings(java.lang.String...)' in 'MyTest' cannot be applied to '(int, java.lang.String, java.lang.String)'">1</error>, "str", "s");
|
||||
processStrings("", <error descr="'processStrings(java.lang.String...)' in 'MyTest' cannot be applied to '(java.lang.String, int, java.lang.String, java.lang.String)'">1</error>, "str", "s");
|
||||
}
|
||||
}
|
||||
+5
-9
@@ -1101,15 +1101,11 @@ public class GenericsHighlighting8Test extends LightDaemonAnalyzerTestCase {
|
||||
int fontSize = StartupUiUtil.getLabelFont().getSize() - (SystemInfo.isWindows ? 0 : 1);
|
||||
String expected = "<html><body><table>" +
|
||||
"<tr>" +
|
||||
"<td/>" +
|
||||
"<td style='color: " + greyed + "; padding-left: 16px; padding-right: 24px;'>Required type</td>" +
|
||||
"<td style='color: " + greyed + "; padding-right: 28px;'>Provided</td></tr>" +
|
||||
"<tr>" +
|
||||
"<td><table><tr><td style='color: " + greyed + "; font-size:" + fontSize + "pt; padding:1px 4px 1px 4px;background-color: " + paramBgColor + ";'>charSequences:</td></tr></table></td>" +
|
||||
"<td style='padding-left: 16px; padding-right: 24px;'><font color='" + toolTipForeground + "'>CharSequence...</font></td>" +
|
||||
"<td style='padding-right: 28px;'><font color='" + red + "'>String</font></td></tr>" +
|
||||
"<tr><td/><td style='padding-left: 16px; padding-right: 24px;'/><td style='padding-right: 28px;'><font color='" + red + "'>int</font></td></tr>" +
|
||||
"<tr><td/><td style='padding-left: 16px; padding-right: 24px;'/><td style='padding-right: 28px;'><font color='" + red + "'>String</font></td></tr>" +
|
||||
"<td style='padding: 0px 16px 8px 4px;color: " + greyed + "'>Required type:</td>" +
|
||||
"<td style='padding: 0px 4px 8px 0px;'><font color='" + toolTipForeground + "'>CharSequence...</font></td>" +
|
||||
"</tr>" +
|
||||
"<tr><td style='padding: 0px 16px 0px 4px;color: " + greyed + "'>Provided:</td>" +
|
||||
"<td style='padding: 0px 4px 0px 0px;'><font color='" + red + "'>int</font></td></tr>" +
|
||||
"</table></body></html>";
|
||||
|
||||
doHighlighting()
|
||||
|
||||
Reference in New Issue
Block a user