ruff
7d50b9e4 - [ty] Preserve all alternatives in bounded intersections (#27898)

Commit
25 days ago
[ty] Preserve all alternatives in bounded intersections (#27898) Bounded intersection expansion could silently drop alternatives after the first four members of a union. The first union is intentionally exempt from the expansion budget, but ignoring a failed insertion did not actually insert the omitted member. This let the helper return a partial type as though it were exact, causing false-positive diagnostics such as the regression exposed by #27664. Apply the budget exemption inside candidate insertion. Preserve every alternative of the first union, while continuing to return `None` if later expansion exceeds the budget. Fixes astral-sh/ty#4335. ## Test plan - Unit tests cover late union members surviving an intersection in either operand order, the single-union fast path, and genuine budget exhaustion returning `None` instead of a partial result. - Mdtests cover redundant upper bounds on five-member gradual unions, including a reduced recursive-alias regression with `Divergent` members.
Author
Parents
Loading