summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2014-11-04 22:42:09 -0500
committerOri Bernstein <ori@eigenstate.org>2014-11-04 22:42:09 -0500
commit86176386c885b1f424d86321c06ca353842fa3b1 (patch)
treed0fbcf4a89c75a4cbeb7a4e66ae1da6742335ce4 /test
parent3aa6af831c0a5da56c6e5d8f610a2dca6693670e (diff)
downloadmc-86176386c885b1f424d86321c06ca353842fa3b1.tar.gz
Fix clobbering match pattern type.
Diffstat (limited to 'test')
-rw-r--r--test/matchexhaust.myr37
-rw-r--r--test/tests1
2 files changed, 38 insertions, 0 deletions
diff --git a/test/matchexhaust.myr b/test/matchexhaust.myr
new file mode 100644
index 0000000..908d40d
--- /dev/null
+++ b/test/matchexhaust.myr
@@ -0,0 +1,37 @@
+use std
+
+type u = union
+ `Foo (bool, v, bool)
+ `Bar (bool, bool)
+ `Baz bool
+ `Quux
+;;
+
+type v = union
+ `A
+ `B
+;;
+
+const main = {
+ match `Quux
+ | `Foo (true, `A, true):
+ | `Foo (true, `A, false):
+ | `Foo (true, `B, true):
+ | `Foo (true, `B, false):
+ | `Foo (false, `A, true):
+ | `Foo (false, `A, false):
+ | `Foo (false, `B, true):
+ | `Foo (false, `B, false):
+
+ | `Bar (false, false):
+ | `Bar (false, true):
+ | `Bar (true, false):
+ | `Bar (true, true):
+
+ | `Baz false:
+ | `Baz true:
+
+ | `Quux:
+ ;;
+ std.put("worked\n")
+}
diff --git a/test/tests b/test/tests
index 8a0ef69..9611d69 100644
--- a/test/tests
+++ b/test/tests
@@ -104,6 +104,7 @@ B matchtup E 42
B matchstruct E 42
B matcharray E 42
B matchargunion E 69
+B matchexhaust P worked
B matchargstr C
B matchunion_sl P foo
B matchbind E 8