Skip to content

Commit db21d64

Browse files
committed
Add SortedSet and BitSet to stdlib (capture checked)
1 parent 6847b83 commit db21d64

File tree

6 files changed

+9
-6
lines changed

6 files changed

+9
-6
lines changed

tests/pos-special/stdlib/collection/BitSet.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ object BitSet extends SpecificIterableFactory[Int, BitSet] {
4848

4949
def empty: BitSet = immutable.BitSet.empty
5050
def newBuilder: Builder[Int, BitSet] = immutable.BitSet.newBuilder
51-
def fromSpecific(it: IterableOnce[Int]): BitSet = immutable.BitSet.fromSpecific(it)
51+
def fromSpecific(it: IterableOnce[Int]^): BitSet = immutable.BitSet.fromSpecific(it)
5252

5353
@SerialVersionUID(3L)
5454
private[collection] abstract class SerializationProxy(@transient protected val coll: BitSet) extends Serializable {

tests/pos-special/stdlib/collection/SortedSet.scala

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ package scala.collection
1414

1515
import scala.annotation.{implicitNotFound, nowarn}
1616
import scala.annotation.unchecked.uncheckedVariance
17+
import language.experimental.captureChecking
1718

1819
/** Base type of sorted sets */
1920
trait SortedSet[A] extends Set[A]
@@ -68,7 +69,7 @@ trait SortedSetOps[A, +CC[X] <: SortedSet[X], +C <: SortedSetOps[A, CC, C]]
6869
* @param start The lower-bound (inclusive) of the iterator
6970
*/
7071
def iteratorFrom(start: A): Iterator[A]
71-
72+
7273
@deprecated("Use `iteratorFrom` instead.", "2.13.0")
7374
@`inline` def keysIteratorFrom(start: A): Iterator[A] = iteratorFrom(start)
7475

@@ -178,7 +179,7 @@ object SortedSetOps {
178179
def flatMap[B : Ordering](f: A => IterableOnce[B]): CC[B] =
179180
self.sortedIterableFactory.from(new View.FlatMap(filtered, f))
180181

181-
override def withFilter(q: A => Boolean): WithFilter[A, IterableCC, CC] =
182+
override def withFilter(q: A => Boolean): WithFilter[A, IterableCC, CC]^{this, q} =
182183
new WithFilter[A, IterableCC, CC](self, (a: A) => p(a) && q(a))
183184
}
184185

tests/pos-special/stdlib/collection/immutable/BitSet.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ sealed abstract class BitSet
9595
@SerialVersionUID(3L)
9696
object BitSet extends SpecificIterableFactory[Int, BitSet] {
9797

98-
def fromSpecific(it: scala.collection.IterableOnce[Int]): BitSet =
98+
def fromSpecific(it: scala.collection.IterableOnce[Int]^): BitSet =
9999
it match {
100100
case bs: BitSet => bs
101101
case _ => (newBuilder ++= it).result()

tests/pos-special/stdlib/collection/immutable/SortedSet.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
package scala
1414
package collection
1515
package immutable
16+
import language.experimental.captureChecking
1617

1718
/** Base trait for sorted sets */
1819
trait SortedSet[A]
@@ -50,7 +51,7 @@ trait StrictOptimizedSortedSetOps[A, +CC[X] <: SortedSet[X], +C <: SortedSetOps[
5051
*/
5152
@SerialVersionUID(3L)
5253
object SortedSet extends SortedIterableFactory.Delegate[SortedSet](TreeSet) {
53-
override def from[E: Ordering](it: IterableOnce[E]): SortedSet[E] = it match {
54+
override def from[E: Ordering](it: IterableOnce[E]^): SortedSet[E] = it match {
5455
case ss: SortedSet[E] if Ordering[E] == ss.ordering => ss
5556
case _ => super.from(it)
5657
}

tests/pos-special/stdlib/collection/mutable/BitSet.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ class BitSet(protected[collection] final var elems: Array[Long])
361361
@SerialVersionUID(3L)
362362
object BitSet extends SpecificIterableFactory[Int, BitSet] {
363363

364-
def fromSpecific(it: scala.collection.IterableOnce[Int]): BitSet = Growable.from(empty, it)
364+
def fromSpecific(it: scala.collection.IterableOnce[Int]^): BitSet = Growable.from(empty, it)
365365

366366
def empty: BitSet = new BitSet()
367367

tests/pos-special/stdlib/collection/mutable/SortedSet.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
package scala
1414
package collection
1515
package mutable
16+
import language.experimental.captureChecking
1617

1718
/**
1819
* Base type for mutable sorted set collections

0 commit comments

Comments
 (0)