ruff
a62ba8c6 - [ty] Fix overloaded callable assignability for unary Callable targets (#23277)

Commit
23 hours ago
[ty] Fix overloaded callable assignability for unary Callable targets (#23277) ## Summary Fixes https://github.com/astral-sh/ty/issues/2546 Improves assignability checking from overloaded callables to a single `Callable[...]` target with an explicit union parameter domain. Previously, this was handled with per-overload `when_any` checks. This PR replaces that with an aggregate probe over the overload set that: - filters down to overlapping overload arms, - unions their parameter domains and return types, - checks parameter coverage and return compatibility against the target callable. The aggregate probe is accept-only ie. if it isn't definitively satisfied, we fall back to the existing `when_any` behavior. This change is intentionally scoped to unary targets with explicit union domains and excludes dynamic/typevar candidates. General `n > 1` overload-set assignability is a way larger problem left for later. ## Test Plan - Added/updated mdtests for explicit [ #2546 ](https://github.com/astral-sh/ty/issues/2546) repros and negative cases (missing domain coverage, incompatible return union) in legacy generic-callables. - Added mdtests for overloaded generic-callable argument handling in legacy and PEP 695 callables, including `Callable[[T], T]` under union-constrained inference. - Added dataclass-transform converter coverage (`overloaded_converter`, `ConverterClass`) with an explicit TODO expectation for the still unhandled `converter=dict` case. - Added a reduced SymPy one-import MRE to lock the overload/protocol panic shape. - Updated Liskov tests for unannotated overrides of overloaded dunder methods. --------- Co-authored-by: Douglas Creager <dcreager@dcreager.net>
Author
Parents
Loading