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
This bug concerns future development of CPS regarding the transformation of generic procedures.
Example
type
C =refobjectofRootObj
fn: ContProc
ex: refExceptionContProc=proc(c: C): C {.nimcall.}
procnoop(c: C): C = c
whenfalse:
# original procprocfoo[T](x: T) {.cps.} =noop()
echo x
typeEnv[T] =refobjectof C
x: T
procfoo_cont[U](c: C): C =procafterCall[V](c: C): C =echoEnv[V](c).x
c.fn = afterCall[U]
returnnoop(c)
procfoo[T](x: T): C =returnEnv[T](fn: foo_cont[T], x: x)
proctramp(c: sink C) =while c !=niland c.fn !=nil:
c = c.fn(c)
trampfoo(10)
trampfoo("string")
Current Output
in.nim(34, 10) template/generic instantiation of `foo` from here
in.nim(28, 29) template/generic instantiation of `foo_cont` from here
in.nim(24, 10) Error: 'afterCall' doesn't have a concrete type, due to unspecified generic parameters.
Expected Output
This should compile correctly.
In fact, if you move afterCall to outside foo_cont, this compiles and functions perfectly.
In CPS these nested procs will be moved out at the end of the transformation, however during IR passes we keep them there, and this bug would prevent immediate code like this from successfully sem.
Additional Information
$ nim -v
Nim Compiler Version 1.5.1 [Linux: amd64]
Compiled at 2021-05-01
Copyright (c) 2006-2021 by Andreas Rumpf
git hash: 13b57524d35a18df57bec2a7d6a2faa7ce712e9f
active boot switches: -d:release -d:nimUseLinenoise
The text was updated successfully, but these errors were encountered:
This bug concerns future development of CPS regarding the transformation of generic procedures.
Example
Current Output
Expected Output
This should compile correctly.
In fact, if you move
afterCall
to outsidefoo_cont
, this compiles and functions perfectly.In CPS these nested procs will be moved out at the end of the transformation, however during IR passes we keep them there, and this bug would prevent immediate code like this from successfully sem.
Additional Information
The text was updated successfully, but these errors were encountered: