Skip to content

Avoid calling unsupported computeHash in some situations #1632

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 1 commit into from
Nov 7, 2016

Conversation

smarter
Copy link
Member

@smarter smarter commented Oct 26, 2016

Some types do not implement computeHash, instead they override
myHash directly. This works fine as long as myHash is not equal to
HashUnknown but this was not guaranteed before this commit, if
myHash is equal to HashUnknown then computeHash is called by
CachedGroundType#hash or CachedProxyType#hash causing an exception:
https://gist.github.com/smarter/6b642db0495e995d8f3c26d614cf54d6

This commit fixes this by making sure we never compute a hash equal to
HashUnknown, instead HashUnknownAlt should be used.

Review by @odersky

Some types do not implement `computeHash`, instead they override
`myHash` directly. This works fine as long as `myHash` is not equal to
`HashUnknown` but this was not guaranteed before this commit, if
`myHash` is equal to `HashUnknown` then `computeHash` is called by
`CachedGroundType#hash` or `CachedProxyType#hash` causing an exception:
https://gist.github.com/smarter/6b642db0495e995d8f3c26d614cf54d6

This commit fixes this by making sure we never compute a hash equal to
`HashUnknown`, instead `HashUnknownAlt` should be used.
@felixmulder felixmulder merged commit 5d59024 into scala:master Nov 7, 2016
@allanrenucci allanrenucci deleted the fix/hash-assert branch December 14, 2017 19:22
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