Closed alaviss closed 3 months ago
proc foo() {.compileTime.} = var x = 0 proc bar() = proc foobar() = x = 1 foobar() bar() static: foo()
test.nim(6, 7) Error: 'x' is inaccesible because run-time values cannot be captured in a compile-time context
If foobar body is inlined into bar, no error will occur.
foobar
bar
This is found while fixing npeg.
npeg
The example code not working is deliberate, although for no good nor principled reason -- I'll remove the arbitrary restriction.
Example
Actual Output
Additional Information
If
foobar
body is inlined intobar
, no error will occur.This is found while fixing
npeg
.