about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2016-08-16 20:37:45 -0700
committerKartik K. Agaram <vc@akkartik.com>2016-08-16 20:37:45 -0700
commit9e9c2589558dab059408475de85b68552b041f74 (patch)
tree2b7a1cce4624090d19680d023d664dbca7a5c65f
parent825dddbc0f8e0b610b189473ff400a868fe21eb3 (diff)
downloadmu-9e9c2589558dab059408475de85b68552b041f74.tar.gz
3207
-rw-r--r--036refcount.cc17
1 files changed, 17 insertions, 0 deletions
diff --git a/036refcount.cc b/036refcount.cc
index e141b817..344be085 100644
--- a/036refcount.cc
+++ b/036refcount.cc
@@ -591,6 +591,23 @@ def main [
 +run: {20: "foo"} <- copy {10: "foo"}
 +mem: incrementing refcount of 1000: 2 -> 3
 
+:(scenario refcounts_copy_array_within_container)
+container foo [
+  x:address:array:number
+]
+def main [
+  1:address:array:number <- new number:type, 3
+  2:foo <- merge 1:address:array:number
+  3:address:array:number <- new number:type, 5
+  2:foo <- merge 3:address:array:number
+]
++run: {1: ("address" "array" "number")} <- new {number: "type"}, {3: "literal"}
++mem: incrementing refcount of 1000: 0 -> 1
++run: {2: "foo"} <- merge {1: ("address" "array" "number")}
++mem: incrementing refcount of 1000: 1 -> 2
++run: {2: "foo"} <- merge {3: ("address" "array" "number")}
++mem: decrementing refcount of 1000: 2 -> 1
+
 :(code)
 bool is_mu_container(const reagent& r) {
   return is_mu_container(r.type);