Skip to content

Commit c997ed1

Browse files
committed
Put back equals in SelectionProto
1 parent 56e5404 commit c997ed1

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

compiler/src/dotty/tools/dotc/typer/ProtoTypes.scala

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,9 @@ object ProtoTypes {
130130
case that: IgnoredProto => ignored eq that.ignored
131131
case _ => false
132132

133+
// equals comes from case class; no need to redefine
134+
end IgnoredProto
135+
133136
final class CachedIgnoredProto(ignored: Type) extends IgnoredProto(ignored)
134137

135138
object IgnoredProto:
@@ -197,12 +200,17 @@ object ProtoTypes {
197200
def fold[T](x: T, ta: TypeAccumulator[T])(using Context): T = ta(x, memberProto)
198201

199202
override def deepenProto(using Context): SelectionProto = derivedSelectionProto(name, memberProto.deepenProto, compat)
200-
201203
override def computeHash(bs: Hashable.Binders): Int = {
202204
val delta = (if (compat eq NoViewsAllowed) 1 else 0) | (if (privateOK) 2 else 0)
203205
addDelta(doHash(bs, name, memberProto), delta)
204206
}
205207

208+
override def equals(that: Any): Boolean = that match
209+
case that: SelectionProto =>
210+
(name eq that.name) && memberProto.equals(that.memberProto) && (compat eq that.compat) && (privateOK == that.privateOK)
211+
case _ =>
212+
false
213+
206214
override def eql(that: Type): Boolean = that match {
207215
case that: SelectionProto =>
208216
(name eq that.name) && (memberProto eq that.memberProto) && (compat eq that.compat) && (privateOK == that.privateOK)
@@ -461,6 +469,7 @@ object ProtoTypes {
461469
override def eql(that: Type): Boolean = that match
462470
case that: ViewProto => (argType eq that.argType) && (resType eq that.resType)
463471
case _ => false
472+
// equals comes from case class; no need to redefine
464473
}
465474

466475
object ViewProto {

0 commit comments

Comments
 (0)