Skip to content

[Sema] Emit a deprecation warning if a Hashable type only implements hashValue #21057

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 4 commits into from
Dec 19, 2018

Conversation

lorentey
Copy link
Member

@lorentey lorentey commented Dec 5, 2018

SE-206 deprecated hashValue as a protocol requirement. We should gently encourage people to migrate to hash(into:), for its more secure, easier and faster hashing.

Emit a compiler warning whenever hashValue has an explicit implementation, but hash(into:) doesn’t.

rdar://problem/39838478

(This was originally part of #20685)

…into:) isn’t

SE-206 deprecated hashValue as a protocol requirement. We should gently encourage people to migrate to hash(into:), for its more secure, easier and faster hashing.

Emit a compiler warning whenever hashValue has an explicit implementation, but hash(into:) doesn’t.
@lorentey
Copy link
Member Author

lorentey commented Dec 5, 2018

Note: The warning location currently isn't set correctly when the hashValue implementation comes from a protocol extension.

The PR below works around this, as well as reducing the sheer volume of Error-related warnings.

#21056
@swift-ci test

@swift-ci
Copy link
Contributor

swift-ci commented Dec 5, 2018

Build failed
Swift Test OS X Platform
Git Sha - cb3cff5

@lorentey
Copy link
Member Author

@swift-ci test

1 similar comment
@lorentey
Copy link
Member Author

@swift-ci test

@jrose-apple
Copy link
Contributor

You can't test two PRs from the same repo at the same time. (@millenomi just filed a request Radar to be able to do this, though.)

@lorentey lorentey requested a review from slavapestov December 17, 2018 17:44
@lorentey
Copy link
Member Author

cc @natecook1000 for the documentation changes. (We don't have a good way to deprecate protocol requirements, so we have to point out the deprecation in the docs instead.)

Copy link
Member

@natecook1000 natecook1000 left a comment

Choose a reason for hiding this comment

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

Tiny change, otherwise LGTM. Thanks!

Co-Authored-By: lorentey <klorentey@apple.com>
@lorentey
Copy link
Member Author

@swift-ci test

@lorentey lorentey requested a review from jrose-apple December 19, 2018 14:33
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.

4 participants