status-im / nim-chronos

Chronos - An efficient library for asynchronous programming
https://status-im.github.io/nim-chronos/docs/chronos
Apache License 2.0
353 stars 51 forks source link

Fix type mismatch error in asyncstream join #433

Closed jangko closed 1 year ago

jangko commented 1 year ago

I get this error when compile using Nim 1.16.12 in nimbus-eth1

F:\projects\nimbus-eth1\vendor\nim-chronos\chronos\streams\asyncstream.nim(930, 5) template/generic instantiation of `join` from here
F:\projects\nimbus-eth1\vendor\nim-chronos\chronos\streams\asyncstream.nim(880, 14) Error: type mismatch: got <Future[system.void], proc (udata: pointer){.closure, gcsafe, locks: <unknown>.}, pointer>
but expected one of:
proc removeCallback(future: FutureBase; cb: CallbackFunc)
  first type mismatch at position: 2
  required type for cb: CallbackFunc
  but expression 'continuation' is of type: proc (udata: pointer){.closure, gcsafe, locks: <unknown>.}
  The `.raises` requirements differ.
proc removeCallback(future: FutureBase; cb: CallbackFunc; udata: pointer)
  first type mismatch at position: 2
  required type for cb: CallbackFunc
  but expression 'continuation' is of type: proc (udata: pointer){.closure, gcsafe, locks: <unknown>.}
  The `.raises` requirements differ.

expression: removeCallback(rw.future, continuation, cast[pointer](retFuture))