summary refs log tree commit diff stats
path: root/tests/destructor
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2019-11-13 19:55:05 +0100
committerAndreas Rumpf <rumpf_a@web.de>2019-11-13 23:29:21 +0100
commitf22d3c75aa68833ae1b01d747d0c71074ccef310 (patch)
treed9b939bedba2212ba8deba8966c89bf531a57db9 /tests/destructor
parentbcab3ed06c2c4996f7efac6e7733b514ad83e1d4 (diff)
downloadNim-f22d3c75aa68833ae1b01d747d0c71074ccef310.tar.gz
ARC: closure inside object constructor now works
Diffstat (limited to 'tests/destructor')
-rw-r--r--tests/destructor/tlists.nim15
-rw-r--r--tests/destructor/tuse_ownedref_after_move.nim2
2 files changed, 15 insertions, 2 deletions
diff --git a/tests/destructor/tlists.nim b/tests/destructor/tlists.nim
index 7a81e602e..a9c78ab75 100644
--- a/tests/destructor/tlists.nim
+++ b/tests/destructor/tlists.nim
@@ -1,5 +1,7 @@
 discard """
-  output: '''Success
+  output: '''
+@[1, 2, 3]
+Success
 @["a", "b", "c"]
 0'''
   cmd: '''nim c --gc:destructors $file'''
@@ -32,7 +34,18 @@ proc tsimpleClosureIterator =
   for it in foobar(myc):
     echo it
 
+type
+  LazyList = ref object
+    c: proc() {.closure.}
+
+proc tlazyList =
+  let dep = @[1, 2, 3]
+  var x = LazyList(c: proc () = echo(dep))
+  x.c()
+
 let startMem = getOccupiedMem()
+tlazyList()
+
 mkManyLeaks()
 tsimpleClosureIterator()
 echo getOccupiedMem() - startMem
diff --git a/tests/destructor/tuse_ownedref_after_move.nim b/tests/destructor/tuse_ownedref_after_move.nim
index 34b2f92e4..2108fa01c 100644
--- a/tests/destructor/tuse_ownedref_after_move.nim
+++ b/tests/destructor/tuse_ownedref_after_move.nim
@@ -1,6 +1,6 @@
 discard """
   cmd: '''nim c --newruntime $file'''
-  errormsg: "'=' is not available for type <owned Widget>; requires a copy because it's not the last read of ':envAlt.b1()'; another read is done here: tuse_ownedref_after_move.nim(53, 4)"
+  errormsg: "'=' is not available for type <owned Button>; requires a copy because it's not the last read of ':envAlt.b1'; another read is done here: tuse_ownedref_after_move.nim(53, 4)"
   line: 49
 """