do not go through foreach scope bound during unique variable name search (IDEA-131652)

This commit is contained in:
Anna Kozlova
2014-10-21 18:26:12 +02:00
parent e1b3c86e9f
commit 07be0cd30b
2 changed files with 14 additions and 1 deletions
@@ -905,7 +905,7 @@ public class JavaCodeStyleManagerImpl extends JavaCodeStyleManager {
continue NextName;
}
run = run.getNextSibling();
if (scope instanceof PsiMethod) {//do not check next member for param name conflict
if (scope instanceof PsiMethod || scope instanceof PsiForeachStatement) {//do not check next member for param name conflict
break;
}
}
@@ -43,6 +43,19 @@ class RenameSuggestionsTest extends LightCodeInsightTestCase {
doTestSuggestionAvailable(text, "foo")
}
public void "test foreach scope"() {
def text = """\
class Foo {
{
for (Foo <caret>f : new Foo[] {});
for (Foo foo : new Foo[] {});
}
}
"""
doTestSuggestionAvailable(text, "foo")
}
public void "test by super parameter name"() {
def text = """\
class Test {