fix: nested module resolution bug

This commit is contained in:
Shunsuke Shibayama 2024-02-01 02:08:07 +09:00
parent 83aae24317
commit ded10fc3d9
7 changed files with 51 additions and 24 deletions

View file

@ -10,7 +10,7 @@ use erg_common::dict;
use erg_common::dict::Dict;
use erg_common::error::{Location, MultiErrorDisplay};
use erg_common::fresh::FreshNameGenerator;
use erg_common::pathutil::mod_name;
use erg_common::pathutil::{mod_name, NormalizedPathBuf};
use erg_common::set;
use erg_common::set::Set;
use erg_common::traits::{ExitStatus, Locational, NoTypeDisplay, Runnable, Stream};
@ -2981,7 +2981,10 @@ impl<A: ASTBuildable> GenericASTLowerer<A> {
expect: Option<&Type>,
) -> hir::Call {
log!(info "entered {}", fn_name!());
let path = inline.input.path().to_path_buf();
let path = NormalizedPathBuf::from(inline.input.path().to_path_buf());
if self.module.context.mod_cached(&path) {
return self.lower_call(inline.import, expect);
}
let parent = self.get_mod_ctx().context.get_module().unwrap().clone();
let mod_ctx = ModuleContext::new(parent, dict! {});
let mod_name = mod_name(&path);