Skip to content

Prefer RawRepresentable fix-its that don't require an extra conversion #17714

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 2 commits into from
Jul 3, 2018

Conversation

jrose-apple
Copy link
Contributor

Two fixes around RawRepresentable fix-its:

  • Fix RawRepresentable fix-its for single unlabeled arguments

    They were being put outside the call parentheses instead of inside. We even had tests for this; I just got them wrong.

  • Prefer RawRepresentable fix-its that don't require an extra conversion

    That is, if a type has a raw value of Int, and the function being called has overloads for both Int and UInt, we always want to offer a fix-it that leads to the 'Int' overload, not insert a conversion to UInt that might be incorrect.

SR-8150 / rdar://problem/41725207

They were being put outside the call parentheses instead of inside.
We even had tests for this; I just got them wrong.

https://bugs.swift.org/browse/SR-8150
That is, if a type has a raw value of Int, and the function being
called has overloads for both Int and UInt, we always want to offer a
fix-it that leads to the 'Int' overload, not insert a conversion to
UInt that might be incorrect.

More https://bugs.swift.org/browse/SR-8150.
@jrose-apple jrose-apple requested review from xedin and ahoppen July 3, 2018 20:28
@jrose-apple
Copy link
Contributor Author

@swift-ci Please test

@jrose-apple jrose-apple requested a review from rudkx July 3, 2018 22:25
Copy link
Member

@DougGregor DougGregor left a comment

Choose a reason for hiding this comment

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

LGTM

@jrose-apple jrose-apple merged commit 9116f95 into swiftlang:master Jul 3, 2018
@jrose-apple jrose-apple deleted the raw-deal branch July 3, 2018 23:03
jrose-apple added a commit to jrose-apple/swift that referenced this pull request Jul 3, 2018
Prefer RawRepresentable fix-its that don't require an extra conversion

https://bugs.swift.org/browse/SR-8150
(cherry picked from commit 9116f95)
jrose-apple added a commit that referenced this pull request Jul 4, 2018
Prefer RawRepresentable fix-its that don't require an extra conversion

https://bugs.swift.org/browse/SR-8150
(cherry picked from commit 9116f95)
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.

2 participants