diff --git a/src/main/java/de/maishai/typedast/typedclass/TypedBinary.java b/src/main/java/de/maishai/typedast/typedclass/TypedBinary.java index 450e6c1..2ef9e3b 100644 --- a/src/main/java/de/maishai/typedast/typedclass/TypedBinary.java +++ b/src/main/java/de/maishai/typedast/typedclass/TypedBinary.java @@ -52,13 +52,20 @@ public class TypedBinary implements TypedExpression { } else { throw new RuntimeException("Type mismatch in " + op); } - } else if (op == Operator.EQ || op == Operator.NE || op == Operator.AND || op == Operator.OR) { + } else if (op == Operator.EQ || op == Operator.NE ) { if (leftType == Type.INT && rightType == Type.INT || leftType == Type.BOOL && rightType == Type.BOOL) { type = Type.BOOL; return Type.BOOL; } else { throw new RuntimeException("Type mismatch in " + op); } + } else if (op == Operator.AND || op == Operator.OR ){ + if (leftType == Type.BOOL && rightType == Type.BOOL) { + type = Type.BOOL; + return Type.BOOL; + } else { + throw new RuntimeException("Type mismatch in " + op); + } } if (leftType == rightType && leftType != Type.VOID) {