fixes #6499; disallow built-in procs used as procvars (#22291)

This commit is contained in:
ringabout
2023-07-19 15:45:28 +08:00
committed by GitHub
parent 14a9929464
commit 1aff402998
3 changed files with 7 additions and 4 deletions

View File

@@ -1223,6 +1223,7 @@ proc track(tracked: PEffects, n: PNode) =
of nkTupleConstr:
for i in 0..<n.len:
track(tracked, n[i])
notNilCheck(tracked, n[i].skipColon, n[i].typ)
if tracked.owner.kind != skMacro:
if n[i].kind == nkExprColonExpr:
createTypeBoundOps(tracked, n[i][0].typ, n.info)

6
tests/errmsgs/t6499.nim Normal file
View File

@@ -0,0 +1,6 @@
discard """
errormsg: "'chr' is a built-in and cannot be used as a first-class procedure"
"""
# bug #6499
let x = (chr, 0)

View File

@@ -57,10 +57,6 @@ block t9442:
GC_ref(v3)
GC_unref(v3)
block: # bug #6499
let x = (chr, 0)
doAssert x[1] == 0
block: # bug #12229
proc foo(T: typedesc) = discard
foo(ref)