Closed orialb closed 2 years ago
Yes, I know about this problem. I researched it a little bit a while ago, and found some Julia-internal metadata with function file and line number. I don't remember why I didn't just overwrite it with known correct entries after a top-level form has been loaded. It's definitely worth another look.
I tried to fix this. Commit 4c826e8 takes care of locations for xref purposes, but not for stack traces. I don't know enough about Julia internals to solve this, and posted a question on Discourse: https://discourse.julialang.org/t/updating-the-location-of-a-method-definition/65247/1
thanks for looking into this!
Thanks to a great suggestion on Discourse, I think I finally fixed this: 7bdfef8.
Consider the following code:
And evaluate
foo
withjulia-snail-send-top-level-form
.The resulting stack trace when running in the REPL is:
This can make it hard to figure out where is the error coming from in a more complicated situation (for example line numbers don't correspond to those in the actual source file).
I don't know if there is a way to somehow track the correct source file when evaluating code in the way snail does or how complicated it would be to do so. Maybe one can look into Revise for inspiration as it seems that there stack-traces point to the correct place after re-evaluation of the code (but maybe the re-evaluation mechanism is too different than Snail, I don't know).