Skip to content

Conversation

@rjmccall
Copy link
Contributor

@rjmccall rjmccall commented Dec 16, 2025

This is the test case from #69028 (comment).

Explanation: Parameter binding usually doesn't have an abstraction pattern that's meaningfully different from the formal types of the parameters, but it can when we're emitting a closure in an abstracted type context. A tuple parameter with a type like (repeat each T) is actually passed as a pack of elements. The binding logic handled some of the cases here, but because it was primarily type-matching on the substituted type rather than the AP, it was not properly handling the vanishing tuple case where T is a singleton pack and therefore (repeat each T) is no longer a tuple.
Original PR: #86078
Risk: Low; the new code re-uses a significant amount of the existing logic from reabstraction thunks, which is fairly well-tested.
Testing: New regression tests added
Reviewers: none as of yet

expansion component.

Use this in emitPackTransform; this reorders a couple of projections,
but that's fine, and the result is much cleaner and has better separation
of concerns.
This only happens when binding parameters under an abstraction pattern
and can therefore only currently happen with closures passed to functions
that take variadic generic tuples (that happen to vanish).

This is relatively straightforward using ExpandedTupleInputGenerator,
and it cleans the code up a fair bit.
@rjmccall rjmccall requested a review from a team as a code owner December 16, 2025 22:20
@rjmccall
Copy link
Contributor Author

@swift-ci Please test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant