@@ -18,6 +18,7 @@ import scala.collection.generic.DefaultSignalling
1818import scala.collection.generic.AtomicIndexFlag
1919import scala.collection.generic.VolatileAbort
2020import scala.collection.parallel.ParallelCollectionImplicits._
21+ import scala.annotation.unchecked.uncheckedVariance
2122
2223/** A template trait for sequences of type `ParSeq[T]`, representing
2324 * parallel sequences with element type `T`.
@@ -67,7 +68,7 @@ extends ParIterableLike[T, CC, Repr, Sequential]
6768
6869 def canEqual(other: Any): Boolean = true
6970
70- protected[this] type SuperParIterator = IterableSplitter[T]
71+ protected[this] type SuperParIterator = IterableSplitter[T @uncheckedVariance ]
7172
7273 /** A more refined version of the iterator found in the `ParallelIterable` trait,
7374 * this iterator can be split into arbitrary subsets of iterators.
@@ -474,7 +475,7 @@ extends ParIterableLike[T, CC, Repr, Sequential]
474475
475476 protected trait ParSeqLikeTransformer[R, Tp] extends ParSeqLikeAccessor[R, Tp] with Transformer[R, Tp]
476477
477- protected[this] class SegmentLength(pred: T => Boolean, from: Int, protected[this] val pit: SeqSplitter[T])
478+ protected[this] class SegmentLength(pred: T => Boolean, from: Int, protected[this] val pit: SeqSplitter[T @uncheckedVariance ])
478479 extends ParSeqLikeAccessor[(Int, Boolean), SegmentLength] {
479480 @volatile var result: (Int, Boolean) = null
480481 def leaf(prev: Option[(Int, Boolean)]) = if (from < pit.indexFlag) {
@@ -492,7 +493,7 @@ extends ParIterableLike[T, CC, Repr, Sequential]
492493 override def requiresStrictSplitters = true
493494 }
494495
495- protected[this] class IndexWhere(pred: T => Boolean, from: Int, protected[this] val pit: SeqSplitter[T])
496+ protected[this] class IndexWhere(pred: T => Boolean, from: Int, protected[this] val pit: SeqSplitter[T @uncheckedVariance ])
496497 extends ParSeqLikeAccessor[Int, IndexWhere] {
497498 @volatile var result: Int = -1
498499 def leaf(prev: Option[Int]) = if (from < pit.indexFlag) {
@@ -513,7 +514,7 @@ extends ParIterableLike[T, CC, Repr, Sequential]
513514 override def requiresStrictSplitters = true
514515 }
515516
516- protected[this] class LastIndexWhere(pred: T => Boolean, pos: Int, protected[this] val pit: SeqSplitter[T])
517+ protected[this] class LastIndexWhere(pred: T => Boolean, pos: Int, protected[this] val pit: SeqSplitter[T @uncheckedVariance ])
517518 extends ParSeqLikeAccessor[Int, LastIndexWhere] {
518519 @volatile var result: Int = -1
519520 def leaf(prev: Option[Int]) = if (pos > pit.indexFlag) {
@@ -534,23 +535,23 @@ extends ParIterableLike[T, CC, Repr, Sequential]
534535 override def requiresStrictSplitters = true
535536 }
536537
537- protected[this] class Reverse[U >: T, This >: Repr](cbf: () => Combiner[U, This], protected[this] val pit: SeqSplitter[T])
538+ protected[this] class Reverse[U >: T, This >: Repr](cbf: () => Combiner[U, This], protected[this] val pit: SeqSplitter[T @uncheckedVariance ])
538539 extends ParSeqLikeTransformer[Combiner[U, This], Reverse[U, This]] {
539540 @volatile var result: Combiner[U, This] = null
540541 def leaf(prev: Option[Combiner[U, This]]) = result = pit.reverse2combiner(reuse(prev, cbf()))
541542 protected[this] def newSubtask(p: SuperParIterator) = new Reverse(cbf, down(p))
542543 override def merge(that: Reverse[U, This]) = result = that.result combine result
543544 }
544545
545- protected[this] class ReverseMap[S, That](f: T => S, pbf: () => Combiner[S, That], protected[this] val pit: SeqSplitter[T])
546+ protected[this] class ReverseMap[S, That](f: T => S, pbf: () => Combiner[S, That], protected[this] val pit: SeqSplitter[T @uncheckedVariance ])
546547 extends ParSeqLikeTransformer[Combiner[S, That], ReverseMap[S, That]] {
547548 @volatile var result: Combiner[S, That] = null
548549 def leaf(prev: Option[Combiner[S, That]]) = result = pit.reverseMap2combiner(f, pbf())
549550 protected[this] def newSubtask(p: SuperParIterator) = new ReverseMap(f, pbf, down(p))
550551 override def merge(that: ReverseMap[S, That]) = result = that.result combine result
551552 }
552553
553- protected[this] class SameElements[U >: T](protected[this] val pit: SeqSplitter[T], val otherpit: SeqSplitter[U])
554+ protected[this] class SameElements[U >: T](protected[this] val pit: SeqSplitter[T @uncheckedVariance ], val otherpit: SeqSplitter[U @uncheckedVariance ])
554555 extends ParSeqLikeAccessor[Boolean, SameElements[U]] {
555556 @volatile var result: Boolean = true
556557 def leaf(prev: Option[Boolean]) = if (!pit.isAborted) {
@@ -567,7 +568,7 @@ extends ParIterableLike[T, CC, Repr, Sequential]
567568 override def requiresStrictSplitters = true
568569 }
569570
570- protected[this] class Updated[U >: T, That](pos: Int, elem: U, pbf: CombinerFactory[U, That], protected[this] val pit: SeqSplitter[T])
571+ protected[this] class Updated[U >: T, That](pos: Int, elem: U, pbf: CombinerFactory[U, That], protected[this] val pit: SeqSplitter[T @uncheckedVariance ])
571572 extends ParSeqLikeTransformer[Combiner[U, That], Updated[U, That]] {
572573 @volatile var result: Combiner[U, That] = null
573574 def leaf(prev: Option[Combiner[U, That]]) = result = pit.updated2combiner(pos, elem, pbf())
@@ -580,7 +581,7 @@ extends ParIterableLike[T, CC, Repr, Sequential]
580581 override def requiresStrictSplitters = true
581582 }
582583
583- protected[this] class ParSeqLikeZip[U >: T, S, That](len: Int, cf: CombinerFactory[(U, S), That], protected[this] val pit: SeqSplitter[T], val otherpit: SeqSplitter[S])
584+ protected[this] class ParSeqLikeZip[U >: T, S, That](len: Int, cf: CombinerFactory[(U, S), That], protected[this] val pit: SeqSplitter[T @uncheckedVariance ], val otherpit: SeqSplitter[S])
584585 extends ParSeqLikeTransformer[Combiner[(U, S), That], ParSeqLikeZip[U, S, That]] {
585586 @volatile var result: Result = null
586587 def leaf(prev: Option[Result]) = result = pit.zip2combiner[U, S, That](otherpit, cf())
@@ -598,7 +599,7 @@ extends ParIterableLike[T, CC, Repr, Sequential]
598599 override def merge(that: ParSeqLikeZip[U, S, That]) = result = result combine that.result
599600 }
600601
601- protected[this] class Corresponds[S](corr: (T, S) => Boolean, protected[this] val pit: SeqSplitter[T], val otherpit: SeqSplitter[S])
602+ protected[this] class Corresponds[S](corr: (T, S) => Boolean, protected[this] val pit: SeqSplitter[T @uncheckedVariance ], val otherpit: SeqSplitter[S])
602603 extends ParSeqLikeAccessor[Boolean, Corresponds[S]] {
603604 @volatile var result: Boolean = true
604605 def leaf(prev: Option[Boolean]) = if (!pit.isAborted) {
0 commit comments