When given multiple inputs that have messages in outputs, it seems that repl will accumulate these messages for later outputs, particularly, these messages are marked with positions from previous inputs, causing confusing results.
Note that, the 2nd command contains only 1 line, but there is a message marked with position on line 2 that is from the previous command.
It gets worse for more commands, and they are unlikely to be deduplicated from the user end, except maybe filtering out identical messages for the same line with different input line.
A visual example for more commands can be seen here:
where the arrows are pointing from the later output to the earlier output, both are reported in wrong positions for the later output.
I can see the relevant code in Lean.Elab.IO.processInput didn't filter any message, but I could not find how the positions got wrong in repl code base, maybe it has a deeper origin.
When given multiple inputs that have messages in outputs, it seems that
repl
will accumulate these messages for later outputs, particularly, these messages are marked with positions from previous inputs, causing confusing results.2 minimal example input/output pairs of
repl
:Note that, the 2nd command contains only 1 line, but there is a message marked with position on line 2 that is from the previous command.
It gets worse for more commands, and they are unlikely to be deduplicated from the user end, except maybe filtering out identical messages for the same line with different input line.
A visual example for more commands can be seen here:
where the arrows are pointing from the later output to the earlier output, both are reported in wrong positions for the later output.