summaryrefslogtreecommitdiff
path: root/test/mono/varmatch.sail
diff options
context:
space:
mode:
authorBrian Campbell2017-08-18 16:36:52 +0100
committerBrian Campbell2017-08-18 16:36:52 +0100
commitbbdb011b8364ceaed867abb9d6b580ba8b2a60e8 (patch)
tree7b54bc62ded248d6269cf603f0107fecdd9b3390 /test/mono/varmatch.sail
parent5527ed5ce34e77f452ca90d1b4a5126255b4ee43 (diff)
Bit more monomorphisation testing
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
+}