You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to write the result operator such that the following test works
as you might expect:
block:
## assignment shim with constant
r =0procbar(a: int): int {.cps: Cont.} =inc r
noop()
return a *2procfoo() {.cps: Cont.} =inc r
let x =...bar(4) # ie. resolve the continuationinc r
check x ==8trampolinefoo()
check r ==3
The ... should resolve the result stashed in the continuation into x.
I get the following error message because my output (a statement list)
does not allow me to raise the method definition to top level. I don't
expect a statement list to be a level, per se, and I don't know how a
macro could ever return more than a single method unless this limit
is lifted.
/home/adavidoff/git/cps/tests/taste.nim(48, 1) template/generic instantiation of `testes` from here
/home/adavidoff/git/cps/tests/taste.nim(539, 31) template/generic instantiation of `cps` from here
/home/adavidoff/git/cps/cps/environment.nim(214, 16) Error: 'method' is only allowed at top level
For clarity, here's a tree dump of the before/after AST.
So, yeah, it works if you're not a nimpleton who's trying to write tests using a unittest framework that might move methods out of toplevel because, what the fuck, why not?
edit: code in the results branch
I'm trying to write the result operator such that the following test works
as you might expect:
The
...
should resolve the result stashed in the continuation intox
.I get the following error message because my output (a statement list)
does not allow me to raise the method definition to top level. I don't
expect a statement list to be a level, per se, and I don't know how a
macro could ever return more than a single
method
unless this limitis lifted.
For clarity, here's a tree dump of the before/after AST.
The text was updated successfully, but these errors were encountered: