lean4-htt/tests/lean/envExtensionSealed.lean
Leonardo de Moura c19814a624 chore: avoid memory leak
@Kha I suspect the memory leaks reported at the CI are due to
an exception produced by the compiler.
The compiler is currently a mix of Lean and C++ code.
I think the exception was thrown from C++ code, crossed Lean code (producing
memory leaks), and was caught by the old frontend written in C++.

We will eventually replace the compiler C++ code with Lean code.
So, I think this is a low priority issue.
2020-09-21 13:30:58 -07:00

17 lines
239 B
Text

import Lean
namespace Lean
def ex1 : CoreM Nat := do
env ← getEnv;
pure $ privateExt.getState env
#eval ex1
def ex2 : CoreM Nat := do
env ← getEnv;
pure $ { privateExt with idx := 3 }.getState env -- Error
-- #eval ex2
end Lean