This commit is contained in:
Alex Waygood 2025-11-22 23:45:41 +00:00 committed by Aria Desires
parent 6d4949bae1
commit c8c915de00
3 changed files with 9 additions and 13 deletions

View File

@ -318,7 +318,7 @@ impl ModuleName {
db: &dyn Db, db: &dyn Db,
importing_file: File, importing_file: File,
) -> Result<Self, ModuleNameResolutionError> { ) -> Result<Self, ModuleNameResolutionError> {
relative_module_name(db, importing_file, None, NonZeroU32::new(1).unwrap()) Self::from_identifier_parts(db, importing_file, None, 1)
} }
} }

View File

@ -1555,11 +1555,11 @@ impl<'ast> Visitor<'ast> for SemanticIndexBuilder<'_, 'ast> {
); );
} }
} else { } else {
self.imported_modules.extend( for name in module_name.ancestors() {
module_name self.imported_modules
.ancestors() .entry(name)
.zip(std::iter::repeat(ImportKind::ImportFrom)), .or_insert(ImportKind::ImportFrom);
); }
} }
} }
} }

View File

@ -13244,13 +13244,9 @@ impl<'db> ModuleLiteralType<'db> {
.into_iter() .into_iter()
.flat_map(|file| imported_modules(db, file)) .flat_map(|file| imported_modules(db, file))
.filter_map(|(submodule_name, kind)| { .filter_map(|(submodule_name, kind)| {
Some((submodule_name.relative_to(self.module(db).name(db))?, kind)) let relative_name = submodule_name.relative_to(self.module(db).name(db))?;
}) let available_attribute = relative_name.components().next()?;
.filter_map(|(relative_submodule, kind)| { Some((Name::from(available_attribute), *kind))
relative_submodule
.components()
.next()
.map(|module| (Name::from(module), *kind))
}) })
} }