Skip to content

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