From 011b272af61bb9f00fdc4053e9c073577915f7ce Mon Sep 17 00:00:00 2001 From: Daniel Holle Date: Thu, 17 Aug 2023 16:15:38 +0200 Subject: [PATCH] Fix missing constraints --- .../de/dhbwstuttgart/typeinference/typeAlgo/TYPEStmt.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/java/de/dhbwstuttgart/typeinference/typeAlgo/TYPEStmt.java b/src/main/java/de/dhbwstuttgart/typeinference/typeAlgo/TYPEStmt.java index dc679eb1..954e629f 100644 --- a/src/main/java/de/dhbwstuttgart/typeinference/typeAlgo/TYPEStmt.java +++ b/src/main/java/de/dhbwstuttgart/typeinference/typeAlgo/TYPEStmt.java @@ -753,14 +753,16 @@ public class TYPEStmt implements StatementVisitor { constraintsSet.addUndConstraint(new Pair(label.getPattern().getType(), switchStmt.getSwitch().getType(), PairOperator.SMALLERDOT)); } } - - child.accept(this); - constraintsSet.addUndConstraint(new Pair(child.getType(), switchStmt.getType(), PairOperator.SMALLERDOT)); } } else { constraintsSet.addUndConstraint(new Pair(caseExpressionType, switchStmt.getSwitch().getType(), PairOperator.EQUALSDOT)); } + for (var child : switchStmt.getBlocks()) { + child.accept(this); + constraintsSet.addUndConstraint(new Pair(child.getType(), switchStmt.getType(), PairOperator.SMALLERDOT)); + } + switchStack.pop(); }