IDEA-119416 Smart type completion proposes nothing in String concatenation expressions

This commit is contained in:
peter
2014-01-17 19:11:11 +01:00
parent e323fe1c87
commit 032c188cd8
6 changed files with 28 additions and 1 deletions
@@ -666,7 +666,7 @@ public class ExpectedTypesProvider {
}
else if (i == JavaTokenType.PLUS) {
if (anotherType == null || anotherType.equalsToText(CommonClassNames.JAVA_LANG_STRING)) {
myResult = ExpectedTypeInfo.EMPTY_ARRAY;
myResult = new ExpectedTypeInfo[]{createInfoImpl(PsiType.getJavaLangObject(expr.getManager(), expr.getResolveScope()), ExpectedTypeInfo.TYPE_OR_SUBTYPE, anotherType, TailType.NONE)};
}
else if (PsiType.DOUBLE.isAssignableFrom(anotherType)) {
myResult = new ExpectedTypeInfo[]{createInfoImpl(PsiType.DOUBLE, ExpectedTypeInfo.TYPE_OR_SUBTYPE, anotherType, TailType.NONE)};
@@ -0,0 +1,8 @@
public class Test {
{
int abcdef = 2;
System.out.println("" + abcdef<caret>);
}
}
@@ -0,0 +1,8 @@
public class Test {
{
int abcdef = 2;
System.out.println("" + abc<caret>);
}
}
@@ -0,0 +1,6 @@
class Foo {
{
System.out.println("" + <caret>);
}
}
@@ -321,6 +321,10 @@ public class SmartTypeCompletionOrderingTest extends CompletionSortingTestCase {
checkPreferredItems 0, 'type', 'Object.class'
}
public void testPreferStringsInStringConcatenation() {
checkPreferredItems 0, 'toString'
}
@Override
protected String getBasePath() {
return JavaTestUtil.getRelativeJavaTestDataPath() + BASE_PATH;
@@ -1020,6 +1020,7 @@ public class SmartTypeCompletionTest extends LightFixtureCompletionTestCase {
public void testArrayInitializerBeforeVarargs() throws Throwable { doTest(); }
public void testDuplicateMembersFromSuperClass() throws Throwable { doTest(); }
public void testInnerAfterNew() throws Throwable { doTest(); }
public void testEverythingInStringConcatenation() throws Throwable { doTest(); }
public void testMemberImportStatically() {
configureByTestName();