nim-works / cps

Continuation-Passing Style for Nim 🔗

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Calling a magic of a different base type is a runtime error instead of compile time

alaviss opened this issue · comments

import cps

type
  C = ref object of Continuation

proc magic(c: C): C {.cpsMagic.} = discard

proc foo() {.cps: Continuation.} =
  magic()

foo()
/home/leorize/documents/sources/cps/test.nim(8) foo
/home/leorize/documents/sources/cps/test.nim(11) test
/home/leorize/documents/sources/cps/test.nim(8) foo
/home/leorize/documents/sources/cps/cps/spec.nim(463) trampoline
/home/leorize/documents/sources/cps/test.nim(9) foo_436207811
/usr/lib/nim/lib/system/fatal.nim(53) sysFatal
[[reraised from:
/home/leorize/documents/sources/cps/test.nim(11) test
/home/leorize/documents/sources/cps/test.nim(8) foo
/home/leorize/documents/sources/cps/cps/spec.nim(463) trampoline
/home/leorize/documents/sources/cps/cps/transform.nim(1061) foo_436207811
/home/leorize/documents/sources/cps/cps/transform.nim(1028) unwind
]]
Error: unhandled exception: invalid object conversion [ObjectConversionDefect]