[ty] Use constraint sets as pending state in `SpecializationBuilder` (#24540)
This PR implements the bulk of the logic needed for https://github.com/astral-sh/ty/issues/2799, by building up a `ConstraintSet` in `SpecializationBuilder`. This constraint set holds the "pending state" of the specialization being inferred. It will eventually _replace_ the `types` hash map, which stores a simple mapping from typevars to inferred types, and which is always updated by unioning together types when we find multiple solutions for a typevar. For now, we are building up both pending state representations, and solving from the constraint set where we can. There are two main cases where we must fall back on the old solver: - Any specialization that involves a `ParamSpec` - If the constraint set returns `Unsatisfiable` or `Unconstrained` Follow-on PRs will address these remaining cases that use the old solver; once they are all migrated over to the constraint set solver, we will remove the `types` field. Closes astral-sh/ty#2572 Closes astral-sh/ty#2959 Closes astral-sh/ty#3037 Closes astral-sh/ty#3203 Closes astral-sh/ty#3228 Closes astral-sh/ty#3428 Closes astral-sh/ty#3483
D
Douglas Creager committed
0f3ea5adc449e00b805750b5aadf94194eabcfa5
Parent: 3856288
Committed by GitHub <noreply@github.com>
on 5/26/2026, 7:56:28 PM