import chronos
func foo*[T](future: Future[T].Raising([])): bool =
false
when isMainModule:
let resFut = Future[void].Raising([CancelledError]).init()
echo foo(resFut)
It will generate an error:
testraisesarg.nim(3, 31) Error: type mismatch: got <typedesc[Future[foo.T]], array[0..-1, empty]>
but expected one of:
macro Raising[T](F: typedesc[Future[T]]; E: typed): untyped
first type mismatch at position: 1
required type for F: typedesc[Future[Raising.T]]
but expression 'Future[T]' is of type: typedesc[Future[foo.T]]
expression: Raising(Future[T], [])
In such way it become impossible to work with Futures as arguments.
Following example is impossible to compile
It will generate an error:
In such way it become impossible to work with Futures as arguments.