Skip to content

Commit 4b6dc5b

Browse files
committed
Implement != for SimpleIdentitySet
1 parent 3408345 commit 4b6dc5b

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

compiler/src/dotty/tools/dotc/util/SimpleIdentitySet.scala

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,10 @@ abstract class SimpleIdentitySet[+Elem <: AnyRef] {
5454
else this.filter(that.contains)
5555

5656
def == [E >: Elem <: AnyRef](that: SimpleIdentitySet[E]): Boolean =
57-
this.size == that.size && forall(that.contains)
57+
(this eq that) || this.size == that.size && forall(that.contains)
58+
59+
def != [E >: Elem <: AnyRef](that: SimpleIdentitySet[E]): Boolean =
60+
!(this == that)
5861

5962
override def toString: String = toList.mkString("{", ", ", "}")
6063
}

0 commit comments

Comments
 (0)