import cps
proc foo() {.cps: Continuation.} =
const X = 10
var x: array[X, int]
got:
test.nim(3, 14) template/generic instantiation of `cps` from here
test.nim(5, 16) Error: undeclared identifier: 'X'
The problem is that Nim did not inline X into array[X, int], which is carried over to the environment definition, where X doesn't exist.