summaryrefslogtreecommitdiff
path: root/test/matchunion.myr
diff options
context:
space:
mode:
authorOri Bernstein <orib@google.com>2012-06-29 15:51:48 -0400
committerOri Bernstein <orib@google.com>2012-06-29 15:51:48 -0400
commitc52b156adc9c7f62a06918c878db26666eafadb2 (patch)
tree74c2c05690fbdebca65aa68c8cf2032a8bb0b252 /test/matchunion.myr
parent6ceec6218bd3d7040758c09233c07d2afcdb2cbe (diff)
downloadmc-c52b156adc9c7f62a06918c878db26666eafadb2.tar.gz
Add unions as patterns.
Diffstat (limited to 'test/matchunion.myr')
-rw-r--r--test/matchunion.myr26
1 files changed, 26 insertions, 0 deletions
diff --git a/test/matchunion.myr b/test/matchunion.myr
new file mode 100644
index 0000000..06cc30c
--- /dev/null
+++ b/test/matchunion.myr
@@ -0,0 +1,26 @@
+type u = union
+ `Foo
+ `Bar
+ `Baz
+ `Quuz
+;;
+
+const main = {
+ var v
+
+ v = `Foo
+ match v
+ `Bar:
+ -> 42
+ ;;
+ `Baz;
+ -> 81
+ ;;
+ `Foo:
+ -> 84
+ ;;
+ `Quux:
+ -> 123
+ ;;
+ ;;
+}