diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2016-10-18 09:03:14 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2016-10-18 09:03:14 -0700 |
commit | 5fafd700e4499463e2daea43c30020e81b5fd0a6 (patch) | |
tree | 8c027e7e5b0f1d84b5c498c0948cb628819f3321 | |
parent | 8e64ab8b177a315c6c6c859dc61133e8a2331bd7 (diff) | |
download | mu-5fafd700e4499463e2daea43c30020e81b5fd0a6.tar.gz |
3515
Bugfix: allow 'new' to be passed in type abbreviations.
-rw-r--r-- | 034address.cc | 15 |
1 files 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. |