about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2016-02-26 21:30:43 -0800
committerKartik K. Agaram <vc@akkartik.com>2016-02-26 21:30:43 -0800
commit947f06fb5569007a5a3c444683794427c72cef52 (patch)
treeee9bb69c1f6357688a7821411059df5f86ac3d75
parentaed2929055ee8de978da739fbeaec7112418fc1d (diff)
downloadmu-947f06fb5569007a5a3c444683794427c72cef52.tar.gz
2717 - bugfix for dilated reagents
Make sure static arrays can take compound types.
-rw-r--r--032array.cc4
-rw-r--r--054dilated_reagent.cc11
2 files changed, 15 insertions, 0 deletions
diff --git a/032array.cc b/032array.cc
index 46681654..9d5dbda6 100644
--- a/032array.cc
+++ b/032array.cc
@@ -226,6 +226,10 @@ case INDEX: {
 
 :(code)
 type_tree* array_element(const type_tree* type) {
+  if (type->right->left) {
+    assert(!type->right->left->left);
+    return type->right->left;
+  }
   return type->right;
 }
 
diff --git a/054dilated_reagent.cc b/054dilated_reagent.cc
index d90ed4df..16698152 100644
--- a/054dilated_reagent.cc
+++ b/054dilated_reagent.cc
@@ -30,6 +30,17 @@ recipe main [
 ]
 $error: 0
 
+:(scenario dilated_reagent_in_static array)
+recipe main [
+  {1: (array (address shared number) 3)} <- create-array
+  5:address:address:shared:number <- index-address {1: (array (address shared number) 3)}, 0
+  *5:address:address:shared:number <- new number:type
+  **5:address:address:shared:number <- copy 34
+  6:number <- copy **5:address:address:shared:number
+]
++run: creating array of size 4
++mem: storing 34 in location 6
+
 //: First augment next_word to group balanced brackets together.
 
 :(before "End next_word Special-cases")