File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed
Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -1878,7 +1878,13 @@ private def findOLeanParts (mod : Name) : IO (Array System.FilePath) := do
18781878
18791879partial def importModulesCore
18801880 (imports : Array Import) (isModule := false ) (arts : NameMap ModuleArtifacts := {}) :
1881- ImportStateM Unit := go imports (importAll := true ) (isExported := isModule)
1881+ ImportStateM Unit := do
1882+ go imports (importAll := true ) (isExported := isModule)
1883+ if isModule then
1884+ for i in imports do
1885+ if let some mod := (← get).moduleNameMap[i.module]?.bind (·.mainModule?) then
1886+ if !mod.isModule then
1887+ throw <| IO.userError s! "cannot import non`-module` { i.module} from `module`"
18821888/-
18831889When the module system is disabled for the root, we import all transitively referenced modules and
18841890ignore any module system annotations on the way.
@@ -1950,11 +1956,6 @@ where go (imports : Array Import) (importAll : Bool) (isExported : Bool) := do
19501956 -- `imports` is identical for each part
19511957 let some (baseMod, _) := parts[0 ]? | unreachable!
19521958 goRec baseMod.imports
1953- if baseMod.isModule && isModule then
1954- for i' in imports do
1955- if let some mod := (← get).moduleNameMap[i'.module]?.bind (·.mainModule?) then
1956- if !mod.isModule then
1957- throw <| IO.userError s! "cannot import non`-module` { i'.module} from `module` { i.module} "
19581959 modify fun s => { s with
19591960 moduleNameMap := s.moduleNameMap.insert i.module { i with importAll, isExported, parts }
19601961 moduleNames := s.moduleNames.push i.module
You can’t perform that action at this time.
0 commit comments