mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
do not go through foreach scope bound during unique variable name search (IDEA-131652)
This commit is contained in:
+1
-1
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user