From 49586b65be4ded4010c4e195f7df9faed02a682d Mon Sep 17 00:00:00 2001 From: Tom Jack Date: Sun, 17 Nov 2019 16:15:06 -0600 Subject: [PATCH] Type subtraction also as nat->int->int and int->nat->int --- src/passes/operators/operators.ml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/passes/operators/operators.ml b/src/passes/operators/operators.ml index 956b8e6ed..7316d6650 100644 --- a/src/passes/operators/operators.ml +++ b/src/passes/operators/operators.ml @@ -318,9 +318,8 @@ module Typer = struct | Some t -> ok t let sub = typer_2 "SUB" @@ fun a b -> - if (eq_2 (a , b) (t_int ())) - then ok @@ t_int () else - if (eq_2 (a , b) (t_nat ())) + if (eq_1 a (t_int ()) || eq_1 a (t_nat ())) + && (eq_1 b (t_int ()) || eq_1 b (t_nat ())) then ok @@ t_int () else if (eq_2 (a , b) (t_timestamp ())) then ok @@ t_int () else