mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
priority of array index expression (IDEA-147503)
This commit is contained in:
+1
-1
@@ -75,7 +75,7 @@ public class ReplaceExpressionUtil {
|
||||
}
|
||||
else if (i == JavaElementType.ARRAY_ACCESS_EXPRESSION) {
|
||||
int role = ((CompositeElement)oldParent).getChildRole(oldExpr);
|
||||
return role != ChildRole.ARRAY_DIMENSION && priority < parentPriority;
|
||||
return role != ChildRole.ARRAY_DIMENSION && role != ChildRole.INDEX && priority < parentPriority;
|
||||
}
|
||||
else if (i == JavaElementType.ARRAY_INITIALIZER_EXPRESSION) {
|
||||
return false;
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
class C {
|
||||
void f(int[] a, int i) {
|
||||
int i1 = i + 1;
|
||||
int temp = a[i<caret>1];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
class C {
|
||||
void f(int[] a, int i) {
|
||||
int temp = a[i + 1];
|
||||
}
|
||||
}
|
||||
@@ -244,6 +244,10 @@ public class InlineLocalTest extends LightCodeInsightTestCase {
|
||||
doTest(true);
|
||||
}
|
||||
|
||||
public void testArrayAccessPriority() throws Exception {
|
||||
doTest(true);
|
||||
}
|
||||
|
||||
public void testLocalVarInsideLambdaBodyWriteUsage() throws Exception {
|
||||
doTest(true, "Cannot perform refactoring.\n" +
|
||||
"Variable 'hello' is accessed for writing");
|
||||
|
||||
Reference in New Issue
Block a user