mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
switch expressions: don't add additional parenthesis on replacements inside switch expression
found by property testing
This commit is contained in:
+2
-1
@@ -72,7 +72,8 @@ public class ReplaceExpressionUtil {
|
||||
i == JavaElementType.THIS_EXPRESSION ||
|
||||
i == JavaElementType.SUPER_EXPRESSION ||
|
||||
i == JavaElementType.CLASS_OBJECT_ACCESS_EXPRESSION ||
|
||||
i == JavaElementType.LAMBDA_EXPRESSION) {
|
||||
i == JavaElementType.LAMBDA_EXPRESSION ||
|
||||
i == JavaElementType.SWITCH_EXPRESSION) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
class PrefixExpression {
|
||||
void m(int i) {
|
||||
int j = switch(<caret>++i) {
|
||||
default -> 7;
|
||||
};
|
||||
}
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
class PrefixExpression {
|
||||
void m(int i) {
|
||||
int j = switch(<caret>i++) {
|
||||
default -> 7;
|
||||
};
|
||||
}
|
||||
}
|
||||
+1
@@ -24,6 +24,7 @@ import com.siyeh.ipp.IPPTestCase;
|
||||
public class PostfixPrefixIntentionTest extends IPPTestCase {
|
||||
public void testSimple() { doTest(); }
|
||||
public void testPrefixExpression() { doTest(CommonQuickFixBundle.message("fix.replace.with.x", "i++")); }
|
||||
public void testPrefixExpressionInSwitchExprJava12() { doTest(CommonQuickFixBundle.message("fix.replace.with.x", "i++")); }
|
||||
public void testIncomplete() { assertIntentionNotAvailable(); }
|
||||
public void testUnaryExpression() { assertIntentionNotAvailable(); }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user