ruff
48dcdd0e - [ty] Restrict range implications from gradual equivalence (#29577)

Commit
3 days ago
[ty] Restrict range implications from gradual equivalence (#29577) Fix false `invalid-argument-type` errors when inferring constrained type variables from callbacks that return an invariant generic with a gradual type argument. A callback returning `Box[Any]` can satisfy `Callable[[], T | Box[T]]` when `T` is constrained to `str` or `bytes`. The solver treated equivalence to a gradual type as exact substitution, allowing a valid union alternative to imply an incompatible bound. Require a static equivalence bound before deriving either lower- or upper-bound implications, including when gradual types are nested inside a bound. Prerequisite to avoid regressions in #29236.
Author
Parents
Loading