File tree Expand file tree Collapse file tree 2 files changed +9
-6
lines changed
src/dotty/tools/dotc/core Expand file tree Collapse file tree 2 files changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -31,9 +31,9 @@ trait Hashable {
3131 protected def hashSeed : Int = getClass.hashCode
3232
3333 protected final def finishHash (hashCode : Int , arity : Int ): Int =
34- avoidNotCached (hashing.finalizeHash(hashCode, arity))
34+ avoidSpecialHashes (hashing.finalizeHash(hashCode, arity))
3535
36- final def identityHash = avoidNotCached (System .identityHashCode(this ))
36+ final def identityHash = avoidSpecialHashes (System .identityHashCode(this ))
3737
3838 protected def finishHash (seed : Int , arity : Int , tp : Type ): Int = {
3939 val elemHash = tp.hash
@@ -94,7 +94,10 @@ trait Hashable {
9494
9595 protected final def addDelta (elemHash : Int , delta : Int ) =
9696 if (elemHash == NotCached ) NotCached
97- else avoidNotCached (elemHash + delta)
97+ else avoidSpecialHashes (elemHash + delta)
9898
99- private def avoidNotCached (h : Int ) = if (h == NotCached ) NotCachedAlt else h
99+ private def avoidSpecialHashes (h : Int ) =
100+ if (h == NotCached ) NotCachedAlt
101+ else if (h == HashUnknown ) HashUnknownAlt
102+ else h
100103}
Original file line number Diff line number Diff line change @@ -1278,7 +1278,7 @@ object Types {
12781278 final def hash = {
12791279 if (myHash == HashUnknown ) {
12801280 myHash = computeHash
1281- if (myHash == HashUnknown ) myHash = HashUnknownAlt
1281+ assert (myHash != HashUnknown )
12821282 }
12831283 myHash
12841284 }
@@ -1293,7 +1293,7 @@ object Types {
12931293 final def hash = {
12941294 if (myHash == HashUnknown ) {
12951295 myHash = computeHash
1296- if (myHash == HashUnknown ) myHash = HashUnknownAlt
1296+ assert (myHash != HashUnknown )
12971297 }
12981298 myHash
12991299 }
You can’t perform that action at this time.
0 commit comments