[ty] Limit fixed-length tuple expansion in overload matching#23190
Merged
charliermarsh merged 1 commit intomainfrom Feb 10, 2026
Merged
[ty] Limit fixed-length tuple expansion in overload matching#23190charliermarsh merged 1 commit intomainfrom
charliermarsh merged 1 commit intomainfrom
Conversation
Typing conformance resultsNo changes detected ✅ |
|
AlexWaygood
reviewed
Feb 9, 2026
| let expanded = per_element | ||
| .into_iter() | ||
| .multi_cartesian_product() | ||
| .map(|types| Type::tuple(TupleType::heterogeneous(db, types))) |
Member
There was a problem hiding this comment.
Suggested change
| .map(|types| Type::tuple(TupleType::heterogeneous(db, types))) | |
| .map(|types| Type::heterogeneous_tuple(db, types)) |
Member
Author
There was a problem hiding this comment.
(Oops, will do this in a follow-up commit.)
AlexWaygood
approved these changes
Feb 9, 2026
Member
|
It could be interesting to test whether this helps out with astral-sh/ty#1393 as well |
charliermarsh
added a commit
that referenced
this pull request
Feb 10, 2026
## Summary Small follow-ups from #23190.
carljm
added a commit
to Hugo-Polloli/ruff
that referenced
this pull request
Feb 10, 2026
* main: [ty] Fix Pyright links; use `heterogeneous_tuple` (astral-sh#23193) [ty] Limit fixed-length tuple expansion in overload matching (astral-sh#23190) Fixed import in `runtime-evaluated-decorators` example (astral-sh#23187)
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.
Summary
When resolving overloaded calls, ty expands tuple arguments via Cartesian product as required by the spec. This PR adjusts our behavior to match pyright, which limits to 64 types for a single tuple and 256 across. (As-is, we only applied a 512 limit after expanding.)
Closes astral-sh/ty#1870.