Skip to content

Conversation

@xedin
Copy link
Contributor

@xedin xedin commented Oct 30, 2025

Since try! now forces l-value -> r-value conversion during CSGen, let's simplify solution application to try expressions by coercing sub-expression to a type of a try itself which would introduce all necessary loads.

Since `try!` now forces l-value -> r-value conversion during
CSGen, let's simplify solution application to `try` expressions
by coercing sub-expression to a type of a `try` itself which
would introduce all necessary loads.
@xedin xedin requested a review from hborla as a code owner October 30, 2025 07:07
@xedin
Copy link
Contributor Author

xedin commented Oct 30, 2025

@swift-ci please smoke test

Copy link
Contributor

@slavapestov slavapestov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Does the same trick work for visitConsumeExpr and visitCopyExpr which are defined right above and appear to have been copy and pasted from visitTryExpr?

@xedin
Copy link
Contributor Author

xedin commented Oct 30, 2025

@swift-ci It should but I might need to tweak CSGen as well, I wanted to refactor them as well last night but ran out of steam :) Will open a separate PR for that and a few other places that use simplifyExprTypes I noticed.

@xedin xedin merged commit 0eceb64 into swiftlang:main Oct 30, 2025
3 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