Skip to content

SILGen: Treat Optional x! force unwrapping as a forwarding operation. #73531

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
May 9, 2024

Conversation

jckarter
Copy link
Contributor

@jckarter jckarter commented May 8, 2024

Like ? or property access, x! can be borrowing, consuming, or mutated through depending on the use site and the ownership of the base value. Alter SILGen to emit x! as a borrowing operation when the result is only used as a borrow. Fix the move-only checker not to treat the unreachable branch as a dead path for values and try to destroy the value unnecessarily and possibly out-of-order with cleanups on the value. Fixes rdar://127459955.

Like `?` or property access, `x!` can be borrowing, consuming, or mutated
through depending on the use site and the ownership of the base value.
Alter SILGen to emit `x!` as a borrowing operation when the result is only
used as a borrow. Fix the move-only checker not to treat the unreachable
branch as a dead path for values and try to destroy the value unnecessarily
and possibly out-of-order with cleanups on the value. Fixes rdar://127459955.
@jckarter jckarter requested a review from kavon as a code owner May 8, 2024 23:24
@jckarter
Copy link
Contributor Author

jckarter commented May 8, 2024

@swift-ci Please test

@jckarter
Copy link
Contributor Author

jckarter commented May 9, 2024

@swift-ci Please test source compatibility

@jckarter jckarter merged commit 2d61e3d into swiftlang:main May 9, 2024
5 of 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.

1 participant