@@ -4966,22 +4966,19 @@ object Types {
49664966 }
49674967
49684968 class TypeSizeAccumulator (implicit ctx : Context ) extends TypeAccumulator [Int ] {
4969- val seen : util.HashSet [Type ] = new util.HashSet [Type ](64 ) {
4970- override def hash (x : Type ): Int = System .identityHashCode(x)
4971- override def isEqual (x : Type , y : Type ) = x.eq(y)
4972- }
4969+ val seen = new java.util.IdentityHashMap [Type , Type ]
49734970 def apply (n : Int , tp : Type ): Int =
4974- if (seen contains tp ) n
4971+ if (seen.get(tp) != null ) n
49754972 else {
4976- seen.addEntry( tp)
4973+ seen.put(tp, tp)
49774974 tp match {
49784975 case tp : AppliedType =>
49794976 foldOver(n + 1 , tp)
49804977 case tp : RefinedType =>
49814978 foldOver(n + 1 , tp)
49824979 case tp : TypeRef if tp.info.isTypeAlias =>
49834980 apply(n, tp.superType)
4984- case tp : TypeParamRef if ! seen(tp) =>
4981+ case tp : TypeParamRef =>
49854982 apply(n, ctx.typeComparer.bounds(tp))
49864983 case _ =>
49874984 foldOver(n, tp)
@@ -4990,14 +4987,11 @@ object Types {
49904987 }
49914988
49924989 class CoveringSetAccumulator (implicit ctx : Context ) extends TypeAccumulator [Set [Symbol ]] {
4993- val seen : util.HashSet [Type ] = new util.HashSet [Type ](64 ) {
4994- override def hash (x : Type ): Int = System .identityHashCode(x)
4995- override def isEqual (x : Type , y : Type ) = x.eq(y)
4996- }
4990+ val seen = new java.util.IdentityHashMap [Type , Type ]
49974991 def apply (cs : Set [Symbol ], tp : Type ): Set [Symbol ] = {
4998- if (seen contains tp ) cs
4992+ if (seen.get(tp) != null ) cs
49994993 else {
5000- seen.addEntry( tp)
4994+ seen.put(tp, tp)
50014995 tp match {
50024996 case tp if tp.isTopType || tp.isBottomType =>
50034997 cs
0 commit comments