about summary refs log tree commit diff stats
path: root/033exclusive_container.cc
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2016-02-15 12:56:45 -0800
committerKartik K. Agaram <vc@akkartik.com>2016-02-15 12:56:45 -0800
commitf592d8629f3fddaebff4abece8f92e57e9379418 (patch)
tree7d3927dc082093e4a87e66ae932f99e7ec85e31a /033exclusive_container.cc
parentcf36334305b82dc36f7a2423382ccd8b21bb4eae (diff)
downloadmu-f592d8629f3fddaebff4abece8f92e57e9379418.tar.gz
2660 - check dynamic arrays in exclusive containers
Also a bugfix: don't cause future parse errors when these checks are
triggered.
Diffstat (limited to '033exclusive_container.cc')
-rw-r--r--033exclusive_container.cc17
1 files changed, 17 insertions, 0 deletions
diff --git a/033exclusive_container.cc b/033exclusive_container.cc
index 1d63f593..3b1dc201 100644
--- a/033exclusive_container.cc
+++ b/033exclusive_container.cc
@@ -179,6 +179,23 @@ else if (command == "exclusive-container") {
   insert_container(command, EXCLUSIVE_CONTAINER, in);
 }
 
+//: arrays are disallowed inside exclusive containers unless their length is
+//: fixed in advance
+
+:(scenario exclusive_container_contains_array)
+% Hide_errors = true;
+exclusive-container foo [
+  x:array:number:3
+]
+$error: 0
+
+:(scenario exclusive_container_warns_on_dynamic_array_element)
+% Hide_errors = true;
+exclusive-container foo [
+  x:array:number
+]
++error: container 'foo' cannot determine size of element x
+
 //:: To construct exclusive containers out of variant types, use 'merge'.
 :(scenario lift_to_exclusive_container)
 exclusive-container foo [