@@ -18,6 +18,7 @@ import scala.collection.generic.DefaultSignalling
18
18
import scala .collection .generic .AtomicIndexFlag
19
19
import scala .collection .generic .VolatileAbort
20
20
import scala .collection .parallel .ParallelCollectionImplicits ._
21
+ import scala .annotation .unchecked .uncheckedVariance
21
22
22
23
/** A template trait for sequences of type `ParSeq[T]`, representing
23
24
* parallel sequences with element type `T`.
@@ -67,7 +68,7 @@ extends ParIterableLike[T, CC, Repr, Sequential]
67
68
68
69
def canEqual (other : Any ): Boolean = true
69
70
70
- protected [this ] type SuperParIterator = IterableSplitter [T ]
71
+ protected [this ] type SuperParIterator = IterableSplitter [T @ uncheckedVariance ]
71
72
72
73
/** A more refined version of the iterator found in the `ParallelIterable` trait,
73
74
* this iterator can be split into arbitrary subsets of iterators.
@@ -474,7 +475,7 @@ extends ParIterableLike[T, CC, Repr, Sequential]
474
475
475
476
protected trait ParSeqLikeTransformer [R , Tp ] extends ParSeqLikeAccessor [R , Tp ] with Transformer [R , Tp ]
476
477
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 ])
478
479
extends ParSeqLikeAccessor [(Int , Boolean ), SegmentLength ] {
479
480
@ volatile var result : (Int , Boolean ) = null
480
481
def leaf (prev : Option [(Int , Boolean )]) = if (from < pit.indexFlag) {
@@ -492,7 +493,7 @@ extends ParIterableLike[T, CC, Repr, Sequential]
492
493
override def requiresStrictSplitters = true
493
494
}
494
495
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 ])
496
497
extends ParSeqLikeAccessor [Int , IndexWhere ] {
497
498
@ volatile var result : Int = - 1
498
499
def leaf (prev : Option [Int ]) = if (from < pit.indexFlag) {
@@ -513,7 +514,7 @@ extends ParIterableLike[T, CC, Repr, Sequential]
513
514
override def requiresStrictSplitters = true
514
515
}
515
516
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 ])
517
518
extends ParSeqLikeAccessor [Int , LastIndexWhere ] {
518
519
@ volatile var result : Int = - 1
519
520
def leaf (prev : Option [Int ]) = if (pos > pit.indexFlag) {
@@ -534,23 +535,23 @@ extends ParIterableLike[T, CC, Repr, Sequential]
534
535
override def requiresStrictSplitters = true
535
536
}
536
537
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 ])
538
539
extends ParSeqLikeTransformer [Combiner [U , This ], Reverse [U , This ]] {
539
540
@ volatile var result : Combiner [U , This ] = null
540
541
def leaf (prev : Option [Combiner [U , This ]]) = result = pit.reverse2combiner(reuse(prev, cbf()))
541
542
protected [this ] def newSubtask (p : SuperParIterator ) = new Reverse (cbf, down(p))
542
543
override def merge (that : Reverse [U , This ]) = result = that.result combine result
543
544
}
544
545
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 ])
546
547
extends ParSeqLikeTransformer [Combiner [S , That ], ReverseMap [S , That ]] {
547
548
@ volatile var result : Combiner [S , That ] = null
548
549
def leaf (prev : Option [Combiner [S , That ]]) = result = pit.reverseMap2combiner(f, pbf())
549
550
protected [this ] def newSubtask (p : SuperParIterator ) = new ReverseMap (f, pbf, down(p))
550
551
override def merge (that : ReverseMap [S , That ]) = result = that.result combine result
551
552
}
552
553
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 ])
554
555
extends ParSeqLikeAccessor [Boolean , SameElements [U ]] {
555
556
@ volatile var result : Boolean = true
556
557
def leaf (prev : Option [Boolean ]) = if (! pit.isAborted) {
@@ -567,7 +568,7 @@ extends ParIterableLike[T, CC, Repr, Sequential]
567
568
override def requiresStrictSplitters = true
568
569
}
569
570
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 ])
571
572
extends ParSeqLikeTransformer [Combiner [U , That ], Updated [U , That ]] {
572
573
@ volatile var result : Combiner [U , That ] = null
573
574
def leaf (prev : Option [Combiner [U , That ]]) = result = pit.updated2combiner(pos, elem, pbf())
@@ -580,7 +581,7 @@ extends ParIterableLike[T, CC, Repr, Sequential]
580
581
override def requiresStrictSplitters = true
581
582
}
582
583
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 ])
584
585
extends ParSeqLikeTransformer [Combiner [(U , S ), That ], ParSeqLikeZip [U , S , That ]] {
585
586
@ volatile var result : Result = null
586
587
def leaf (prev : Option [Result ]) = result = pit.zip2combiner[U , S , That ](otherpit, cf())
@@ -598,7 +599,7 @@ extends ParIterableLike[T, CC, Repr, Sequential]
598
599
override def merge (that : ParSeqLikeZip [U , S , That ]) = result = result combine that.result
599
600
}
600
601
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 ])
602
603
extends ParSeqLikeAccessor [Boolean , Corresponds [S ]] {
603
604
@ volatile var result : Boolean = true
604
605
def leaf (prev : Option [Boolean ]) = if (! pit.isAborted) {
0 commit comments