Skip to content

[5.1][stdlib] RawRepresentable: revert to default _rawHashValue(seed:) #25928

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

lorentey
Copy link
Member

@lorentey lorentey commented Jul 1, 2019

Cherry-picked from #25873

Explanation: In 5.0, RawRepresentable types aren't able to customize their hashing by implementing the usual hash(into:) method. This resolves this issue, allowing RawRepresentable types to have control over their hashing as long as they are running on the 5.1+ stdlib.
Scope: Changes the default behavior of hashing on RawRepresentable types so that custom hash(into:) implementations aren't being ignored.
Issue: https://bugs.swift.org/browse/SR-10734 / rdar://problem/51319164
Risk: Medium. When running on the 5.0 stdlib, a hash(into:) implementation in a type that conforms to RawRepresentable has no effect; in 5.1+, such implementation will have the expected effect of customizing hashing. This is a subtle change in behavior that in rare circumstances can cause backward/forward deployment issues (like any other bug fix that we cannot emit into the client).
Testing: Regression test suite, including a new test added specifically for this issue.
Reviewer: @jrose-apple

@lorentey
Copy link
Member Author

lorentey commented Jul 1, 2019

@swift-ci test

@lorentey lorentey merged commit eb6c665 into swiftlang:swift-5.1-branch Jul 2, 2019
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