about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2016-05-18 17:05:22 -0700
committerKartik K. Agaram <vc@akkartik.com>2016-05-18 17:05:22 -0700
commit2655ae726e607ba4caa88c088ffb77e50753aead (patch)
tree7a1cdeb47b7fc203b3ffbde7a9cab0b4c72b06ea
parent56c0e796ef341f3f1640ee7d50963e3dffaca4fc (diff)
downloadmu-2655ae726e607ba4caa88c088ffb77e50753aead.tar.gz
2974
Fix CI failure.
-rw-r--r--043space.cc27
-rw-r--r--045closure_name.cc20
2 files changed, 24 insertions, 23 deletions
diff --git a/043space.cc b/043space.cc
index fe5b0a2f..7fda8e4e 100644
--- a/043space.cc
+++ b/043space.cc
@@ -310,25 +310,6 @@ void rewrite_default_space_instruction(instruction& curr) {
   curr.products.push_back(reagent("default-space:address:array:location"));
 }
 
-:(scenario local_scope_ignores_nonlocal_spaces)
-def new-scope [
-  new-default-space
-  x:address:number <- new number:type
-  *x <- copy 34
-  return default-space:address:array:location
-]
-def use-scope [
-  local-scope
-  outer:address:array:location <- next-ingredient
-  0:address:array:location/names:new-scope <- copy outer
-  return *x:address:number/space:1
-]
-def main [
-  1:address:array:location/raw <- new-scope
-  2:number/raw <- use-scope 1:address:array:location/raw
-]
-+mem: storing 34 in location 2
-
 :(scenario local_scope_frees_up_addresses_inside_containers)
 container foo [
   x:number
@@ -337,7 +318,7 @@ container foo [
 def main [
   local-scope
   x:address:number <- new number:type
-  y:foo <- merge 34, x
+  y:foo <- merge 34, x:address:number
   # x and y are both cleared when main returns
 ]
 +mem: clearing x:address:number
@@ -354,10 +335,10 @@ container foo [
 def f [
   local-scope
   x:address:number <- new number:type
-  *x <- copy 12
-  y:foo <- merge 34, x
+  *x:address:number <- copy 12
+  y:foo <- merge 34, x:address:number
   # since y is 'escaping' f, it should not be cleared
-  return y
+  return y:foo
 ]
 def main [
   1:foo <- f
diff --git a/045closure_name.cc b/045closure_name.cc
index 48a84442..1c365f2e 100644
--- a/045closure_name.cc
+++ b/045closure_name.cc
@@ -156,3 +156,23 @@ def f [
 ]
 +error: don't know surrounding recipe of f
 +error: f: can't find a place to store x
+
+//: extra test for try_reclaim_locals() from previous layers
+:(scenario local_scope_ignores_nonlocal_spaces)
+def new-scope [
+  new-default-space
+  x:address:number <- new number:type
+  *x:address:number <- copy 34
+  return default-space:address:array:location
+]
+def use-scope [
+  local-scope
+  outer:address:array:location <- next-ingredient
+  0:address:array:location/names:new-scope <- copy outer:address:array:location
+  return *x:address:number/space:1
+]
+def main [
+  1:address:array:location/raw <- new-scope
+  2:number/raw <- use-scope 1:address:array:location/raw
+]
++mem: storing 34 in location 2