You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I know this is a compiler regression when using Nim devel.
But I cannot pinpoint or how to reproduce without chronos.
This issue is to remind us because we often use Opt[T] and Option[T] as return type.
Conditions to reproduce:
One of the asymc proc params should be generic type
The return type is Opt[seq[T]] or Option[seq[T]]
It's an async proc
import
std/options,
chronos,
results
typeBID=stringoruint64procapple(blockId: BID): Future[Option[seq[int]]] {.async.} =result= options.none(seq[int])
procbanana(blockId: BID): Future[Opt[seq[int]]] {.async.} =result=Opt.none(seq[int])
let x =waitForapple("latest")
let y =waitForbanana("latest")
error messages:
...bug.nim(12, 21) template/generic instantiation of `musk` from here
...bug.nim(9, 39) Error: cannot instantiate Option [type declared in ...nim\lib\pure\options.nim(91, 3)]
got: <T>
but expected: <T>
Plain functions like this compiles fine, don't know what happened inside async proc to cause compilation failure.
The text was updated successfully, but these errors were encountered:
jangko
changed the title
Async proc: both Option[seq[T]] and Opt[seq[T]] as return type and one of the params is generic, failed to compile with Nim v2
Async proc: both Option[seq[T]] and Opt[seq[T]] as return type and one of the params is generic, failed to compile with Nim-devel
Feb 14, 2024
I know this is a compiler regression when using Nim devel.
But I cannot pinpoint or how to reproduce without chronos.
This issue is to remind us because we often use
Opt[T]
andOption[T]
as return type.Conditions to reproduce:
Opt[seq[T]]
orOption[seq[T]]
error messages:
Plain functions like this compiles fine, don't know what happened inside async proc to cause compilation failure.
The text was updated successfully, but these errors were encountered: