Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Its impossible to specify Future[T].Raising([]) as argument. #532

Open
cheatfate opened this issue Apr 12, 2024 · 0 comments
Open

Its impossible to specify Future[T].Raising([]) as argument. #532

cheatfate opened this issue Apr 12, 2024 · 0 comments

Comments

@cheatfate
Copy link
Collaborator

Following example is impossible to compile

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant