Zulip Chat Archive
Stream: lean4
Topic: Minor bug in tracing locations with docstrings
Thomas Murrills (Jul 09 2023 at 09:03):
This is on 4.0.0-nightly-2023-06-20
. Is anyone else able to reproduce it? Here are the steps:
Start with:
set_option trace.compiler.ir true
/- text -/
def x : Unit := () -- trace appears here
Change /-
to /--
:
set_option trace.compiler.ir true
/-- text -/ -- trace appears here
def x : Unit := ()
Change /--
back to /-
:
set_option trace.compiler.ir true
/- text -/ -- trace persists here
def x : Unit := ()
I can't imagine this is very important in itself, but I figured I'd bring it up in case the underlying issue inadvertently affects other things. :)
Mac Malone (Jul 12 2023 at 14:14):
This is because a docstring comment is not really a "comment" in the traditional sense (i.e., an ignored part of the grammar). Instead, a docstring comment is part of a declaration's concrete syntax.
As a trace appears at the start of a declaration, and the docstring is part of the declaration, the trace appears on it. Inversely, a normal block comment is not part of the declaration, so the trace does not appear on it.
Kyle Miller (Jul 12 2023 at 14:17):
@Mac That's not the issue -- it's that when you change /--
to /-
the info stays on the /-
Mac Malone (Jul 12 2023 at 14:20):
Kyle Miller Oh, oops! :sweat_smile:
Kyle Miller (Jul 12 2023 at 14:21):
(I wonder though if we could have definition/theorem/etc. commands set def
/theorem
/etc. to be the ref for where trace messages pop up.)
Last updated: Dec 20 2023 at 11:08 UTC