status-im / nim-websock

Websocket for Nim
81 stars 15 forks source link

Ambiguous error for async pragma #124

Closed jfilby closed 2 years ago

jfilby commented 2 years ago

I'm trying to use nim-websock, but I get a compilation error:

Error: ambiguous call; both asyncdispatch.async(prc: untyped) [macro declared in ...\.choosenim\toolchains\nim-1.6.6\lib\pure\asyncmacro.nim(253, 7)]
and asyncloop.async(prc: untyped) [macro declared in ...\.nimble\pkgs\chronos-3.0.6\chronos\asyncmacro2.nim(393, 7)] match for: ()

This is from simply adding an {.async.} pragma to the proc that will call this library's Websocket procs.

arnetheduck commented 2 years ago

It looks like the module in which you're trying to use websock imports both asyncdispatch and websock - websock is based on chronos which replaces and extends asyncdispatch - you cannot use both at the same time.