IDEA-58858 Regression: Incorrect behavior on method name autocomplete if the next statement has a cast

This commit is contained in:
peter.gromov
2010-11-08 17:57:34 +03:00
parent f391453d32
commit 217ece149b
4 changed files with 20 additions and 0 deletions
@@ -922,6 +922,14 @@ public class JavaCompletionUtil {
// Invoke parameters popup
AutoPopupController.getInstance(file.getProject()).autoPopupParameterInfo(editor, overloadsMatter ? null : (PsiElement)item.getObject());
}
if (tailType == TailType.SEMICOLON) {
PsiDocumentManager.getInstance(file.getProject()).commitAllDocuments();
if (psiElement().beforeLeaf(psiElement().withText(".")).accepts(file.findElementAt(context.getTailOffset() - 1))) {
return;
}
}
if (tailType == TailType.SMART_COMPLETION || needLeftParenth && needRightParenth) {
tailType.processTail(editor, context.getTailOffset());
}
@@ -0,0 +1,5 @@
public class Beda {
{
System.out.printl<caret> ((String)"a").subSequence();
}
}
@@ -0,0 +1,5 @@
public class Beda {
{
System.out.println (<caret>(String)"a").subSequence();
}
}
@@ -596,6 +596,8 @@ public class NormalCompletionTest extends LightFixtureCompletionTestCase {
doTest();
}
public void testNoSemicolonAfterExistingParenthesesEspeciallyIfItsACast() throws Throwable { doTest(); }
public void testCaseTailType() throws Throwable { doTest(); }
def doPrimitiveTypeTest() {