IDEA-68684 Extra parenthesis and semicolon in inserted by smart completion of array type initializer in some cases

This commit is contained in:
peter
2011-09-23 20:21:55 +02:00
parent 0b72160b7a
commit 8fb263884a
5 changed files with 14 additions and 4 deletions
@@ -959,11 +959,10 @@ public class ExpectedTypesProvider {
private static TailType getMethodArgumentTailType(final PsiExpression argument, final int index, final PsiMethod method, final PsiSubstitutor substitutor,
final PsiParameter[] params) {
if (index >= params.length) {
if (index >= params.length || index == params.length - 2 && params[index + 1].isVarArgs()) {
return TailType.NONE;
}
if (index == params.length - 1 || index == params.length - 2 && params[index + 1].isVarArgs()) {
//myTailType = CompletionUtil.NONE_TAIL;
if (index == params.length - 1) {
final PsiElement call = argument.getParent().getParent();
if (call instanceof JspMethodCall) return TailType.NONE;
@@ -0,0 +1,5 @@
class Super {
void foo(String[] params, int... indices) {
foo(new String[<caret>], 0);
}
}
@@ -0,0 +1,5 @@
class Super {
void foo(String[] params, int... indices) {
foo(new <caret>, 0);
}
}
@@ -2,7 +2,7 @@ class Foooo {
int bar(int a, Object... varargs) {}
int foo() {
bar(hashCode())<caret>;
bar(hashCode()<caret>);
}
}
@@ -1010,6 +1010,7 @@ public class SmartTypeCompletionTest extends LightFixtureCompletionTestCase {
doItemTest();
}
public void testArrayInitializerBeforeVarargs() throws Throwable { doTest(); }
public void testInheritorMembers() throws Throwable { doTest(); }
public void testInheritorEnumMembers() throws Throwable { doTest(); }
public void testDuplicateMembersFromSuperClass() throws Throwable { doTest(); }