[ty] improve invariant matching of formal union vs inferable typevar by carljm · Pull Request #24698 · astral-sh/ruff (original) (raw)
Summary
Fixes astral-sh/ty#3277.
The real root cause here is astral-sh/ty#2799, but in this case there's a narrowly-targeted fix in the old constraint solver that improves behavior and doesn't seem to have downsides, so may as well land it.
Test Plan
Added mdtests.