I am trying to compile a project that I did not touched for a bit of time (nimnews), and now when I compile it I have the following error:
$ nimble c -d:ssl src/web/newsweb
...
src/nntp/protocol.nim(136, 15) Error: ambiguous call; both asyncdispatch.await(f: Future[await.T]) [template declared in /home/mildred/.choosenim/toolchains/nim-1.6.6/lib/pure/asyncmacro.nim(128, 10)] and asyncmacro.await(f: Future[await.T]) [template declared in /home/mildred/.choosenim/toolchains/nim-1.6.6/lib/pure/asyncmacro.nim(128, 10)] match for: (Future[system.void])
The problem is that asyncdispatch is imported, but not asyncmacro. it does not appear at all in my project. How can this be?
template await*[T](f: Future[T]): auto {.used.} = var internalTmpFuture: FutureBase = f yield internalTmpFuture (cast[typeof(f)](internalTmpFuture)).read()
I suspect that there is an ambiguity with generic type T, but what's strange is that prefixing the await macro with the module name (asyncdispatch.await) makes it work. Another way to work around tis issue is by not importing await but instead:
from asyncdispatch import Future, async, newFuture, complete
template await[T](f: Future[T]): auto {.used.} = asyncdispatch.await(f)
There is an issue that made me understand a bit what could happen: https://github.com/nim-lang/Nim/issues/18861