fixes #23635; tasks.toTask Doesn't Expect a Dot Expression (#23641)

fixes #23635

---------

Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
(cherry picked from commit cc5ce72376)
This commit is contained in:
ringabout
2024-05-27 22:58:43 +08:00
committed by narimiran
parent b6a8dcd922
commit dc62ee00df
2 changed files with 56 additions and 4 deletions

View File

@@ -523,3 +523,39 @@ block:
doAssert resB == "abcdef"
testReturnValues()
block: # bug #23635
block:
type
Store = object
run: proc (a: int) {.nimcall, gcsafe.}
block:
var count = 0
proc hello(a: int) =
inc count, a
var store = Store()
store.run = hello
let b = toTask store.run(13)
b.invoke()
doAssert count == 13
block:
type
Store = object
run: proc () {.nimcall, gcsafe.}
block:
var count = 0
proc hello() =
inc count, 1
var store = Store()
store.run = hello
let b = toTask store.run()
b.invoke()
doAssert count == 1