summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorS. Gilles <sgilles@math.umd.edu>2017-07-09 01:47:07 -0400
committerOri Bernstein <ori@eigenstate.org>2017-07-08 23:44:21 -0700
commit32397d07defce76d42a038e8b6b339b8a0c14699 (patch)
tree13d72e46758f8c13f90a5082926b000d788ff086 /test
parent5317028311f7eda55ab588bfca93f27bbb5cd839 (diff)
downloadmc-32397d07defce76d42a038e8b6b339b8a0c14699.tar.gz
Allow matching of empty structs and arrays
Diffstat (limited to 'test')
-rw-r--r--test/empty-struct.myr26
-rw-r--r--test/tests1
2 files changed, 27 insertions, 0 deletions
diff --git a/test/empty-struct.myr b/test/empty-struct.myr
new file mode 100644
index 0000000..a3ec75a
--- /dev/null
+++ b/test/empty-struct.myr
@@ -0,0 +1,26 @@
+use std
+
+type foo = struct
+;;
+
+type bar = struct
+ baz : foo[:]
+ quux : foo[0][:]
+;;
+
+
+const main = {
+ var a : foo
+ var z : foo[0]
+ var b : bar = [.baz = [a, a][:], .quux = [z, z, z][:]]
+ var c : int = 0
+ for f in b.baz
+ c += 3
+ ;;
+
+ for f in b.quux
+ c += 5
+ ;;
+
+ std.exit(c)
+}
diff --git a/test/tests b/test/tests
index b7ab8e1..fcd058c 100644
--- a/test/tests
+++ b/test/tests
@@ -144,6 +144,7 @@ B strfind C
B strjoin C
B exporttrait E 0
B local-labels E 10
+B empty-struct E 21
F declmismatch
F infermismatch
F usedef