parameter info: current method preselection when there are varargs overloading (IDEA-168649)

This commit is contained in:
Anna.Kozlova
2017-03-16 10:33:07 +01:00
parent e217ea727d
commit d8c140ae13
6 changed files with 53 additions and 1 deletions

View File

@@ -245,7 +245,7 @@ public class MethodParameterInfoHandler implements ParameterInfoHandlerWithTabAc
PsiType parmType = parm.getType();
PsiType argType = arg.getType();
if (argType == null) continue;
if (parmType instanceof PsiEllipsisType && parmType.getArrayDimensions() == argType.getArrayDimensions() + 1) {
if (parmType instanceof PsiEllipsisType ) {
parmType = ((PsiEllipsisType)parmType).getComponentType();
}
parmType = substitutor.substitute(parmType);

View File

@@ -0,0 +1,8 @@
class Main {
static <T> void of(T t) {}
static <T> void of(T... t) {}
void foo(String... strs){
Main.of(st<caret>rs);
}
}

View File

@@ -0,0 +1,8 @@
class Main {
static <T> void of(T t) {}
static <T> void of(T... t) {}
void foo(String[] strs){
Main.of(st<caret>rs);
}
}

View File

@@ -0,0 +1,8 @@
class Main {
static <T> void of(T t) {}
static <T> void of(T... t) {}
void foo(){
Main.of("<caret>", "");
}
}

View File

@@ -0,0 +1,8 @@
class Main {
static <T> void of(T t) {}
static <T> void of(T... t) {}
void foo(){
Main.of("<caret>");
}
}

View File

@@ -76,6 +76,26 @@ public class ParameterInfoTest extends LightCodeInsightFixtureTestCase {
}
public void testSelectionWithGenerics() {
doTest2CandidatesWithPreselection();
}
public void testOverloadWithVarargs() {
doTest2CandidatesWithPreselection();
}
public void testOverloadWithVarargsMultipleArgs() {
doTest2CandidatesWithPreselection();
}
public void testOverloadWithVarargsSingleArg() {
doTest2CandidatesWithPreselection();
}
public void testOverloadWithVarargsArray() {
doTest2CandidatesWithPreselection();
}
private void doTest2CandidatesWithPreselection() {
myFixture.configureByFile(getTestName(false) + ".java");
MethodParameterInfoHandler handler = new MethodParameterInfoHandler();