From 4769dd2e8721e41769fce0a98523fe2e50035277 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Sun, 6 Nov 2016 11:54:20 -0800 Subject: 3638 Reorder a couple of nonsensically-placed fragments. --- 055shape_shifting_container.cc | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) (limited to '055shape_shifting_container.cc') diff --git a/055shape_shifting_container.cc b/055shape_shifting_container.cc index 044e7089..352124c7 100644 --- a/055shape_shifting_container.cc +++ b/055shape_shifting_container.cc @@ -223,6 +223,13 @@ def main [ # no other stores % CHECK_EQ(trace_count_prefix("mem", "storing"), 7); +:(before "End variant_type Special-cases") +if (contains_type_ingredient(element)) { + if (!type->right) + raise << "illegal type " << to_string(type) << " seems to be missing a type ingredient or three while computing variant type of exclusive-container\n" << end(); + replace_type_ingredients(element.type, type->right, info); +} + :(scenario get_on_shape_shifting_container) container foo:_t [ x:_t @@ -295,15 +302,6 @@ replace_type_ingredients(element, full_type, exclusive_container_info, location_ replace_type_ingredients(element, type, info, location_for_error_messages); if (contains_type_ingredient(element)) return; // error raised elsewhere -:(code) -void replace_type_ingredients(reagent& element, const type_tree* caller_type, const type_info& info, const string& location_for_error_messages) { - if (contains_type_ingredient(element)) { - if (!caller_type->right) - raise << "illegal type " << names_to_string(caller_type) << " seems to be missing a type ingredient or three" << location_for_error_messages << '\n' << end(); - replace_type_ingredients(element.type, caller_type->right, info); - } -} - :(after "Compute size_of Container") assert(!contains_type_ingredient(type)); :(after "Compute size_of Exclusive Container") @@ -320,6 +318,14 @@ bool contains_type_ingredient(const type_tree* type) { return contains_type_ingredient(type->left) || contains_type_ingredient(type->right); } +void replace_type_ingredients(reagent& element, const type_tree* caller_type, const type_info& info, const string& location_for_error_messages) { + if (contains_type_ingredient(element)) { + if (!caller_type->right) + raise << "illegal type " << names_to_string(caller_type) << " seems to be missing a type ingredient or three" << location_for_error_messages << '\n' << end(); + replace_type_ingredients(element.type, caller_type->right, info); + } +} + // replace all type_ingredients in element_type with corresponding elements of callsite_type void replace_type_ingredients(type_tree* element_type, const type_tree* callsite_type, const type_info& container_info) { if (!callsite_type) return; // error but it's already been raised above @@ -681,10 +687,3 @@ def main [ 1:foo:bar <- merge 1/y, 23 ] +error: main: too few ingredients in '1:foo:bar <- merge 1/y, 23' - -:(before "End variant_type Special-cases") -if (contains_type_ingredient(element)) { - if (!type->right) - raise << "illegal type " << to_string(type) << " seems to be missing a type ingredient or three while computing variant type of exclusive-container\n" << end(); - replace_type_ingredients(element.type, type->right, info); -} -- cgit 1.4.1-2-gfad0