Skip to content

Handle stray LoadExprs in RawRepresentable fix-its #17804

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
Jul 9, 2018

Conversation

jrose-apple
Copy link
Contributor

When there are multiple possible overloads for a call, the partially-type-checked argument expression might end up with a LoadExpr outside of the call ParenExpr instead of inside it. Account for this in a one- off way for the rawValue / init(rawValue:) fix-its.

Yet more SR-8150 / rdar://problem/41725207. (Follow-up to #17714.)

When there are multiple possible overloads for a call, the partially-
type-checked argument expression might end up with a LoadExpr outside
of the call ParenExpr instead of inside it. Account for this in a one-
off way for the 'rawValue' / 'init(rawValue:)' fix-its.

Yet more https://bugs.swift.org/browse/SR-8150
@jrose-apple jrose-apple requested review from xedin and rudkx July 6, 2018 21:40
@jrose-apple
Copy link
Contributor Author

@swift-ci Please smoke test

@jrose-apple
Copy link
Contributor Author

@swift-ci Please test source compatibility

Copy link
Contributor

@rudkx rudkx left a comment

Choose a reason for hiding this comment

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

LGTM. I suspect that's a result of something like an LValue-typed paren and coerceToType naively adding a load.

@jrose-apple
Copy link
Contributor Author

@xedin said he might have a more general fix, so I'll hold off for now.

@xedin
Copy link
Contributor

xedin commented Jul 7, 2018

Yes! I'm about to create a PR for that which changes CSApply/ASTVerifier to make sure that immediate paren/force-value expressions are always outside of load.

@jrose-apple
Copy link
Contributor Author

We're going to use this as a definite fix for 4.2 and continue investigating the rest of it on master.

@jrose-apple jrose-apple merged commit c468ca1 into swiftlang:master Jul 9, 2018
@jrose-apple jrose-apple deleted the an-even-more-raw-deal branch July 9, 2018 22:22
jrose-apple added a commit to jrose-apple/swift that referenced this pull request Jul 9, 2018
When there are multiple possible overloads for a call, the partially-
type-checked argument expression might end up with a LoadExpr outside
of the call ParenExpr instead of inside it. Account for this in a one-
off way for the 'rawValue' / 'init(rawValue:)' fix-its.

Yet more https://bugs.swift.org/browse/SR-8150

(cherry picked from commit c468ca1)
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