From 5fafd700e4499463e2daea43c30020e81b5fd0a6 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Tue, 18 Oct 2016 09:03:14 -0700 Subject: 3515 Bugfix: allow 'new' to be passed in type abbreviations. --- 034address.cc | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/034address.cc b/034address.cc index 3a599a7d..dc08d0c3 100644 --- a/034address.cc +++ b/034address.cc @@ -183,13 +183,8 @@ bool product_of_new_is_valid(const instruction& inst) { return false; drop_from_type(product, "array"); } - reagent/*copy*/ expected_product("x:"+inst.ingredients.at(0).name); - { - string_tree* tmp_type_names = parse_string_tree(expected_product.type->name); - delete expected_product.type; - expected_product.type = new_type_tree(tmp_type_names); - delete tmp_type_names; - } + reagent/*copy*/ expected_product; + expected_product.type = new_type_tree(inst.ingredients.at(0).name); return types_strictly_match(product, expected_product); } @@ -205,6 +200,12 @@ void drop_from_type(reagent& r, string expected_type) { delete tmp; } +:(scenario new_with_type_abbreviation) +def main [ + 1:address:num/raw <- new num:type +] +$error: 0 + //: To implement 'new', a Mu transform turns all 'new' instructions into //: 'allocate' instructions that precompute the amount of memory they want to //: allocate. -- cgit 1.4.1-2-gfad0