Zulip Chat Archive
Stream: lean4
Topic: trace[debug] in linters
Eric Wieser (Nov 29 2024 at 13:08):
I discovered today that trace[debug]
doesn't work in linters, because the trace state is discarded here. Is this deliberate? If so, is there an easy way to copy the traceState into the messages into my own code, so that I can see why my linter is failing?
Jannis Limperg (Nov 29 2024 at 13:28):
You probably already know this, but you can use dbg_trace
instead, this goes directly to stdout.
Eric Wieser (Nov 29 2024 at 13:29):
My actual issue is that the output of trace.Meta.synthInstance
is not appearing anywhere
Sebastian Ullrich (Nov 29 2024 at 13:30):
Not easily I believe as addTraceAsMessages
has been made public and generic only recently. However I went ahead and fixed this in lean#4460 as there any non-reporting state is discarded anyway at the end of the thread.
Eric Wieser (Nov 29 2024 at 13:32):
let traces := (← getTraceState).traces.toList
if !traces.isEmpty then
Lean.logInfo <| m!"Traces from linter:" ++ .joinSep (traces.map (·.msg)) .nil
seemed to work for me to at least see the output
Last updated: May 02 2025 at 03:31 UTC