Skip to content

Commit d4e7f58

Browse files
authored
Merge pull request scala/scala#10684 from lrytz/hs-subset
Fix signature of HashSet.subsetOf
2 parents 3d7dde4 + d3828ab commit d4e7f58

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

library/src/scala/collection/immutable/HashSet.scala

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,11 @@ final class HashSet[A] private[immutable](private[immutable] val rootNode: Bitma
190190
* Stops iterating the first time that f returns `false`.*/
191191
@`inline` private[collection] def foreachWithHashWhile(f: (A, Int) => Boolean): Unit = rootNode.foreachWithHashWhile(f)
192192

193-
def subsetOf(that: Set[A]): Boolean = isEmpty || !that.isEmpty && (that match {
193+
// For binary compatibility, the method used to have this signature by mistake.
194+
// protected is public in bytecode.
195+
protected def subsetOf(that: Set[A]): Boolean = subsetOf(that: collection.Set[A])
196+
197+
override def subsetOf(that: collection.Set[A]): Boolean = isEmpty || !that.isEmpty && (that match {
194198
case set: HashSet[A] => rootNode.subsetOf(set.rootNode, 0)
195199
case _ => super.subsetOf(that)
196200
})

0 commit comments

Comments
 (0)