Skip to content

Commit

Permalink
Merge pull request #10684 from lrytz/hs-subset
Browse files Browse the repository at this point in the history
Fix signature of HashSet.subsetOf
  • Loading branch information
som-snytt committed Feb 8, 2024
2 parents 322fa79 + 8faec38 commit 7925f21
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/library/scala/collection/immutable/HashSet.scala
Expand Up @@ -190,7 +190,11 @@ final class HashSet[A] private[immutable](private[immutable] val rootNode: Bitma
* Stops iterating the first time that f returns `false`.*/
@`inline` private[collection] def foreachWithHashWhile(f: (A, Int) => Boolean): Unit = rootNode.foreachWithHashWhile(f)

def subsetOf(that: Set[A]): Boolean = isEmpty || !that.isEmpty && (that match {
// For binary compatibility, the method used to have this signature by mistake.
// protected is public in bytecode.
protected def subsetOf(that: Set[A]): Boolean = subsetOf(that: collection.Set[A])

override def subsetOf(that: collection.Set[A]): Boolean = isEmpty || !that.isEmpty && (that match {
case set: HashSet[A] => rootNode.subsetOf(set.rootNode, 0)
case _ => super.subsetOf(that)
})
Expand Down

0 comments on commit 7925f21

Please sign in to comment.