ruff
4eb2045b - [ty] Preserve type-variable order when reloading constraints (#27904)

Commit
94 days ago
[ty] Preserve type-variable order when reloading constraints (#27904) ## Summary Reloading an owned constraint set could reverse its type-variable ordering, causing successive loads to alternate between two equivalent representations of the same constraint. A generic protocol with a nested explicit receiver could consequently exhaust Salsa's cycle iterations during constructor inference. Preserve the saved order of referenced type variables before rebuilding constraints. Existing destination IDs remain unchanged, and wholly unused type variables are not carried into the new builder. Retain support records for constraints kept only as source-order metadata so those variables can also be restored correctly. Closes https://github.com/astral-sh/ty/issues/4337. ## Test plan - Add unit coverage for repeated lower-bound, upper-bound, and equality-constraint round trips; discarded type variables; loading into an existing storage overlay; and retained quantified-constraint ordering. - Add a protocol mdtest that infers a constructor's type argument from a generic protocol with a nested explicit receiver and another generic method, asserting that checking terminates and infers `Implementation[int]`. - Compare the full mdtest suite under reversed and XOR-permuted constraint orderings against unchanged main; existing order-sensitive failures are identical.
Author
Parents
Loading