lean4-htt/tests/lean/run/instances.lean
Sebastian Ullrich 5df4e48dc9
feat: importModules without loading environment extensions (#6325)
This PR ensures that environments can be loaded, repeatedly, without
executing arbitrary code
2025-04-02 08:37:11 +00:00

17 lines
433 B
Text

import Lean
open Lean
open Lean.Meta
instance : ToFormat InstanceEntry where
format e := format e.val
unsafe def tst1 : IO Unit := do
let env ← importModules (loadExts := true) #[{module := `Lean}] {}
let aux : MetaM Unit := do
let insts ← getGlobalInstancesIndex
assert! insts.size > 0
IO.println (format insts)
discard <| aux.run |>.toIO { fileName := "", fileMap := default } { env := env }
#eval tst1