From adf00a18032b96353982eee2036a1afdf4cbf0d5 Mon Sep 17 00:00:00 2001 From: ahmad Date: Thu, 27 Jun 2024 20:01:21 +0200 Subject: [PATCH] Fixed while condition --- .../java/de/maishai/typedast/typedclass/TypedBinary.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main/java/de/maishai/typedast/typedclass/TypedBinary.java b/src/main/java/de/maishai/typedast/typedclass/TypedBinary.java index 30171b2..dadb292 100644 --- a/src/main/java/de/maishai/typedast/typedclass/TypedBinary.java +++ b/src/main/java/de/maishai/typedast/typedclass/TypedBinary.java @@ -62,6 +62,13 @@ public class TypedBinary implements TypedExpression { } else { throw new RuntimeException("Type mismatch in " + op); } + } 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); + } } if (leftType == rightType && leftType != Type.VOID) {