@@ -10,14 +10,18 @@ import annotation.tailrec
10
10
object Hashable {
11
11
12
12
/** A null terminated list of BindingTypes. We use `null` here for efficiency */
13
- class Binders (val tp : BindingType , val next : Binders | Null )
13
+ class SomeBinders (val tp : BindingType , val next : Binders )
14
+
15
+ type Binders = SomeBinders | Null
14
16
15
17
/** A null terminated list of pairs of BindingTypes. Used for isomorphism tests. */
16
- class BinderPairs (tp1 : BindingType , tp2 : BindingType , next : BinderPairs | Null ) {
18
+ class SomeBinderPairs (tp1 : BindingType , tp2 : BindingType , next : BinderPairs ) {
17
19
@ tailrec final def matches (t1 : Type , t2 : Type ): Boolean =
18
20
(t1 `eq` tp1) && (t2 `eq` tp2) || next != null && next.matches(t1, t2)
19
21
}
20
22
23
+ type BinderPairs = SomeBinderPairs | Null
24
+
21
25
/** A hash value indicating that the underlying type is not
22
26
* cached in uniques.
23
27
*/
@@ -45,24 +49,24 @@ trait Hashable {
45
49
protected final def finishHash (hashCode : Int , arity : Int ): Int =
46
50
avoidSpecialHashes(hashing.finalizeHash(hashCode, arity))
47
51
48
- final def typeHash (bs : Binders | Null , tp : Type ): Int =
52
+ final def typeHash (bs : Binders , tp : Type ): Int =
49
53
if (bs == null || tp.hashIsStable) tp.hash else tp.computeHash(bs)
50
54
51
- def identityHash (bs : Binders | Null ): Int = avoidSpecialHashes(System .identityHashCode(this ))
55
+ def identityHash (bs : Binders ): Int = avoidSpecialHashes(System .identityHashCode(this ))
52
56
53
- protected def finishHash (bs : Binders | Null , seed : Int , arity : Int , tp : Type ): Int = {
57
+ protected def finishHash (bs : Binders , seed : Int , arity : Int , tp : Type ): Int = {
54
58
val elemHash = typeHash(bs, tp)
55
59
if (elemHash == NotCached ) return NotCached
56
60
finishHash(hashing.mix(seed, elemHash), arity + 1 )
57
61
}
58
62
59
- protected def finishHash (bs : Binders | Null , seed : Int , arity : Int , tp1 : Type , tp2 : Type ): Int = {
63
+ protected def finishHash (bs : Binders , seed : Int , arity : Int , tp1 : Type , tp2 : Type ): Int = {
60
64
val elemHash = typeHash(bs, tp1)
61
65
if (elemHash == NotCached ) return NotCached
62
66
finishHash(bs, hashing.mix(seed, elemHash), arity + 1 , tp2)
63
67
}
64
68
65
- protected def finishHash (bs : Binders | Null , seed : Int , arity : Int , tps : List [Type ]): Int = {
69
+ protected def finishHash (bs : Binders , seed : Int , arity : Int , tps : List [Type ]): Int = {
66
70
var h = seed
67
71
var xs = tps
68
72
var len = arity
@@ -76,7 +80,7 @@ trait Hashable {
76
80
finishHash(h, len)
77
81
}
78
82
79
- protected def finishHash (bs : Binders | Null , seed : Int , arity : Int , tp : Type , tps : List [Type ]): Int = {
83
+ protected def finishHash (bs : Binders , seed : Int , arity : Int , tp : Type , tps : List [Type ]): Int = {
80
84
val elemHash = typeHash(bs, tp)
81
85
if (elemHash == NotCached ) return NotCached
82
86
finishHash(bs, hashing.mix(seed, elemHash), arity + 1 , tps)
@@ -86,28 +90,28 @@ trait Hashable {
86
90
protected final def doHash (x : Any ): Int =
87
91
finishHash(hashing.mix(hashSeed, x.hashCode), 1 )
88
92
89
- protected final def doHash (bs : Binders | Null , tp : Type ): Int =
93
+ protected final def doHash (bs : Binders , tp : Type ): Int =
90
94
finishHash(bs, hashSeed, 0 , tp)
91
95
92
- protected final def doHash (bs : Binders | Null , x1 : Any , tp2 : Type ): Int =
96
+ protected final def doHash (bs : Binders , x1 : Any , tp2 : Type ): Int =
93
97
finishHash(bs, hashing.mix(hashSeed, x1.hashCode), 1 , tp2)
94
98
95
- protected final def doHash (bs : Binders | Null , x1 : Int , tp2 : Type ): Int =
99
+ protected final def doHash (bs : Binders , x1 : Int , tp2 : Type ): Int =
96
100
finishHash(bs, hashing.mix(hashSeed, x1), 1 , tp2)
97
101
98
- protected final def doHash (bs : Binders | Null , x1 : Int , tp2 : Type , tp3 : Type ): Int =
102
+ protected final def doHash (bs : Binders , x1 : Int , tp2 : Type , tp3 : Type ): Int =
99
103
finishHash(bs, hashing.mix(hashSeed, x1), 1 , tp2, tp3)
100
104
101
- protected final def doHash (bs : Binders | Null , tp1 : Type , tp2 : Type ): Int =
105
+ protected final def doHash (bs : Binders , tp1 : Type , tp2 : Type ): Int =
102
106
finishHash(bs, hashSeed, 0 , tp1, tp2)
103
107
104
- protected final def doHash (bs : Binders | Null , x1 : Any , tp2 : Type , tp3 : Type ): Int =
108
+ protected final def doHash (bs : Binders , x1 : Any , tp2 : Type , tp3 : Type ): Int =
105
109
finishHash(bs, hashing.mix(hashSeed, x1.hashCode), 1 , tp2, tp3)
106
110
107
- protected final def doHash (bs : Binders | Null , tp1 : Type , tps2 : List [Type ]): Int =
111
+ protected final def doHash (bs : Binders , tp1 : Type , tps2 : List [Type ]): Int =
108
112
finishHash(bs, hashSeed, 0 , tp1, tps2)
109
113
110
- protected final def doHash (bs : Binders | Null , x1 : Any , tp2 : Type , tps3 : List [Type ]): Int =
114
+ protected final def doHash (bs : Binders , x1 : Any , tp2 : Type , tps3 : List [Type ]): Int =
111
115
finishHash(bs, hashing.mix(hashSeed, x1.hashCode), 1 , tp2, tps3)
112
116
113
117
protected final def doHash (x1 : Int , x2 : Int ): Int =
0 commit comments