ARC: closure inside object constructor now works
This commit is contained in:
parent
bcab3ed06c
commit
f22d3c75aa
3 changed files with 30 additions and 4 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
"""
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue