multisync now allows tuples in return type (#21074)
* Add test case * Use .toStrLit() on param node first This means that more complex types are fully rendered
This commit is contained in:
parent
1585bfec3b
commit
c7493bbdd0
2 changed files with 21 additions and 2 deletions
19
tests/async/t20111.nim
Normal file
19
tests/async/t20111.nim
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
discard """
|
||||
action: "run"
|
||||
"""
|
||||
import asyncdispatch
|
||||
type
|
||||
Sync = object
|
||||
Async = object
|
||||
SyncRes = (Sync, string)
|
||||
AsyncRes = (Async, string)
|
||||
|
||||
proc foo(val: Sync | Async): Future[(Async, string) | (Sync, string)] {.multisync.} =
|
||||
return (val, "hello")
|
||||
|
||||
let
|
||||
myAsync = Async()
|
||||
mySync = Sync()
|
||||
|
||||
doAssert typeof(waitFor foo(myAsync)) is AsyncRes
|
||||
doAssert typeof(foo(mySync)) is SyncRes
|
||||
Loading…
Add table
Add a link
Reference in a new issue