about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--036refcount.cc2
-rw-r--r--055shape_shifting_container.cc11
2 files changed, 13 insertions, 0 deletions
diff --git a/036refcount.cc b/036refcount.cc
index 1b0a8d8c..a4cece49 100644
--- a/036refcount.cc
+++ b/036refcount.cc
@@ -1022,6 +1022,7 @@ bool is_mu_container(const type_tree* type) {
   if (!type) return false;
   // End is_mu_container(type) Special-cases
   if (type->value == 0) return false;
+  if (!contains_key(Type, type->value)) return false;  // error raised elsewhere
   type_info& info = get(Type, type->value);
   return info.kind == CONTAINER;
 }
@@ -1033,6 +1034,7 @@ bool is_mu_exclusive_container(const type_tree* type) {
   if (!type) return false;
   // End is_mu_exclusive_container(type) Special-cases
   if (type->value == 0) return false;
+  if (!contains_key(Type, type->value)) return false;  // error raised elsewhere
   type_info& info = get(Type, type->value);
   return info.kind == EXCLUSIVE_CONTAINER;
 }
diff --git a/055shape_shifting_container.cc b/055shape_shifting_container.cc
index a9225960..8a7d75e1 100644
--- a/055shape_shifting_container.cc
+++ b/055shape_shifting_container.cc
@@ -670,6 +670,17 @@ void test_container_address_offsets_in_nested_shape_shifting_container() {
   CHECK_EQ((++offset_info.begin())->payload_type->name, "number");
 }
 
+:(scenario typos_in_container_definitions)
+% Hide_errors = true;
+container foo:_t [
+  x:adress:_t  # typo
+]
+def main [
+  local-scope
+  x:address:foo:num <- new {(foo num): type}
+]
+# no crash
+
 //:: 'merge' on shape-shifting containers
 
 :(scenario merge_check_shape_shifting_container_containing_exclusive_container)