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

async proc inside a generic proc gives CT error #16786

Closed
timotheecour opened this issue Jan 21, 2021 · 0 comments · Fixed by #17598 or #17562
Closed

async proc inside a generic proc gives CT error #16786

timotheecour opened this issue Jan 21, 2021 · 0 comments · Fixed by #17598 or #17562
Labels
Async Everything related to Nim's async Generics

Comments

@timotheecour
Copy link
Member

Example

when true:
  import asyncdispatch
  # ok
  block:
    proc main(a: int|string)=
      proc bar(b: int|string) = echo b
      bar(a)
    main(1)

  block:
    proc main(a: int) : Future[void] {.async.} =
      proc bar(b: int): Future[void] {.async.} = echo b
      await bar(a)
    waitFor main(1)

  block:
    proc main(a: int) : Future[void] {.async.} =
      proc bar(b: int | string): Future[void] {.async.} = echo b
      await bar(a)
    waitFor main(1)

  block:
    # bug
    proc main(a: int|string) =
      proc bar(b: int): Future[void] {.async.} = echo b
      waitFor bar(a)
    main(1) # uncomment and it'll work, otherwise Error: invalid type: 'void' for var

Current Output

Error: invalid type: 'void' for var

Expected Output

works

Additional Information

1.5.1 2b5841c
root cause for #16741

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Async Everything related to Nim's async Generics
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant