fix #25976: treat proc-type forbids as an empty tag set (#25980)

fix #25976

Initialize tagEffects for proc types that declare .forbids but omit
.tags,
so they behave like explicit tags: [] during indirect-call effect
tracking.
Add a regression for the nested callback assignment case.

(cherry picked from commit 4b1444e728)
This commit is contained in:
ringabout
2026-07-10 13:39:32 +08:00
committed by narimiran
parent 5c1fdc90b6
commit eca3741f76
2 changed files with 34 additions and 1 deletions

View File

@@ -0,0 +1,28 @@
type
NestedPoll = object of RootEffect
CallbackFunc = proc(arg: pointer) {.gcsafe, raises: [], forbids: [NestedPoll].}
TaggedCallbackFunc = proc(arg: pointer) {.gcsafe, raises: [], tags: [], forbids: [NestedPoll].}
InternalAsyncCallback = object
fn: CallbackFunc
TaggedInternalAsyncCallback = object
fn: TaggedCallbackFunc
proc closeSocket(aftercb: CallbackFunc = nil) =
proc continuation(udata: pointer) =
aftercb(nil)
let acb = InternalAsyncCallback(fn: continuation)
discard acb
proc closeSocketTagged(aftercb: TaggedCallbackFunc = nil) =
proc continuation(udata: pointer) =
aftercb(nil)
let acb = TaggedInternalAsyncCallback(fn: continuation)
discard acb
closeSocket()
closeSocketTagged()