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

asyncjs: declaring .async proc inside an .async proc gives CT error #17177

Closed
timotheecour opened this issue Feb 24, 2021 · 0 comments
Closed
Labels
Async Everything related to Nim's async Javascript

Comments

@timotheecour
Copy link
Member

timotheecour commented Feb 24, 2021

Example

import std/asyncjs
proc fn1(n: int): Future[int] {.async.} = return n
proc main2() =
  proc fn2(n: int): Future[int] {.async.} = return n
proc main3(a: auto) =
  proc fn3(n: int): Future[int] {.async.} = return n
proc main4() {.async.} =
  proc fn4(n: int): Future[int] {.async.} = return n # xxx bug: uncomment this and it works
  discard

Current Output

/Users/timothee/git_clone/nim/timn/tests/nim/all/t11907.nim(11, 1) template/generic instantiation from here
/Users/timothee/git_clone/nim/timn/tests/nim/all/t11907.nim(12, 52) Error: type mismatch:
 got 'Future[Future[system.int]]' for 'jsResolve(jsResolve(n))' [ref declared in /Users/timothee/git_clone/nim/Nim_devel/lib/js/asyncjs.nim(68, 3)]
 but expected 'Future[system.int]' [ref declared in /Users/timothee/git_clone/nim/Nim_devel/lib/js/asyncjs.nim(68, 3)]
    proc fn4(n: int): Future[int] {.async.} = return n

Expected Output

works

Additional Information

@timotheecour timotheecour added Javascript Async Everything related to Nim's async labels Feb 24, 2021
ringabout added a commit to ringabout/Nim that referenced this issue Mar 3, 2021
ringabout added a commit to ringabout/Nim that referenced this issue Mar 3, 2021
@Araq Araq closed this as completed in ec068a2 Mar 3, 2021
ringabout added a commit to ringabout/Nim that referenced this issue Mar 22, 2021
* remove unnecessary when statement

* remove outdated codes

* fix nim-lang#17177

* add testcase
ardek66 pushed a commit to ardek66/Nim that referenced this issue Mar 26, 2021
* remove unnecessary when statement

* remove outdated codes

* fix nim-lang#17177

* add testcase
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 Javascript
Projects
None yet
Development

No branches or pull requests

1 participant