about summary refs log tree commit diff stats
path: root/031merge.cc
diff options
context:
space:
mode:
Diffstat (limited to '031merge.cc')
-rw-r--r--031merge.cc10
1 files changed, 8 insertions, 2 deletions
diff --git a/031merge.cc b/031merge.cc
index 75dc466b..14999123 100644
--- a/031merge.cc
+++ b/031merge.cc
@@ -166,7 +166,7 @@ void check_merge_call(const vector<reagent>& ingredients, const reagent& product
         if (types_coercible(expected_ingredient, ingredients.at(ingredient_index))) {
           ++ingredient_index;
           ++state.data.top().container_element_index;
-          while (state.data.top().container_element_index >= SIZE(get(Type, root_type(state.data.top().container.type)->value).elements)) {
+          while (state.data.top().container_element_index >= SIZE(get(Type, get_base_type(state.data.top().container.type)->value).elements)) {
             state.data.pop();
             if (state.data.empty()) {
               if (ingredient_index < SIZE(ingredients))
@@ -201,7 +201,7 @@ void check_merge_call(const vector<reagent>& ingredients, const reagent& product
             return;
           }
           ++state.data.top().container_element_index;
-        } while (state.data.top().container_element_index >= SIZE(get(Type, root_type(state.data.top().container.type)->value).elements));
+        } while (state.data.top().container_element_index >= SIZE(get(Type, get_base_type(state.data.top().container.type)->value).elements));
       }
     }
   }
@@ -209,6 +209,12 @@ void check_merge_call(const vector<reagent>& ingredients, const reagent& product
   assert(false);
 }
 
+// replaced in a later layer
+// todo: find some clean way to take this call completely out of this layer
+const type_tree* get_base_type(const type_tree* t) {
+  return t;
+}
+
 :(scenario merge_check_product)
 % Hide_errors = true;
 def main [