@@ -120,14 +120,22 @@ object ProtoTypes {
120
120
}
121
121
122
122
/** A class marking ignored prototypes that can be revealed by `deepenProto` */
123
- case class IgnoredProto (ignored : Type ) extends UncachedGroundType with MatchAlways :
123
+ abstract case class IgnoredProto (ignored : Type ) extends CachedGroundType with MatchAlways :
124
124
override def revealIgnored = ignored
125
125
override def deepenProto (using Context ): Type = ignored
126
126
127
+ override def computeHash (bs : Hashable .Binders ): Int = doHash(bs, ignored)
128
+
129
+ override def eql (that : Type ): Boolean = that match
130
+ case that : IgnoredProto => ignored eq that.ignored
131
+ case _ => false
132
+
133
+ final class CachedIgnoredProto (ignored : Type ) extends IgnoredProto (ignored)
134
+
127
135
object IgnoredProto :
128
136
def apply (ignored : Type ): IgnoredProto = ignored match
129
137
case ignored : IgnoredProto => ignored
130
- case _ => new IgnoredProto (ignored)
138
+ case _ => CachedIgnoredProto (ignored)
131
139
132
140
/** A prototype for expressions [] that are part of a selection operation:
133
141
*
@@ -185,13 +193,6 @@ object ProtoTypes {
185
193
if ((name eq this .name) && (memberProto eq this .memberProto) && (compat eq this .compat)) this
186
194
else SelectionProto (name, memberProto, compat, privateOK)
187
195
188
- override def equals (that : Any ): Boolean = that match {
189
- case that : SelectionProto =>
190
- (name eq that.name) && (memberProto == that.memberProto) && (compat eq that.compat) && (privateOK == that.privateOK)
191
- case _ =>
192
- false
193
- }
194
-
195
196
def map (tm : TypeMap )(using Context ): SelectionProto = derivedSelectionProto(name, tm(memberProto), compat)
196
197
def fold [T ](x : T , ta : TypeAccumulator [T ])(using Context ): T = ta(x, memberProto)
197
198
@@ -201,6 +202,13 @@ object ProtoTypes {
201
202
val delta = (if (compat eq NoViewsAllowed ) 1 else 0 ) | (if (privateOK) 2 else 0 )
202
203
addDelta(doHash(bs, name, memberProto), delta)
203
204
}
205
+
206
+ override def eql (that : Type ): Boolean = that match {
207
+ case that : SelectionProto =>
208
+ (name eq that.name) && (memberProto eq that.memberProto) && (compat eq that.compat) && (privateOK == that.privateOK)
209
+ case _ =>
210
+ false
211
+ }
204
212
}
205
213
206
214
class CachedSelectionProto (name : Name , memberProto : Type , compat : Compatibility , privateOK : Boolean )
@@ -450,6 +458,9 @@ object ProtoTypes {
450
458
451
459
class CachedViewProto (argType : Type , resultType : Type ) extends ViewProto (argType, resultType) {
452
460
override def computeHash (bs : Hashable .Binders ): Int = doHash(bs, argType, resultType)
461
+ override def eql (that : Type ): Boolean = that match
462
+ case that : ViewProto => (argType eq that.argType) && (resType eq that.resType)
463
+ case _ => false
453
464
}
454
465
455
466
object ViewProto {
@@ -680,6 +691,8 @@ object ProtoTypes {
680
691
tp.derivedViewProto(
681
692
wildApprox(tp.argType, theMap, seen, internal),
682
693
wildApprox(tp.resultType, theMap, seen, internal))
694
+ case tp : IgnoredProto =>
695
+ WildcardType
683
696
case _ : ThisType | _ : BoundType => // default case, inlined for speed
684
697
tp
685
698
case tl : TypeLambda =>
0 commit comments