parent
49d1822c8f
commit
d56848878c
5 changed files with 25 additions and 5 deletions
|
|
@ -352,6 +352,8 @@ proc passCopyToSink(n: PNode; c: var Con): PNode =
|
||||||
("passing '$1' to a sink parameter introduces an implicit copy; " &
|
("passing '$1' to a sink parameter introduces an implicit copy; " &
|
||||||
"use 'move($1)' to prevent it") % $n)
|
"use 'move($1)' to prevent it") % $n)
|
||||||
else:
|
else:
|
||||||
|
if c.graph.config.selectedGC in {gcArc, gcOrc}:
|
||||||
|
assert(not containsGarbageCollectedRef(n.typ))
|
||||||
result.add newTree(nkAsgn, tmp, p(n, c, normal))
|
result.add newTree(nkAsgn, tmp, p(n, c, normal))
|
||||||
result.add tmp
|
result.add tmp
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -656,7 +656,7 @@ proc fillBody(c: var TLiftCtx; t: PType; body, x, y: PNode) =
|
||||||
of tyTuple:
|
of tyTuple:
|
||||||
fillBodyTup(c, t, body, x, y)
|
fillBodyTup(c, t, body, x, y)
|
||||||
of tyVarargs, tyOpenArray:
|
of tyVarargs, tyOpenArray:
|
||||||
if c.kind == attachedDestructor:
|
if c.kind == attachedDestructor and (tfHasAsgn in t.flags or useNoGc(c, t)):
|
||||||
forallElements(c, t, body, x, y)
|
forallElements(c, t, body, x, y)
|
||||||
else:
|
else:
|
||||||
discard "cannot copy openArray"
|
discard "cannot copy openArray"
|
||||||
|
|
|
||||||
|
|
@ -907,9 +907,15 @@ proc track(tracked: PEffects, n: PNode) =
|
||||||
nkMacroDef, nkTemplateDef, nkLambda, nkDo, nkFuncDef:
|
nkMacroDef, nkTemplateDef, nkLambda, nkDo, nkFuncDef:
|
||||||
discard
|
discard
|
||||||
of nkCast, nkHiddenStdConv, nkHiddenSubConv, nkConv:
|
of nkCast, nkHiddenStdConv, nkHiddenSubConv, nkConv:
|
||||||
if n.len == 2: track(tracked, n[1])
|
if n.len == 2:
|
||||||
|
track(tracked, n[1])
|
||||||
|
if tracked.owner.kind != skMacro:
|
||||||
|
createTypeBoundOps(tracked, n.typ, n.info)
|
||||||
of nkObjUpConv, nkObjDownConv, nkChckRange, nkChckRangeF, nkChckRange64:
|
of nkObjUpConv, nkObjDownConv, nkChckRange, nkChckRangeF, nkChckRange64:
|
||||||
if n.len == 1: track(tracked, n[0])
|
if n.len == 1:
|
||||||
|
track(tracked, n[0])
|
||||||
|
if tracked.owner.kind != skMacro:
|
||||||
|
createTypeBoundOps(tracked, n.typ, n.info)
|
||||||
of nkBracket:
|
of nkBracket:
|
||||||
for i in 0..<n.safeLen: track(tracked, n[i])
|
for i in 0..<n.safeLen: track(tracked, n[i])
|
||||||
if tracked.owner.kind != skMacro:
|
if tracked.owner.kind != skMacro:
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ discard """
|
||||||
@[1, 2, 3]
|
@[1, 2, 3]
|
||||||
Success
|
Success
|
||||||
@["a", "b", "c"]
|
@["a", "b", "c"]
|
||||||
|
Hello
|
||||||
0'''
|
0'''
|
||||||
cmd: '''nim c --gc:arc $file'''
|
cmd: '''nim c --gc:arc $file'''
|
||||||
"""
|
"""
|
||||||
|
|
@ -114,4 +115,15 @@ proc bug12964*() =
|
||||||
|
|
||||||
bug12964()
|
bug12964()
|
||||||
|
|
||||||
|
# bug #13119
|
||||||
|
import streams
|
||||||
|
|
||||||
|
proc bug13119 =
|
||||||
|
var m = newStringStream("Hello world")
|
||||||
|
let buffer = m.readStr(5)
|
||||||
|
echo buffer
|
||||||
|
m.close
|
||||||
|
|
||||||
|
bug13119()
|
||||||
|
|
||||||
echo getOccupiedMem() - startMem
|
echo getOccupiedMem() - startMem
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue