diff options
Diffstat (limited to 'test')
| -rw-r--r-- | test/typecheck/pass/if_var_updates.sail | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/test/typecheck/pass/if_var_updates.sail b/test/typecheck/pass/if_var_updates.sail new file mode 100644 index 00000000..13d50e88 --- /dev/null +++ b/test/typecheck/pass/if_var_updates.sail @@ -0,0 +1,25 @@ +val add_int = {ocaml: "add", lem: "integerAdd"}: (int, int) -> int + +overload operator + = {add_int} + +val sub_int = {ocaml: "sub", lem: "integerMinus"}: (int, int) -> int + +overload operator - = {sub_int} + +val lt_int = {ocaml: "lt_int", lem: "lt"} : (int, int) -> bool + +overload operator < = {lt_int} + +function foo w : int -> (bool, int) = { + x : int = w; + y : int = 0 - w; + let pos : bool = + if (w < 0) then { + x = 0 - x; + false + } else { + y = 0 - w; + true + }; + (pos, x + y) +} |
