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 {
31
31
protected def hashSeed : Int = getClass.hashCode
32
32
33
33
protected final def finishHash (hashCode : Int , arity : Int ): Int =
34
- avoidNotCached (hashing.finalizeHash(hashCode, arity))
34
+ avoidSpecialHashes (hashing.finalizeHash(hashCode, arity))
35
35
36
- final def identityHash = avoidNotCached (System .identityHashCode(this ))
36
+ final def identityHash = avoidSpecialHashes (System .identityHashCode(this ))
37
37
38
38
protected def finishHash (seed : Int , arity : Int , tp : Type ): Int = {
39
39
val elemHash = tp.hash
@@ -94,7 +94,10 @@ trait Hashable {
94
94
95
95
protected final def addDelta (elemHash : Int , delta : Int ) =
96
96
if (elemHash == NotCached ) NotCached
97
- else avoidNotCached (elemHash + delta)
97
+ else avoidSpecialHashes (elemHash + delta)
98
98
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
100
103
}
Original file line number Diff line number Diff line change @@ -1278,7 +1278,7 @@ object Types {
1278
1278
final def hash = {
1279
1279
if (myHash == HashUnknown ) {
1280
1280
myHash = computeHash
1281
- if (myHash == HashUnknown ) myHash = HashUnknownAlt
1281
+ assert (myHash != HashUnknown )
1282
1282
}
1283
1283
myHash
1284
1284
}
@@ -1293,7 +1293,7 @@ object Types {
1293
1293
final def hash = {
1294
1294
if (myHash == HashUnknown ) {
1295
1295
myHash = computeHash
1296
- if (myHash == HashUnknown ) myHash = HashUnknownAlt
1296
+ assert (myHash != HashUnknown )
1297
1297
}
1298
1298
myHash
1299
1299
}
You can’t perform that action at this time.
0 commit comments