[ty] Make Module a Salsa ingredient

We want to write queries that depend on `Module` for caching. While it
seems it can be done without making `Module` an ingredient, it seems it
is best practice to do so.

[best practice to do so]: https://github.com/astral-sh/ruff/pull/19408#discussion_r2215867301
This commit is contained in:
Andrew Gallant 2025-07-18 14:15:42 -04:00 committed by Andrew Gallant
parent 905b9d7f51
commit 4573a0f6a0
24 changed files with 258 additions and 253 deletions

View file

@ -103,7 +103,7 @@ impl<'db> DunderAllNamesCollector<'db> {
};
let Some(module_dunder_all_names) = module_literal
.module(self.db)
.file()
.file(self.db)
.and_then(|file| dunder_all_names(self.db, file))
else {
// The module either does not have a `__all__` variable or it is invalid.
@ -173,7 +173,7 @@ impl<'db> DunderAllNamesCollector<'db> {
let module_name =
ModuleName::from_import_statement(self.db, self.file, import_from).ok()?;
let module = resolve_module(self.db, &module_name)?;
dunder_all_names(self.db, module.file()?)
dunder_all_names(self.db, module.file(self.db)?)
}
/// Infer the type of a standalone expression.