first member in call chains should not have parameters (IDEA-110961)

This commit is contained in:
peter
2013-07-24 19:07:20 +02:00
parent 8fa4b8bc28
commit 8d2ba5aecb
3 changed files with 22 additions and 1 deletions
@@ -284,7 +284,9 @@ public class ReferenceExpressionCompletionContributor {
final PsiType expectedType = parameters.getExpectedType();
if (!OBJECT_METHOD_PATTERN.accepts(object) || allowGetClass(object, parameters)) {
if (parameters.getParameters().getInvocationCount() >= 3 || !itemType.equalsToText(CommonClassNames.JAVA_LANG_STRING)) {
addChainedCallVariants(element, baseItem, result, itemType, expectedType, parameters);
if (!(object instanceof PsiMethod && ((PsiMethod)object).getParameterList().getParametersCount() > 0)) {
addChainedCallVariants(element, baseItem, result, itemType, expectedType, parameters);
}
}
}
@@ -0,0 +1,15 @@
class Bar {
Goo getGoo(int a);
Goo getGoo2(int a);
}
class Goo {}
class Foo {
Bar getBar() {}
Bar getBar(int a) {}
{
Goo g = <caret>
}
}
@@ -38,6 +38,10 @@ public class SecondSmartTypeCompletionTest extends LightFixtureCompletionTestCas
configure();
assertStringItems("b.getGoo", "getBar().getGoo");
}
public void testFirstMethodWithParams() throws Throwable {
configure();
assertStringItems("getBar().getGoo", "getBar().getGoo2");
}
public void testSuggestArraysAsList() throws Throwable { doTest(); }
public void testSuggestArraysAsListWildcard() throws Throwable { doTest(); }