mirror of
https://github.com/nim-lang/Nim.git
synced 2026-08-27 17:11:40 +00:00
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:
28
tests/effects/tissue25976.nim
Normal file
28
tests/effects/tissue25976.nim
Normal 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()
|
||||
Reference in New Issue
Block a user