Skip to content

[6.1] Fix some type issues around handling closures in SendNonSendable #79164

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
merged 1 commit into from
Feb 11, 2025

Conversation

gottesmm
Copy link
Contributor

@gottesmm gottesmm commented Feb 5, 2025

This change fixes a logic error where we were not correctly checking if a type was non-Sendable by converting a potentially not lowered type from the AST to a SILType and then checking non-Sendability with that. Since the type was not lowered in cases where the formal and lowered type of a capture differed, we crashed. Instead, we now perform the check at the CanType level with formal types.

On main, I have completely eliminated this code path by just using a SIL level check (since it also fixed another unrelated issue). This was viewed as too risky for 6.1 (#78990), so I went back in and redid it just using types.
Risk: Low
Testing: Added compiler tests.
Issue: rdar://142661388
Reviewer: @xedin
Original PRs: N/A

@gottesmm gottesmm requested a review from a team as a code owner February 5, 2025 18:52
@gottesmm
Copy link
Contributor Author

gottesmm commented Feb 5, 2025

@swift-ci test

… into a SILFunction's context to actually do so.

I did this by adding a SILIsolationInfo::isNonSendableType API that takes
CanTypes and use it to avoid needing to lower certain CanTypes before performing
the query. I also made sure to use the partial apply callee function to map the
type into context, so we perform all of the correct substitutions.

rdar://138667211
@gottesmm gottesmm force-pushed the release/6.1-rdar138667211 branch from ff3e421 to 538823a Compare February 7, 2025 20:22
@gottesmm
Copy link
Contributor Author

gottesmm commented Feb 7, 2025

@swift-ci test

@gottesmm
Copy link
Contributor Author

gottesmm commented Feb 8, 2025

@swift-ci test windows platform

@gottesmm gottesmm enabled auto-merge February 10, 2025 21:42
@gottesmm
Copy link
Contributor Author

@swift-ci test windows platform

@gottesmm gottesmm merged commit 995e9e0 into swiftlang:release/6.1 Feb 11, 2025
5 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