lean4-htt/tests/pkg/module/Module.lean
Sebastian Ullrich c8cdb57c4b
feat: move non-essential metadata into .olean.server (#8068)
This PR ensures that for modules opted into the experimental module
system, we do not import module docstrings or declaration ranges.

Excluding declaration docstrings as well would require some more work to
make `[inherit_doc]` leave a mere reference to the other declaration
instead of copying its docstring eagerly.
2025-04-24 08:12:26 +00:00

23 lines
848 B
Text

module
import Lean
import Module.Basic
/-! # Module system basic tests -/
open Lean
/-! Non-essential metadata should only be accessible at level >= .server -/
#eval show IO Unit from do
let env ← importModules (level := .exported) #[`Module.Basic] {}
assert! env.header.isModule
let _ ← Core.CoreM.toIO (ctx := { fileName := "module.lean", fileMap := default }) (s := { env }) do
assert! (← findDeclarationRanges? ``f).isNone
assert! (getModuleDoc? (← getEnv) `Module.Basic).any (·.size == 0)
#eval show IO Unit from do
let env ← importModules (level := .server) #[`Module.Basic] {}
let _ ← Core.CoreM.toIO (ctx := { fileName := "module.lean", fileMap := default }) (s := { env }) do
assert! (← findDeclarationRanges? ``f).isSome
assert! (getModuleDoc? (← getEnv) `Module.Basic).any (·.size == 1)