about summary refs log tree commit diff stats
path: root/034address.cc
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2016-10-18 09:03:14 -0700
committerKartik K. Agaram <vc@akkartik.com>2016-10-18 09:03:14 -0700
commit5fafd700e4499463e2daea43c30020e81b5fd0a6 (patch)
tree8c027e7e5b0f1d84b5c498c0948cb628819f3321 /034address.cc
parent8e64ab8b177a315c6c6c859dc61133e8a2331bd7 (diff)
downloadmu-5fafd700e4499463e2daea43c30020e81b5fd0a6.tar.gz
3515
Bugfix: allow 'new' to be passed in type abbreviations.
Diffstat (limited to '034address.cc')
-rw-r--r--034address.cc15
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.