fix: disable panic messages during initialization
This is a temporary workaround until we implement #467. Fixes #534
This commit is contained in:
parent
730c3e2db9
commit
2018dc0959
3 changed files with 17 additions and 0 deletions
|
|
@ -158,7 +158,11 @@ def emitMainFn : M Unit := do
|
|||
else
|
||||
emitLn "lean_initialize_runtime_module();"
|
||||
let modName ← getModName
|
||||
/- We disable panic messages because they do not mesh well with extracted closed terms.
|
||||
See issue #534. We can remove this workaround after we implement issue #467. -/
|
||||
emitLn "lean_set_panic_messages(false);"
|
||||
emitLn ("res = " ++ mkModuleInitializationFunctionName modName ++ "(lean_io_mk_world());")
|
||||
emitLn "lean_set_panic_messages(true);"
|
||||
emitLns ["lean_io_mark_end_initialization();",
|
||||
"if (lean_io_result_is_ok(res)) {",
|
||||
"lean_dec_ref(res);",
|
||||
|
|
|
|||
12
tests/compiler/534.lean
Normal file
12
tests/compiler/534.lean
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
def foo (array : Array Nat) : Nat -> Nat
|
||||
| 0 => 0
|
||||
| n + 1 =>
|
||||
let array := array.filter (!.==5)
|
||||
if array.isEmpty then
|
||||
0
|
||||
else
|
||||
let arrayOfLast := #[array.back]
|
||||
foo arrayOfLast n
|
||||
|
||||
def main : IO Unit :=
|
||||
IO.println ("hi")
|
||||
1
tests/compiler/534.lean.expected.out
Normal file
1
tests/compiler/534.lean.expected.out
Normal file
|
|
@ -0,0 +1 @@
|
|||
hi
|
||||
Loading…
Add table
Reference in a new issue