parent
e7e9007c4c
commit
8c12d3e29d
2 changed files with 68 additions and 54 deletions
|
|
@ -755,8 +755,7 @@ proc trackCall(tracked: PEffects; n: PNode) =
|
||||||
if n.typ != nil:
|
if n.typ != nil:
|
||||||
if tracked.owner.kind != skMacro and n.typ.skipTypes(abstractVar).kind != tyOpenArray:
|
if tracked.owner.kind != skMacro and n.typ.skipTypes(abstractVar).kind != tyOpenArray:
|
||||||
createTypeBoundOps(tracked, n.typ, n.info)
|
createTypeBoundOps(tracked, n.typ, n.info)
|
||||||
if getConstExpr(tracked.ownerModule, n, tracked.c.idgen, tracked.graph) != nil:
|
if getConstExpr(tracked.ownerModule, n, tracked.c.idgen, tracked.graph) == nil:
|
||||||
return
|
|
||||||
if a.kind == nkCast and a[1].typ.kind == tyProc:
|
if a.kind == nkCast and a[1].typ.kind == tyProc:
|
||||||
a = a[1]
|
a = a[1]
|
||||||
# XXX: in rare situations, templates and macros will reach here after
|
# XXX: in rare situations, templates and macros will reach here after
|
||||||
|
|
@ -808,10 +807,14 @@ proc trackCall(tracked: PEffects; n: PNode) =
|
||||||
optStaticBoundsCheck in tracked.currOptions:
|
optStaticBoundsCheck in tracked.currOptions:
|
||||||
checkBounds(tracked, n[1], n[2])
|
checkBounds(tracked, n[1], n[2])
|
||||||
|
|
||||||
|
if a.kind != nkSym or a.sym.magic != mRunnableExamples:
|
||||||
|
for i in 0..<n.safeLen:
|
||||||
|
track(tracked, n[i])
|
||||||
|
|
||||||
if a.kind == nkSym and a.sym.name.s.len > 0 and a.sym.name.s[0] == '=' and
|
if a.kind == nkSym and a.sym.name.s.len > 0 and a.sym.name.s[0] == '=' and
|
||||||
tracked.owner.kind != skMacro:
|
tracked.owner.kind != skMacro:
|
||||||
var opKind = find(AttachedOpToStr, a.sym.name.s.normalize)
|
var opKind = find(AttachedOpToStr, a.sym.name.s.normalize)
|
||||||
if a.sym.name.s.normalize == "=": opKind = attachedAsgn.int
|
if a.sym.name.s == "=": opKind = attachedAsgn.int
|
||||||
if opKind != -1:
|
if opKind != -1:
|
||||||
# rebind type bounds operations after createTypeBoundOps call
|
# rebind type bounds operations after createTypeBoundOps call
|
||||||
let t = n[1].typ.skipTypes({tyAlias, tyVar})
|
let t = n[1].typ.skipTypes({tyAlias, tyVar})
|
||||||
|
|
@ -821,9 +824,6 @@ proc trackCall(tracked: PEffects; n: PNode) =
|
||||||
if op != nil:
|
if op != nil:
|
||||||
n[0].sym = op
|
n[0].sym = op
|
||||||
|
|
||||||
if a.kind != nkSym or a.sym.magic != mRunnableExamples:
|
|
||||||
for i in 0..<n.safeLen:
|
|
||||||
track(tracked, n[i])
|
|
||||||
if op != nil and op.kind == tyProc:
|
if op != nil and op.kind == tyProc:
|
||||||
for i in 1..<min(n.safeLen, op.len):
|
for i in 1..<min(n.safeLen, op.len):
|
||||||
case op[i].kind
|
case op[i].kind
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,8 @@ seq[T]:
|
||||||
destroying: ('first', 42)
|
destroying: ('first', 42)
|
||||||
destroying: ('second', 20)
|
destroying: ('second', 20)
|
||||||
destroying: ('third', 12)
|
destroying: ('third', 12)
|
||||||
|
|
||||||
|
1 1
|
||||||
'''
|
'''
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
@ -112,3 +114,15 @@ echo()
|
||||||
echo "seq[T]:"
|
echo "seq[T]:"
|
||||||
seqT()
|
seqT()
|
||||||
echo()
|
echo()
|
||||||
|
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# Issue #16120, const seq into sink
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
proc main =
|
||||||
|
let avals = @[@[1.0'f32, 4.0, 7.0, 10.0]]
|
||||||
|
let rankdef = avals
|
||||||
|
echo avals.len, " ", rankdef.len
|
||||||
|
|
||||||
|
main()
|
||||||
Loading…
Add table
Add a link
Reference in a new issue