Skip to content

[4.2] Handle stray LoadExprs in RawRepresentable fix-its #17847

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

jrose-apple
Copy link
Contributor

  • Explanation: The fix-it for automatically inserting .rawValue is still syntactically invalid when the expression is a single, unlabeled call argument that references a mutable property or variable. Recognize the unusual recovery AST that gets built in this situation and make sure the fix-it goes in the right place.

  • Scope: Affects error diagnostics only, and even then only cases where we would have already decided that this was the right message to emit. This does come up in migration due to new NS_TYPED_ENUMs.

  • Issue: SR-8150 / rdar://problem/41725207 (again)

  • Risk: Very low. There's one additional special case that then immediately goes back to the existing code path.

  • Testing: Added compiler regression tests.

  • Reviewed by: @rudkx

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)
@jrose-apple
Copy link
Contributor Author

@swift-ci Please test

@jrose-apple
Copy link
Contributor Author

@swift-ci Please nominate

@jrose-apple jrose-apple merged commit e29ece1 into swiftlang:swift-4.2-branch Jul 10, 2018
@jrose-apple jrose-apple deleted the 4.2-an-even-more-raw-deal branch July 10, 2018 20:30
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