nim-works / cps

Continuation-Passing Style for Nim 🔗

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error on discarding cps result

zevv opened this issue · comments

import cps

type C = Continuation

proc getchunk(): string {.cps:C.} =
  echo "chunk"

proc foo() {.cps:C.} =
  discard getchunk() 

foo()

results in

/tmp/t.nim(9, 14) template/generic instantiation of `cps` from here
/tmp/t.nim(10, 11) Error: expression '
proc Post Child_402654004(continuation: C): C {.cpsLift(), nimcall, cpsCont().} =
  mixin tail
  mixin head
  mixin unwind
  mixin pass
  mixin dealloc
  mixin alloc
  mixin trace
  mixin coop
  if not isNil(continuation.ex):
    try:
      raise continuation.ex
    finally:
      continuation.ex = nil
  discard
  {.cpsPending().}

continuation.fn = Post Child_402654004
cps environment_402653933(continuation).child_402653966 = cps environment_402653320(
    tail(Continuation(continuation), C(whelp_402653330())))
return typeof(continuation) do:
  Continuation(cps environment_402653933(continuation).child_402653966)' has no type (or is ambiguous)

@alaviss I can't remember if I was supposed to implement this.