Skip to content

[6.0] Implement pack element reference captures #74039

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

slavapestov
Copy link
Contributor

6.0 cherry-pick of #74020 and @xedin's #73849.

Description: Builds upon #73541 to implement the missing cases involving closures appearing inside pack expansion expressions.

Scope of the issue: A very commonly reported bug.

Origination: This never worked.

Risk: Low. This re-purposes existing code for capturing OpaqueValueExprs, which arises up in property wrapper lowering. Now closures track captures of PackElementExprs in the same way.

Reviewed: @hborla @rjmccall

Radar: rdar://110711746, rdar://119212867, rdar://124202697.

@slavapestov slavapestov requested a review from a team as a code owner May 31, 2024 02:01
slavapestov and others added 5 commits May 30, 2024 22:03
…s in

Type variable reference collector needs to be augmented to collect
type variables associated with pack expansions that a closure references
elements of, otherwise it would get disconnected from the context.
…nto scope

If closure appears inside of a pack expansion, the elements
that reference pack elements have to bring expansion's shape
type in scope to make sure that the shapes match.
@slavapestov slavapestov force-pushed the pack-element-expr-capture-6.0 branch from 0f493b8 to b6e8b39 Compare May 31, 2024 02:03
@slavapestov slavapestov force-pushed the pack-element-expr-capture-6.0 branch from b6e8b39 to 6809dc9 Compare May 31, 2024 21:07
@slavapestov
Copy link
Contributor Author

@swift-ci Please test

@slavapestov
Copy link
Contributor Author

@swift-ci Please test source compatibility

@slavapestov slavapestov merged commit 9accd0d into swiftlang:release/6.0 Jun 1, 2024
7 checks passed
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.

3 participants