@@ -2663,6 +2663,7 @@ object Types {
26632663 final def isHigherKinded = isInstanceOf [TypeProxy ]
26642664
26652665 private [this ] var myParamRefs : List [ParamRefType ] = null
2666+ private [this ] var myStableHash : Byte = 0
26662667
26672668 def paramRefs : List [ParamRefType ] = {
26682669 if (myParamRefs == null ) myParamRefs = paramNames.indices.toList.map(newParamRef)
@@ -2695,24 +2696,20 @@ object Types {
26952696 x => paramInfos.mapConserve(_.subst(this , x).asInstanceOf [PInfo ]),
26962697 x => resType.subst(this , x))
26972698
2698- protected def prefixString : String
2699- final override def toString = s " $prefixString( $paramNames, $paramInfos, $resType) "
2700- }
2701-
2702- abstract class HKLambda extends CachedProxyType with LambdaType {
2703- final override def underlying (implicit ctx : Context ) = resType
2704-
27052699 override def computeHash (bs : Binders ) =
27062700 doHash(new Binders (this , bs), paramNames, resType, paramInfos)
27072701
2708- override def stableHash = resType.stableHash && paramInfos.stableHash
2702+ override def stableHash = {
2703+ if (myStableHash == 0 ) myStableHash = if (resType.stableHash && paramInfos.stableHash) 1 else - 1
2704+ myStableHash > 0
2705+ }
27092706
27102707 final override def equals (that : Any ) = equals(that, null )
27112708
27122709 // No definition of `eql` --> fall back on equals, which calls iso
27132710
27142711 final override def iso (that : Any , bs : BinderPairs ) = that match {
2715- case that : HKLambda =>
2712+ case that : LambdaType =>
27162713 paramNames.eqElements(that.paramNames) &&
27172714 companion.eq(that.companion) && {
27182715 val bs1 = new BinderPairs (this , that, bs)
@@ -2722,13 +2719,17 @@ object Types {
27222719 case _ =>
27232720 false
27242721 }
2722+
2723+ protected def prefixString : String
2724+ final override def toString = s " $prefixString( $paramNames, $paramInfos, $resType) "
27252725 }
27262726
2727- abstract class MethodOrPoly extends UncachedGroundType with LambdaType with MethodicType {
2728- final override def hashCode = System .identityHashCode(this )
2729- final override def equals (other : Any ) = this `eq` other.asInstanceOf [AnyRef ]
2727+ abstract class HKLambda extends CachedProxyType with LambdaType {
2728+ final override def underlying (implicit ctx : Context ) = resType
27302729 }
27312730
2731+ abstract class MethodOrPoly extends CachedGroundType with LambdaType with MethodicType
2732+
27322733 trait TermLambda extends LambdaType { thisLambdaType =>
27332734 import DepStatus ._
27342735 type ThisName = TermName
0 commit comments