nim-works / cps

Continuation-Passing Style for Nim 🔗

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CPS doesn't rewrite locals with proc types correctly

alaviss opened this issue · comments

import cps

proc foo(x: int) =
  discard

proc bar() {.cps: Continuation.} =
  var f = foo
  f(10)

bar()

Got:

test.nim(7, 7) Error: inconsistent typing for reintroduced symbol 'f': previous type was: proc (x: int){.noSideEffect, gcsafe, locks: 0.}; new type is: proc (x: int){.closure.}

What made you decide this is a CPS bug?

I just put it there until I figure out where the issue is from.

Reported upstream: nim-lang/Nim#19010