This PR adjusts the experimental module system to make `private` the default visibility modifier in `module`s, introducing `public` as a new modifier instead. `public section` can be used to revert the default for an entire section, though this is more intended to ease gradual adoption of the new semantics such as in `Init` (and soon `Std`) where they should be replaced by a future decl-by-decl re-review of visibilities.
27 lines
1.1 KiB
Text
27 lines
1.1 KiB
Text
public import Lean
|
|
public import Module.Basic
|
|
public import Module.Imported
|
|
public import Module.ImportedAll
|
|
public import Module.ImportedPrivateImported
|
|
public import Module.PrivateImported
|
|
public import Module.ImportedAllPrivateImported
|
|
public 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)
|