@@ -20,7 +20,7 @@ import scala.collection.{CustomParallelizable, IterableOps, Parallel}
20
20
import scala .collection .generic ._
21
21
import immutable .HashMapCombiner
22
22
import scala .reflect .ClassTag
23
-
23
+ import scala . annotation . unchecked . uncheckedVariance
24
24
25
25
/** A template trait for parallel collections of type `ParIterable[T]`.
26
26
*
@@ -145,10 +145,10 @@ import scala.reflect.ClassTag
145
145
* @define coll parallel iterable
146
146
*/
147
147
trait 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 ]
150
150
with Parallel
151
- with HasNewCombiner [T , Repr ]
151
+ with HasNewCombiner [T @ uncheckedVariance , Repr ]
152
152
{
153
153
self =>
154
154
@@ -850,7 +850,7 @@ self =>
850
850
protected trait Accessor [R , Tp ]
851
851
extends StrictSplitterCheckTask [R , Tp ] {
852
852
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 ]
854
854
def shouldSplitFurther = pit.shouldSplitFurther(self.repr, tasksupport.parallelismLevel)
855
855
def split = pit.splitWithSignalling.map(newSubtask(_)) // default split procedure
856
856
private [parallel] override def signalAbort () = pit.abort()
@@ -919,28 +919,28 @@ self =>
919
919
920
920
protected trait Transformer [R , Tp ] extends Accessor [R , Tp ] { }
921
921
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 ])
923
923
extends Accessor [Unit , Foreach [S ]] {
924
924
@ volatile var result : Unit = ()
925
925
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)
927
927
}
928
928
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 ])
930
930
extends Accessor [Int , Count ] {
931
931
// val pittxt = pit.toString
932
932
@ volatile var result : Int = 0
933
933
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)
935
935
override def merge (that : Count ) = result = result + that.result
936
936
// override def toString = "CountTask(" + pittxt + ")"
937
937
}
938
938
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 ])
940
940
extends Accessor [Option [U ], Reduce [U ]] {
941
941
@ volatile var result : Option [U ] = None
942
942
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)
944
944
override def merge (that : Reduce [U ]) =
945
945
if (this .result == None ) result = that.result
946
946
else if (that.result != None ) result = Some (op(result.get, that.result.get))
0 commit comments