mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-20 13:31:28 +07:00
[java-inspections] 'Remove pattern variable' fix is available on deconstruction pattern component but produces red code
IDEA-298527 GitOrigin-RevId: 32645ea4938384d31bbe4750c3867e3b00f3fafe
This commit is contained in:
committed by
intellij-monorepo-bot
parent
1252088717
commit
1c7aea69ba
@@ -425,13 +425,13 @@ class PostHighlightingVisitor {
|
||||
return highlightInfo;
|
||||
}
|
||||
}
|
||||
else if (parameter instanceof PsiPatternVariable) {
|
||||
else if (parameter instanceof PsiPatternVariable variable) {
|
||||
HighlightInfo highlightInfo = checkUnusedParameter(parameter, identifier, null);
|
||||
if (highlightInfo != null) {
|
||||
if (declarationScope.getParent() instanceof PsiSwitchBlock) {
|
||||
QuickFixAction.registerQuickFixAction(highlightInfo, quickFixFactory.createRenameToIgnoredFix(parameter, false));
|
||||
}
|
||||
else {
|
||||
else if (!(variable.getPattern() instanceof PsiTypeTestPattern pattern && pattern.getParent() instanceof PsiDeconstructionList)) {
|
||||
QuickFixAction.registerQuickFixAction(highlightInfo, quickFixFactory.createDeleteFix(parameter));
|
||||
}
|
||||
return highlightInfo;
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
// "Remove pattern variable" "true-preview"
|
||||
class Test {
|
||||
record Point(double x, double y) {}
|
||||
|
||||
record Rect(Point point1, Point point2) {}
|
||||
|
||||
void foo(Object obj) {
|
||||
if (obj instanceof Rect(Point(double x, double y) point1, Point point2)) {}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
// "Remove pattern variable" "true-preview"
|
||||
class Test {
|
||||
record Point(double x, double y) {}
|
||||
|
||||
record Rect(Point point1, Point point2) {}
|
||||
|
||||
void foo(Object obj) {
|
||||
if (obj instanceof Rect(Point(double x, double y), Point point2) rect) {}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
// "Remove pattern variable" "true-preview"
|
||||
class Test {
|
||||
record Point(double x, double y) {}
|
||||
|
||||
record Rect(Point point1, Point point2) {}
|
||||
|
||||
void foo(Object obj) {
|
||||
if (obj instanceof Rect(Point(double x, double y) point1, Point point2) rect<caret>) {}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
// "Remove pattern variable" "true-preview"
|
||||
class Test {
|
||||
record Point(double x, double y) {}
|
||||
|
||||
record Rect(Point point1, Point point2) {}
|
||||
|
||||
void foo(Object obj) {
|
||||
if (obj instanceof Rect(Point(double x, double y) point1<caret>, Point point2) rect) {}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
// "Remove pattern variable" "false"
|
||||
class Test {
|
||||
record Point(double x, double y) {}
|
||||
|
||||
record Rect(Point point1, Point point2) {}
|
||||
|
||||
void foo(Object obj) {
|
||||
if (obj instanceof Rect(Point(double x<caret>, double y) point1, Point point2) rect) {}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user