auto-import context variable declaration type when completing (IDEA-90157)

This commit is contained in:
peter
2014-07-22 18:26:56 +02:00
parent e353c2f0a6
commit 0299b302c6
3 changed files with 38 additions and 3 deletions
@@ -0,0 +1,5 @@
class Main<T extends Foo> {
{
List<Foo> list = new <caret>
}
}
@@ -1029,6 +1029,19 @@ public class SmartTypeCompletionTest extends LightFixtureCompletionTestCase {
assertStringItems("Bar", "Goo");
}
public void testAutoImportExpectedType() throws Throwable {
boolean old = CodeInsightSettings.getInstance().ADD_UNAMBIGIOUS_IMPORTS_ON_THE_FLY;
CodeInsightSettings.getInstance().ADD_UNAMBIGIOUS_IMPORTS_ON_THE_FLY = true;
try {
configureByTestName();
performAction();
myFixture.assertPreferredCompletionItems(1, "List", "ArrayList", "AbstractList");
}
finally {
CodeInsightSettings.getInstance().ADD_UNAMBIGIOUS_IMPORTS_ON_THE_FLY = old;
}
}
public void testNoWrongSubstitutorFromStats() throws Throwable {
doTest();
FileDocumentManager.getInstance().saveDocument(myFixture.getEditor().getDocument());