Skip to content
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

Remove Type's hash_value function #32399

Merged
merged 2 commits into from
Jun 16, 2020
Merged

Conversation

hamishknight
Copy link
Contributor

Defining hash_value for Type makes it easy to forget that the underlying pointer is being hashed directly without canonicalization. Instead, define it only for CanType, and make Type users spell getPointer explicitly.

In addition, fix TypeWitnessAndDecl's equality to match its hashing implementation.

Defining `hash_value` for `Type` makes it easy to
forget that the underlying pointer is being hashed
directly without canonicalization.

Instead, define it only for `CanType`, and make
`Type` users spell `getPointer` explicitly.
It was incorrectly hashing the type as a pointer
but canonicalizing for equality. Change equality
to compare pointers.
@hamishknight
Copy link
Contributor Author

@swift-ci please test

@hamishknight hamishknight requested a review from CodaFi June 16, 2020 00:53
@swiftlang swiftlang deleted a comment from swift-ci Jun 16, 2020
@CodaFi
Copy link
Contributor

CodaFi commented Jun 16, 2020

@CodaFi CodaFi merged commit 0de7fb8 into swiftlang:master Jun 16, 2020
@hamishknight hamishknight deleted the salted-hash branch June 16, 2020 16:49
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