mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-28 21:05:08 +00:00
ty_python_semantic: report all union diagnostic
This makes one very simple change: we report all call binding errors from each union variant. This does result in duplicate-seeming diagnostics. For example, when two union variants are invalid for the same reason.
This commit is contained in:
parent
90272ad85a
commit
5ea3a52c8a
6 changed files with 152 additions and 19 deletions
|
@ -199,11 +199,8 @@ impl<'db> Bindings<'db> {
|
|||
}
|
||||
}
|
||||
|
||||
// TODO: We currently only report errors for the first union element. Ideally, we'd report
|
||||
// an error saying that the union type can't be called, followed by subdiagnostics
|
||||
// explaining why.
|
||||
if let Some(first) = self.into_iter().find(|b| b.as_result().is_err()) {
|
||||
first.report_diagnostics(context, node);
|
||||
for binding in self {
|
||||
binding.report_diagnostics(context, node);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue