diff options
author | ringabout <43030857+ringabout@users.noreply.github.com> | 2023-07-19 15:45:28 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-19 09:45:28 +0200 |
commit | 1aff402998e6c17a3d72a8dc23fb655208d93fcb (patch) | |
tree | b74577ad288e0bd85e3f3551f3d081e0a3f514b4 | |
parent | 14a9929464b9f658155ed429397216736fccc259 (diff) | |
download | Nim-1aff402998e6c17a3d72a8dc23fb655208d93fcb.tar.gz |
fixes #6499; disallow built-in procs used as procvars (#22291)
-rw-r--r-- | compiler/sempass2.nim | 1 | ||||
-rw-r--r-- | tests/errmsgs/t6499.nim | 6 | ||||
-rw-r--r-- | tests/system/tmagics.nim | 4 |
3 files changed, 7 insertions, 4 deletions
diff --git a/compiler/sempass2.nim b/compiler/sempass2.nim index b58d08a01..974711047 100644 --- a/compiler/sempass2.nim +++ b/compiler/sempass2.nim @@ -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) diff --git a/tests/errmsgs/t6499.nim b/tests/errmsgs/t6499.nim new file mode 100644 index 000000000..25e78fdbb --- /dev/null +++ b/tests/errmsgs/t6499.nim @@ -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) diff --git a/tests/system/tmagics.nim b/tests/system/tmagics.nim index e52912b74..6088c9600 100644 --- a/tests/system/tmagics.nim +++ b/tests/system/tmagics.nim @@ -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) |