Await unable to wait futures from objects fields #4390

Closed
edubart opened this Issue Jun 21, 2016 · 0 comments

Projects

None yet

1 participant

@edubart
Contributor
edubart commented Jun 21, 2016

Await does not compile when using in futures inside object fields, like the following example:

import asyncdispatch

type Foo = object
  futs: Future[void]

proc boo(foo: Foo) {.async.} =
  await foo.futs

Error:

stack trace: (most recent call last)
lib/pure/asyncdispatch.nim(1933) async
lib/pure/asyncdispatch.nim(1872) asyncSingleProc
lib/pure/asyncdispatch.nim(1807) processBody
lib/pure/asyncdispatch.nim(1721) processBody
test.nim(6, 20) template/generic instantiation from here
lib/pure/asyncdispatch.nim(1721, 14) Error: Invalid node kind in 'await', got: nnkDotExpr

Workaround:

proc boo(foo: Foo) {.async.} =
  let fut = foo.futs
  await fut
@dom96 dom96 pushed a commit that closed this issue Jun 21, 2016
@edubart edubart Fix #4390 404b5b5
@dom96 dom96 closed this in 404b5b5 Jun 21, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment