Upgrade salsa (#13757)

This commit is contained in:
Micha Reiser 2024-10-15 13:06:32 +02:00 committed by GitHub
parent 72ac6cd5a5
commit 5f65e842e8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 143 additions and 120 deletions

View file

@ -19,18 +19,18 @@ impl<'a> Resolver<'a> {
pub(crate) fn resolve(&self, import: CollectedImport) -> Option<&'a FilePath> {
match import {
CollectedImport::Import(import) => {
resolve_module(self.db, import).map(|module| module.file().path(self.db))
resolve_module(self.db, &import).map(|module| module.file().path(self.db))
}
CollectedImport::ImportFrom(import) => {
// Attempt to resolve the member (e.g., given `from foo import bar`, look for `foo.bar`).
let parent = import.parent();
resolve_module(self.db, import)
resolve_module(self.db, &import)
.map(|module| module.file().path(self.db))
.or_else(|| {
// Attempt to resolve the module (e.g., given `from foo import bar`, look for `foo`).
resolve_module(self.db, parent?).map(|module| module.file().path(self.db))
resolve_module(self.db, &parent?).map(|module| module.file().path(self.db))
})
}
}