Fix package module resolution in inline imports

We were still passing `ModuleIds` from `load` to `can`, but now
that imports can appear in any scope, we don't know which package
an unqualified module name belongs to from the top level.

We now pass `PackageModuleIds` instead  and keep a Map of `ModuleName` to
`ModuleId` in `Scope`.

This also allow us to import multiple modules with the same name from different
packages as long as a unique alias is provided.
This commit is contained in:
Agus Zubiaga 2024-03-31 21:10:14 -03:00
parent 842a256907
commit 1f347f6ca1
No known key found for this signature in database
13 changed files with 398 additions and 309 deletions

View file

@ -198,6 +198,7 @@ pub struct ParsedModule<'a> {
pub packages: MutMap<&'a str, PackageName<'a>>,
pub initial_scope: MutMap<Ident, (Symbol, Region)>,
pub exposes: Vec<Symbol>,
pub opt_shorthand: Option<&'a str>,
}
#[derive(Debug)]