Skip to content

Conversation

@lorentey
Copy link
Member

  • Update checkHashable to verify that different values hash differently -- we can do this with hash(into:) because we can eliminate hash collisions by trying different seeds.
  • Switch MinimalHashable* types to use _hash(into:) as the primary hashing interface.

This makes it easier to understand failure traces in test logs.
This is safe to do with hash(into:), because random hash collisions can be eliminated with awesome certainty by trying a number of different hash seeds. (Unless there is a weakness in SipHash.)

In some cases, we intentionally want hashing to produce looser equivalency classes than equality — to let those cases keep working, add an optional hashEqualityOracle parameter.

Review usages of checkHashable and add hash oracles as needed.
This prototype is not fully implemented, and it relies on specific hash values to not trigger unhandled cases.

To keep its test working, define and use a custom hashing interface that emulates hashValue behavior prior to SE-0206.
@lorentey lorentey force-pushed the better-hash-tests branch from 645aa56 to 6984782 Compare April 20, 2018 18:22
@lorentey
Copy link
Member Author

@swift-ci please test

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