Skip to content

[4.0][Exclusivity] Don't suggest copying to a local when swapAt() is appro… #11028

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

Conversation

devincoughlin
Copy link
Contributor

…priate

Update static exclusivity diagnostics to not suggest copying to a local
when a call to swapAt() should be used instead. We already emit a FixIt in
this case, so don't suggest an an helpful fix in the diagnostic.

rdar://problem/32296784

…priate

Update static exclusivity diagnostics to not suggest copying to a local
when a call to swapAt() should be used instead. We already emit a FixIt in
this case, so don't suggest an an helpful fix in the diagnostic.

rdar://problem/32296784
@devincoughlin
Copy link
Contributor Author

CCC Information:

Explanation: This changes updates the static diagnostic emitted when a call to swap() violates exclusive access. If the call to swap can be replaced with a call to MutableCollection.swapAt() the diagnostic text now recommends that rather than copying to a local. We already have a FixIt for this; now the main diagnostic text is consistent with the FixIt.

Scope: This is a diagnostic-only change. It is not a source-breaking change. It improves a fairly common case of an uncommon diagnostic.

Radar: rdar://problem/32296784
Risk: Low. It only affects paths on which a diagnostic would already be emitted.
Testing: I've added regression tests and run on the source compatibility suite.

@devincoughlin
Copy link
Contributor Author

@atrick Would you mind reviewing for CCC?

@devincoughlin
Copy link
Contributor Author

@swift-ci Please smoke test

@devincoughlin devincoughlin requested a review from atrick July 18, 2017 00:53
Copy link
Contributor

@atrick atrick left a comment

Choose a reason for hiding this comment

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

🏅 Looks good for CCC.
Nice work.

@devincoughlin
Copy link
Contributor Author

Approved by @AnnaZaks.

@devincoughlin
Copy link
Contributor Author

@swift-ci Please smoke test and merge.

@devincoughlin
Copy link
Contributor Author

@swift-ci Please test and merge

@swift-ci swift-ci merged commit 40d3ec9 into swiftlang:swift-4.0-branch Jul 18, 2017
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