mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-08 15:09:39 +07:00
ParenthesesUtils#removeParensFromPolyadicExpression: check operand validity
As processing the previous operands may completely rewrite the whole polyadic expression, we have to stop if this happens No need to find the replacement and process the tail: it's already processed in removeParensFromParenthesizedExpression Fixes EA-141996 - PIEAE: CompositePsiElement.getContainingFile GitOrigin-RevId: 64162346a612e2d95eec426419bef51d6c5d46a3
This commit is contained in:
committed by
intellij-monorepo-bot
parent
a732bb2039
commit
3368f8e2d5
@@ -0,0 +1,13 @@
|
||||
// "Simplify boolean expression" "true"
|
||||
class X {
|
||||
|
||||
void test(int a, int b) {
|
||||
if (a + 1 + foo(a, b) > 5) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private int foo(int a, int b) {
|
||||
return a+b;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
// "Simplify boolean expression" "true"
|
||||
class X {
|
||||
|
||||
void test(int a, int b) {
|
||||
if (<caret>true && (a + 1) + foo((a), b) > 5) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private int foo(int a, int b) {
|
||||
return a+b;
|
||||
}
|
||||
}
|
||||
@@ -219,6 +219,7 @@ public class ParenthesesUtils {
|
||||
private static void removeParensFromPolyadicExpression(@NotNull PsiPolyadicExpression polyadicExpression,
|
||||
boolean ignoreClarifyingParentheses) {
|
||||
for (PsiExpression operand : polyadicExpression.getOperands()) {
|
||||
if (!operand.isValid()) break;
|
||||
removeParentheses(operand, ignoreClarifyingParentheses);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user