Zulip Chat Archive
Stream: lean4
Topic: Undesired "panic" during initialization
Yicheng Qian (Aug 23 2023 at 03:26):
I came across an unexpected "panic" issue when working on a project. I've managed to reduce the problem to a mwe
- Set
precompileModulestotrueinlakefile(I'm not sure whether this matters) -
Put
def should_not_panic : Nat := Id.run <| do while true do if 1 < 2 then return 10 panic! "Unexpected error"
inA.lean -
Import
A.leanfromB.lean - Open
A.leanin VSCode, and thepanicinshould_not_panicis triggered
The problem only occurs when the panic is closed. For example the following modification of should_not_panic does not cause the above problem
def should_not_panic (q : Nat) : Nat := Id.run <| do
while true do
if 1 < 2 then
return 10
panic! s!"Unexpected error when processing {q}"
Yicheng Qian (Aug 23 2023 at 03:27):
The lean version is leanprover/lean4:nightly-2023-08-19.
Last updated: May 02 2025 at 03:31 UTC