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
precompileModules
totrue
inlakefile
(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.lean
fromB.lean
- Open
A.lean
in VSCode, and thepanic
inshould_not_panic
is 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: Dec 20 2023 at 11:08 UTC