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:
Andrew Gallant 2025-05-09 09:44:00 -04:00 committed by Andrew Gallant
parent 90272ad85a
commit 5ea3a52c8a
6 changed files with 152 additions and 19 deletions

View file

@ -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);
}
}