bring into scope: multiple vars in one declaration should be normalized (IDEA-62848 )

This commit is contained in:
anna
2010-12-13 15:55:43 +03:00
parent e68fb6bb8e
commit 64e3456f20
3 changed files with 21 additions and 1 deletions

View File

@@ -97,7 +97,7 @@ public class BringVariableIntoScopeFix implements IntentionAction {
public void invoke(@NotNull Project project, Editor editor, PsiFile file) throws IncorrectOperationException {
LOG.assertTrue(myOutOfScopeVariable != null);
PsiManager manager = file.getManager();
myOutOfScopeVariable.normalizeDeclaration();
PsiUtil.setModifierProperty(myOutOfScopeVariable, PsiModifier.FINAL, false);
PsiElement commonParent = PsiTreeUtil.findCommonParent(myOutOfScopeVariable, myUnresolvedReference);
LOG.assertTrue(commonParent != null);

View File

@@ -0,0 +1,11 @@
// "Bring 'int j' into Scope" "true"
class a {
void foo() {
int j;
{
int i;
j = 10;
}
System.out.println(<caret>j); // invoke "bring 'int j' into scope" quickfix here
}
}

View File

@@ -0,0 +1,9 @@
// "Bring 'int j' into Scope" "true"
class a {
void foo() {
{
int i, j = 10;
}
System.out.println(<caret>j); // invoke "bring 'int j' into scope" quickfix here
}
}