[java-inspections] Switch label is unreachable: false positive when there is a compile-time error

IDEA-310689

GitOrigin-RevId: 59eba93e68bf67c3d769e8e03eac31daac84a17c
This commit is contained in:
Andrey Cherkasov
2023-01-17 13:35:18 +04:00
committed by intellij-monorepo-bot
parent fd5ea2915e
commit 9672b771d4
3 changed files with 15 additions and 2 deletions

View File

@@ -1246,7 +1246,8 @@ public class SwitchBlockHighlightingModel {
List<PsiCaseLabelElement> dominanceCheckingCandidates = new SmartList<>();
labelElements.forEach(label -> PatternsInSwitchBlockHighlightingModel.fillElementsToCheckDominance(dominanceCheckingCandidates, label));
if (dominanceCheckingCandidates.isEmpty()) return result;
return StreamEx.ofKeys(patternInSwitchModel.findDominatedLabels(dominanceCheckingCandidates), value -> value instanceof PsiPattern)
return StreamEx.ofKeys(patternInSwitchModel.findDominatedLabels(dominanceCheckingCandidates), value -> value instanceof PsiPattern ||
value instanceof PsiPatternGuard)
.into(result);
}
}