[java-dfa] Fix imbalanced stack on incomplete guarded pattern

Fixes EA-447737 - ESE: Stack.pop
(at least some cases linked to this exception)

GitOrigin-RevId: 5709b7fc22e9495e07f20f899cb66274b0443fc0
This commit is contained in:
Tagir Valeev
2022-04-25 22:42:09 +00:00
committed by intellij-monorepo-bot
parent 60a8572183
commit a3eced1e77
2 changed files with 8 additions and 0 deletions
@@ -1085,6 +1085,8 @@ public class ControlFlowAnalyzer extends JavaElementVisitor {
PsiExpression expression = ((PsiGuardedPattern)innerPattern).getGuardingExpression();
if (expression != null) {
expression.accept(this);
} else {
addInstruction(new PushValueInstruction(DfTypes.BOOLEAN));
}
DeferredOffset condGotoOffset = new DeferredOffset();
addInstruction(new ConditionalGotoInstruction(condGotoOffset, DfTypes.TRUE));
@@ -1,4 +1,10 @@
class Test {
int testIncomplete(Object obj) {
return switch(obj) {
case String s &&<EOLError descr="Expression expected"></EOLError><EOLError descr="':' expected"></EOLError>
};
}
void test1(Object o) {
int a;
switch (o) {