zevv / npeg

PEGs for Nim, another take
MIT License
330 stars 22 forks source link

Check if traces can be popped from exceptions #51

Closed ehmry closed 1 year ago

ehmry commented 1 year ago

I have strange problem with manipulating Exception.trace that gives me this error:

preserves-nim/src/preserves/private/parse.nim(82, 24) template/generic instantiation of `peg` from here
npeg/src/npeg/codegen.nim(440, 55) template/generic instantiation of `fn_run`gensym730` from here
npeg/src/npeg/codegen.nim(352, 16) Error: expression 'discard' has no type (or is ambiguous)

The code that causes this problem is here but only when it is imported elsewhere.

zevv commented 1 year ago

Thanks for the fix; problem is that I do not yet understand the root cause of the error, and I can't seem to reproduce. Do you happen to have some small standalone code that shows this behavior?

ehmry commented 1 year ago

I can only reproduce the problem when its npeg <- preserves <- syndicate. This fixes it but I'm working on making better test to try and figure out how this happened.

zevv commented 1 year ago

Well, I assume that your fix can only make things better; everything passes the tests so I will just spin a new release with this before it hits others. Thanks!