[ty] Add bounded constraint solution projections - #27949
Merged
Merged
Conversation
Typing conformance resultsNo changes detected ✅Current numbersThe percentage of diagnostics emitted that were expected errors held steady at 97.68%. The percentage of expected errors that received a diagnostic held steady at 93.44%. The number of fully passing files held steady at 109/136. |
Memory usage reportMemory usage unchanged ✅ |
|
dcreager
approved these changes
Aug 21, 2026
dcreager
left a comment
Member
There was a problem hiding this comment.
Looks good. Should we consider using this new trait for the fuel budget inside of PathAssignments at some point, as well? That would let it be a shared budget. Not at all a blocker.
| /// that can expand them. It should combine alternatives commutatively when their order is not | ||
| /// meaningful to its consumer. Existing limitations in solution extraction still apply; this | ||
| /// API does not make an order-sensitive selector or fold order-independent. | ||
| #[expect(clippy::too_many_arguments)] |
Contributor
Author
Yeah I think that's worth evaluating. It's almost certainly possible to share more infrastructure; whether they should actually be shared budgets is less clear to me. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Constraint solution extraction can enumerate an exponentially large family of paths even when sequent derivation and intersection construction stay within their existing limits. This adds separate limits for solution traversal, collected paths, and retained type terms. Exceeding a limit aborts the projection without exposing a partial family as the complete answer.
ConstraintSetsolution collection is fallible and bounded by default. Callers preserve the original signature or constraints, decline optional narrowing, or useUnknownwhen a projection cannot finish. Generic inference does not treat evidence from the remaining arguments as complete.A fallible fold processes complete per-path bindings, preserving correlations between type variables until the consumer combines alternatives. Generic inference uses the collector and fold while retaining its merged-specialization behavior below the limits.
This is a foundation for astral-sh/ty#3557. It does not yet change call inference to intersect separately specialized return types.
Test plan
Unknownrecovery after genuine projection exhaustion, even with precise evidence from another argument, in both argument orders.