mirror of https://github.com/astral-sh/ruff
This commit is contained in:
parent
6d4949bae1
commit
c8c915de00
|
|
@ -318,7 +318,7 @@ impl ModuleName {
|
|||
db: &dyn Db,
|
||||
importing_file: File,
|
||||
) -> Result<Self, ModuleNameResolutionError> {
|
||||
relative_module_name(db, importing_file, None, NonZeroU32::new(1).unwrap())
|
||||
Self::from_identifier_parts(db, importing_file, None, 1)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1555,11 +1555,11 @@ impl<'ast> Visitor<'ast> for SemanticIndexBuilder<'_, 'ast> {
|
|||
);
|
||||
}
|
||||
} else {
|
||||
self.imported_modules.extend(
|
||||
module_name
|
||||
.ancestors()
|
||||
.zip(std::iter::repeat(ImportKind::ImportFrom)),
|
||||
);
|
||||
for name in module_name.ancestors() {
|
||||
self.imported_modules
|
||||
.entry(name)
|
||||
.or_insert(ImportKind::ImportFrom);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13244,13 +13244,9 @@ impl<'db> ModuleLiteralType<'db> {
|
|||
.into_iter()
|
||||
.flat_map(|file| imported_modules(db, file))
|
||||
.filter_map(|(submodule_name, kind)| {
|
||||
Some((submodule_name.relative_to(self.module(db).name(db))?, kind))
|
||||
})
|
||||
.filter_map(|(relative_submodule, kind)| {
|
||||
relative_submodule
|
||||
.components()
|
||||
.next()
|
||||
.map(|module| (Name::from(module), *kind))
|
||||
let relative_name = submodule_name.relative_to(self.module(db).name(db))?;
|
||||
let available_attribute = relative_name.components().next()?;
|
||||
Some((Name::from(available_attribute), *kind))
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue