Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/dotty/tools/dotc/core/Hashable.scala
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,9 @@ trait Hashable {
protected final def doHash(x1: Int, x2: Int): Int =
finishHash(hashing.mix(hashing.mix(hashSeed, x1), x2), 1)

protected final def addDelta(hc: Int, delta: Int) = avoidNotCached(hc + delta)
protected final def addDelta(elemHash: Int, delta: Int) =
if (elemHash == NotCached) NotCached
else avoidNotCached(elemHash + delta)

private def avoidNotCached(h: Int) = if (h == NotCached) NotCachedAlt else h
}
2 changes: 1 addition & 1 deletion src/dotty/tools/dotc/core/Types.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2479,7 +2479,7 @@ object Types {
def copyBoundType(bt: BT) = new MethodParamImpl(bt, paramNum)

// need to customize hashCode and equals to prevent infinite recursion for dep meth types.
override def computeHash = addDelta(System.identityHashCode(binder), paramNum)
override def computeHash = addDelta(binder.identityHash, paramNum)
override def equals(that: Any) = that match {
case that: MethodParam =>
(this.binder eq that.binder) && this.paramNum == that.paramNum
Expand Down