lean4-htt/tests/pkg/module/Module.lean
Mac Malone f3e3ebba81
refactor: move import validation to parser & Lake (#9716)
This PR moves the validation of cross-package `import all` to Lake and
the syntax validation of import keywords (`public`, `meta`, and `all`)
to the two import parsers.

It also fixes the error reporting of the fast import parser
(`Lean.parseImports`) and adds positions to its errors.
2025-08-05 22:36:54 +00:00

27 lines
1,022 B
Text

import Lean
import Module.Basic
import Module.Imported
import Module.ImportedAll
import Module.ImportedPrivateImported
import Module.PrivateImported
import Module.ImportedAllPrivateImported
import Module.NonModule
/-! # 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)