Skip to content

Commit

Permalink
Add an immutable.StrictOptimizedSortedSetOps
Browse files Browse the repository at this point in the history
This will be mixed into TreeSet and BitSet and has two purposes:

- Make TreeSet and BitSet extend `collection.StrictOptimizedIterableOps`
  with `CC = immutable.Set` instead of `CC = collection.Set` as before.
  This is important since the latter is incoherent and potentially
  unsound. Scala 2 does not detect this (scala/bug#11042), but Dotty does
  and emit an error.

- Make TreeSet and BitSet use more optimized versions of some methods.
  • Loading branch information
smarter committed Jan 29, 2019
1 parent 4366332 commit 376f4c2
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/library/scala/collection/immutable/SortedSet.scala
Expand Up @@ -38,6 +38,11 @@ trait SortedSetOps[A, +CC[X] <: SortedSet[X], +C <: SortedSetOps[A, CC, C]]
def unsorted: Set[A]
}

trait StrictOptimizedSortedSetOps[A, +CC[X] <: SortedSet[X], +C <: SortedSetOps[A, CC, C]]
extends SortedSetOps[A, CC, C]
with collection.StrictOptimizedSortedSetOps[A, CC, C]
with StrictOptimizedSetOps[A, Set, C]

/**
* $factoryInfo
* @define coll immutable sorted set
Expand Down

0 comments on commit 376f4c2

Please sign in to comment.