diff --git a/src/main/java/de/dhbwstuttgart/typeinference/typeAlgo/TYPEStmt.java b/src/main/java/de/dhbwstuttgart/typeinference/typeAlgo/TYPEStmt.java index f1332cd46..30d76167e 100644 --- a/src/main/java/de/dhbwstuttgart/typeinference/typeAlgo/TYPEStmt.java +++ b/src/main/java/de/dhbwstuttgart/typeinference/typeAlgo/TYPEStmt.java @@ -229,7 +229,7 @@ public class TYPEStmt implements StatementVisitor{ binary.operation.equals(BinaryExpr.Operator.MUL)|| binary.operation.equals(BinaryExpr.Operator.MOD)|| binary.operation.equals(BinaryExpr.Operator.ADD)|| - binary.operation.equals(BinaryExpr.Operator.SUB)){ + binary.operation.equals(BinaryExpr.Operator.SUB)) { Set> numericAdditionOrStringConcatenation = new HashSet<>(); // TODO PL 2018-11-06 @@ -312,6 +312,9 @@ public class TYPEStmt implements StatementVisitor{ numericAdditionOrStringConcatenation.add(stringConcat); } } + if(numericAdditionOrStringConcatenation.size()<1){ + throw new TypeinferenceException("Kein Typ für " + binary.operation.toString() + " vorhanden", binary.getOffset()); + } constraintsSet.addOderConstraint(numericAdditionOrStringConcatenation); }else if(binary.operation.equals(BinaryExpr.Operator.LESSEQUAL) || binary.operation.equals(BinaryExpr.Operator.BIGGEREQUAL) || @@ -355,6 +358,7 @@ public class TYPEStmt implements StatementVisitor{ //***ACHTUNG: Moeglicherweise oder und und-Contraint falsch */ //Testeise eingefuegt PL 2018-05-24 + //Hier sollte evtl. noch importe angefragt werden PL 2019-05-07 constraintsSet.addUndConstraint(new Pair(binary.lexpr.getType(), number, PairOperator.SMALLERNEQDOT)); constraintsSet.addUndConstraint(new Pair(binary.rexpr.getType(), number, PairOperator.SMALLERNEQDOT)); //Rückgabetyp ist Boolean