mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[java-dfa] Switching on expression of unknown type should not mark branches as unreachable
Fixes IDEA-371191 Unhelpful "unreachable switch label" warning GitOrigin-RevId: d3e92efc518590ed7c5b7219b9ba0378c292507d
This commit is contained in:
committed by
intellij-monorepo-bot
parent
bf984d947b
commit
002f45f937
+2
-1
@@ -979,7 +979,8 @@ public class ControlFlowAnalyzer extends JavaElementVisitor {
|
||||
}
|
||||
selector.accept(this);
|
||||
if (syntheticVar) {
|
||||
expressionValue = createTempVariable(targetType);
|
||||
expressionValue = targetType == null ?
|
||||
myCurrentFlow.createTempVariable(DfType.TOP) : createTempVariable(targetType);
|
||||
addInstruction(new SimpleAssignmentInstruction(null, expressionValue));
|
||||
}
|
||||
addInstruction(new PopInstruction());
|
||||
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
enum E {
|
||||
A, B, C;
|
||||
|
||||
int x(E e, String s) {
|
||||
return switch (<error descr="Cannot resolve symbol 'd'">d</error>) {
|
||||
case A -> 1;
|
||||
case B -> 2;
|
||||
case C -> 3;
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -184,4 +184,8 @@ public class DataFlowInspection21Test extends DataFlowInspectionTestCase {
|
||||
DataFlowInspectionTest.addJavaxNullabilityAnnotations(myFixture);
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testSwitchNoUnreachableBranchesDueToUnresolvedType() {
|
||||
doTest();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user