@@ -2654,6 +2654,7 @@ object Types {
2654
2654
final def isHigherKinded = isInstanceOf [TypeProxy ]
2655
2655
2656
2656
private [this ] var myParamRefs : List [ParamRefType ] = null
2657
+ private [this ] var myStableHash : Byte = 0
2657
2658
2658
2659
def paramRefs : List [ParamRefType ] = {
2659
2660
if (myParamRefs == null ) myParamRefs = paramNames.indices.toList.map(newParamRef)
@@ -2686,24 +2687,20 @@ object Types {
2686
2687
x => paramInfos.mapConserve(_.subst(this , x).asInstanceOf [PInfo ]),
2687
2688
x => resType.subst(this , x))
2688
2689
2689
- protected def prefixString : String
2690
- final override def toString = s " $prefixString( $paramNames, $paramInfos, $resType) "
2691
- }
2692
-
2693
- abstract class HKLambda extends CachedProxyType with LambdaType {
2694
- final override def underlying (implicit ctx : Context ) = resType
2695
-
2696
2690
override def computeHash (bs : Binders ) =
2697
2691
doHash(new Binders (this , bs), paramNames, resType, paramInfos)
2698
2692
2699
- override def stableHash = resType.stableHash && paramInfos.stableHash
2693
+ override def stableHash = {
2694
+ if (myStableHash == 0 ) myStableHash = if (resType.stableHash && paramInfos.stableHash) 1 else - 1
2695
+ myStableHash > 0
2696
+ }
2700
2697
2701
2698
final override def equals (that : Any ) = equals(that, null )
2702
2699
2703
2700
// No definition of `eql` --> fall back on equals, which calls iso
2704
2701
2705
2702
final override def iso (that : Any , bs : BinderPairs ) = that match {
2706
- case that : HKLambda =>
2703
+ case that : LambdaType =>
2707
2704
paramNames.eqElements(that.paramNames) &&
2708
2705
companion.eq(that.companion) && {
2709
2706
val bs1 = new BinderPairs (this , that, bs)
@@ -2713,13 +2710,17 @@ object Types {
2713
2710
case _ =>
2714
2711
false
2715
2712
}
2713
+
2714
+ protected def prefixString : String
2715
+ final override def toString = s " $prefixString( $paramNames, $paramInfos, $resType) "
2716
2716
}
2717
2717
2718
- abstract class MethodOrPoly extends UncachedGroundType with LambdaType with MethodicType {
2719
- final override def hashCode = System .identityHashCode(this )
2720
- final override def equals (other : Any ) = this `eq` other.asInstanceOf [AnyRef ]
2718
+ abstract class HKLambda extends CachedProxyType with LambdaType {
2719
+ final override def underlying (implicit ctx : Context ) = resType
2721
2720
}
2722
2721
2722
+ abstract class MethodOrPoly extends CachedGroundType with LambdaType with MethodicType
2723
+
2723
2724
trait TermLambda extends LambdaType { thisLambdaType =>
2724
2725
import DepStatus ._
2725
2726
type ThisName = TermName
0 commit comments