summaryrefslogtreecommitdiff
path: root/test/mono/varmatch.sail
diff options
context:
space:
mode:
Diffstat (limited to 'test/mono/varmatch.sail')
-rw-r--r--test/mono/varmatch.sail19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/mono/varmatch.sail b/test/mono/varmatch.sail
new file mode 100644
index 00000000..7d2b9b73
--- /dev/null
+++ b/test/mono/varmatch.sail
@@ -0,0 +1,19 @@
+(* Check that when we case split on a variable that the constant propagation
+ handles the default case correctly. *)
+
+typedef AnEnum = enumerate { One; Two; Three }
+
+function AnEnum foo((AnEnum) x) = {
+ switch (x) {
+ case One -> Two
+ case y -> y
+ }
+}
+
+val unit -> bool effect pure run
+
+function run () = {
+ foo(One) == Two &
+ foo(Two) == Two &
+ foo(Three) == Three
+}