summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorThomas Bauereiss2018-05-12 11:16:27 +0100
committerThomas Bauereiss2018-05-12 11:20:33 +0100
commit526b71d5fed2f6a79c41fe482a578a8634a0345a (patch)
tree55cbddb180f05b3d6b33744bf64b630f71f30b52 /test
parent6368f7fea326340ffd1c2b6e3ff3bcdccdeb9cec (diff)
Fix bug in handling of registers with option type
Also add test cases and Isabelle lemmas
Diffstat (limited to 'test')
-rw-r--r--test/typecheck/pass/reg_list.sail7
-rw-r--r--test/typecheck/pass/reg_option.sail16
2 files changed, 23 insertions, 0 deletions
diff --git a/test/typecheck/pass/reg_list.sail b/test/typecheck/pass/reg_list.sail
new file mode 100644
index 00000000..bf776942
--- /dev/null
+++ b/test/typecheck/pass/reg_list.sail
@@ -0,0 +1,7 @@
+register X : list(bool)
+
+val init_X : unit -> unit effect {wreg}
+function init_X () = {
+ X = [||];
+}
+
diff --git a/test/typecheck/pass/reg_option.sail b/test/typecheck/pass/reg_option.sail
new file mode 100644
index 00000000..55317d1f
--- /dev/null
+++ b/test/typecheck/pass/reg_option.sail
@@ -0,0 +1,16 @@
+$include <arith.sail>
+$include <flow.sail>
+$include <option.sail>
+
+register X : option(int)
+
+val inc_X : unit -> int effect {rreg, wreg}
+function inc_X () = {
+ let x : int = match X {
+ Some(x) => x + 1,
+ None() => 0
+ };
+ X = Some(x);
+ return x;
+}
+