@@ -20,7 +20,7 @@ import scala.collection.{CustomParallelizable, IterableOps, Parallel}
2020import scala .collection .generic ._
2121import immutable .HashMapCombiner
2222import scala .reflect .ClassTag
23-
23+ import scala . annotation . unchecked . uncheckedVariance
2424
2525/** A template trait for parallel collections of type `ParIterable[T]`.
2626 *
@@ -145,10 +145,10 @@ import scala.reflect.ClassTag
145145 * @define coll parallel iterable
146146 */
147147trait ParIterableLike [+ T , + CC [X ] <: ParIterable [X ], + Repr <: ParIterable [T ], + Sequential <: Iterable [T ] with IterableOps [T , Iterable , Sequential ]]
148- extends IterableOnce [T ]
149- with CustomParallelizable [T , Repr ]
148+ extends IterableOnce [T @ uncheckedVariance ]
149+ with CustomParallelizable [T @ uncheckedVariance , Repr ]
150150 with Parallel
151- with HasNewCombiner [T , Repr ]
151+ with HasNewCombiner [T @ uncheckedVariance , Repr ]
152152{
153153self =>
154154
@@ -850,7 +850,7 @@ self =>
850850 protected trait Accessor [R , Tp ]
851851 extends StrictSplitterCheckTask [R , Tp ] {
852852 protected [this ] val pit : IterableSplitter [T ]
853- protected [this ] def newSubtask (p : IterableSplitter [T ]): Accessor [R , Tp ]
853+ protected [this ] def newSubtask (p : IterableSplitter [T @ uncheckedVariance ]): Accessor [R , Tp ]
854854 def shouldSplitFurther = pit.shouldSplitFurther(self.repr, tasksupport.parallelismLevel)
855855 def split = pit.splitWithSignalling.map(newSubtask(_)) // default split procedure
856856 private [parallel] override def signalAbort () = pit.abort()
@@ -919,28 +919,28 @@ self =>
919919
920920 protected trait Transformer [R , Tp ] extends Accessor [R , Tp ] { }
921921
922- protected [this ] class Foreach [S ](op : T => S , protected [this ] val pit : IterableSplitter [T ])
922+ protected [this ] class Foreach [S ](op : T => S , protected [this ] val pit : IterableSplitter [T @ uncheckedVariance ])
923923 extends Accessor [Unit , Foreach [S ]] {
924924 @ volatile var result : Unit = ()
925925 def leaf (prevr : Option [Unit ]) = pit.foreach(op)
926- protected [this ] def newSubtask (p : IterableSplitter [T ]) = new Foreach [S ](op, p)
926+ protected [this ] def newSubtask (p : IterableSplitter [T @ uncheckedVariance ]) = new Foreach [S ](op, p)
927927 }
928928
929- protected [this ] class Count (pred : T => Boolean , protected [this ] val pit : IterableSplitter [T ])
929+ protected [this ] class Count (pred : T => Boolean , protected [this ] val pit : IterableSplitter [T @ uncheckedVariance ])
930930 extends Accessor [Int , Count ] {
931931 // val pittxt = pit.toString
932932 @ volatile var result : Int = 0
933933 def leaf (prevr : Option [Int ]) = result = pit.count(pred)
934- protected [this ] def newSubtask (p : IterableSplitter [T ]) = new Count (pred, p)
934+ protected [this ] def newSubtask (p : IterableSplitter [T @ uncheckedVariance ]) = new Count (pred, p)
935935 override def merge (that : Count ) = result = result + that.result
936936 // override def toString = "CountTask(" + pittxt + ")"
937937 }
938938
939- protected [this ] class Reduce [U >: T ](op : (U , U ) => U , protected [this ] val pit : IterableSplitter [T ])
939+ protected [this ] class Reduce [U >: T ](op : (U , U ) => U , protected [this ] val pit : IterableSplitter [T @ uncheckedVariance ])
940940 extends Accessor [Option [U ], Reduce [U ]] {
941941 @ volatile var result : Option [U ] = None
942942 def leaf (prevr : Option [Option [U ]]) = if (pit.remaining > 0 ) result = Some (pit.reduce(op))
943- protected [this ] def newSubtask (p : IterableSplitter [T ]) = new Reduce (op, p)
943+ protected [this ] def newSubtask (p : IterableSplitter [T @ uncheckedVariance ]) = new Reduce (op, p)
944944 override def merge (that : Reduce [U ]) =
945945 if (this .result == None ) result = that.result
946946 else if (that.result != None ) result = Some (op(result.get, that.result.get))
0 commit comments