summaryrefslogtreecommitdiff
path: root/test/typecheck
diff options
context:
space:
mode:
authorThomas Bauereiss2018-01-25 11:18:10 +0000
committerThomas Bauereiss2018-01-25 11:41:22 +0000
commit54d18f2d19f33aae822dca53485afa8ba9e06e81 (patch)
treed77b0a2f315ea48844e0933d6a471fdab2903f32 /test/typecheck
parentd87d4ad3a6d2ec2804cb7b20128fecb6d9df4e6e (diff)
Fix more type annotations in rewriter
Use consistent nesting of tuples when adding updated local mutable variables to expressions. Add test case.
Diffstat (limited to 'test/typecheck')
-rw-r--r--test/typecheck/pass/if_var_updates.sail25
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)
+}