Skip to content
Snippets Groups Projects
Commit 8bc7cc10 authored by Jan Gruteser's avatar Jan Gruteser
Browse files

support reals in relational operators

parent 065493de
No related branches found
No related tags found
No related merge requests found
......@@ -1166,9 +1166,15 @@ public class TypeChecker extends BuiltInOPs implements ASTConstants, BBuildIns,
throw new TypeErrorException(String.format("Expected %s, found BOOL at '%s',%n%s", expected,
n.getOperator().getName(), n.getLocation()));
}
try {
for (int i = 0; i < n.getArgs().length; i++) {
visitExprOrOpArgNode(n.getArgs()[i], IntType.getInstance());
}
} catch (TypeErrorException e) {
for (int i = 0; i < n.getArgs().length; i++) {
visitExprOrOpArgNode(n.getArgs()[i], RealType.getInstance());
}
}
return BoolType.getInstance();
}
......@@ -1428,6 +1434,7 @@ public class TypeChecker extends BuiltInOPs implements ASTConstants, BBuildIns,
case B_OPCODE_setprod: // SetProduct(S)
case B_OPCODE_setsum: // SetSummation(S)
{
// TODO: do we need support for Reals here?
try {
IntType.getInstance().unify(expected);
} catch (UnificationException e) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment