ruff
52ce26bd - [ty] Avoid reporting overload errors for successful union variants (#22688)

Commit
30 days ago
[ty] Avoid reporting overload errors for successful union variants (#22688) ## Summary Consider `x: str | bytes` and then `x.split(" ")`. Because we have a union, and at least one variant errors (`bytes` expects a `Buffer`, not a `str`), we call `binding.report_diagnostics` for each variant. For the `str` variant, it has two overloads that both match arity, but only one actually matches the signature... So `matching_overload_before_type_checking` is `None` (because they both match arity), but we don't actually have an error, and we fall through to `NO_MATCHING_OVERLOAD`. If one variant succeeds, we should avoid reporting errors for it, even if not _all_ variants matched.
Author
Parents
Loading