Skip to content

Commit 2a8bc31

Browse files
authored
Merge pull request #119 from SethTisue/prepare-for-dotty-part-3
prepare for Dotty, part 3
2 parents b0f709c + dac0f8c commit 2a8bc31

24 files changed

+53
-58
lines changed

core/src/main/scala/scala/collection/generic/ParFactory.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -225,8 +225,8 @@ extends GenericParCompanion[CC] {
225225
* all calls to `apply(from)` to the `genericParBuilder` method of the $coll
226226
* `from`, and calls to `apply()` to this factory.
227227
*/
228-
class GenericCanCombineFrom[A] extends CanCombineFrom[CC[_], A, CC[A]] {
229-
override def apply(from: CC[_]) = from.genericCombiner
230-
override def apply() = newBuilder[A]
228+
class GenericCanCombineFrom[From, To] extends CanCombineFrom[CC[From], To, CC[To]] {
229+
override def apply(from: CC[From]) = from.genericCombiner
230+
override def apply() = newBuilder[To]
231231
}
232232
}

core/src/main/scala/scala/collection/generic/ParMapFactory.scala

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,9 @@ import scala.collection.parallel.Combiner
2727
* @define factoryInfo
2828
* This object provides a set of operations needed to create `$Coll` values.
2929
*/
30-
abstract class ParMapFactory[CC[X, Y] <: ParMap[X, Y] with ParMapLike[X, Y, CC, CC[X, Y], _]]
30+
abstract class ParMapFactory[CC[X, Y] <: ParMap[X, Y] with ParMapLike[X, Y, CC, CC[X, Y], Sequential[X, Y]], Sequential[X, Y] <: collection.Map[X, Y] with collection.MapOps[X, Y, Sequential, Sequential[X, Y]]]
3131
extends GenericParMapCompanion[CC] {
3232

33-
type Coll = MapColl
34-
3533
// `apply` and `empty` methods were previously inherited from `GenMapFactory`, which
3634
// has been removed from the Scala library in 2.13
3735

@@ -45,8 +43,6 @@ extends GenericParMapCompanion[CC] {
4543

4644
def empty[K, V]: CC[K, V]
4745

48-
type MapColl = CC[_, _]
49-
5046
/** The default builder for $Coll objects.
5147
* @tparam K the type of the keys
5248
* @tparam V the type of the associated values
@@ -59,8 +55,8 @@ extends GenericParMapCompanion[CC] {
5955
*/
6056
def newCombiner[K, V]: Combiner[(K, V), CC[K, V]]
6157

62-
class CanCombineFromMap[K, V] extends CanCombineFrom[CC[_, _], (K, V), CC[K, V]] {
63-
def apply(from: MapColl) = from.genericMapCombiner[K, V].asInstanceOf[Combiner[(K, V), CC[K, V]]]
58+
class CanCombineFromMap[FromK, FromV, K, V] extends CanCombineFrom[CC[FromK, FromV], (K, V), CC[K, V]] {
59+
def apply(from: CC[FromK, FromV]) = from.genericMapCombiner[K, V].asInstanceOf[Combiner[(K, V), CC[K, V]]]
6460
def apply() = newCombiner[K, V]
6561
}
6662

core/src/main/scala/scala/collection/generic/ParSetFactory.scala

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,8 @@ abstract class ParSetFactory[CC[X] <: ParSet[X] with ParSetLike[X, CC, CC[X], _]
2828

2929
def newCombiner[A]: Combiner[A, CC[A]]
3030

31-
class GenericCanCombineFrom[A] extends CanCombineFrom[CC[_], A, CC[A]] {
32-
override def apply(from: CC[_]) = from.genericCombiner[A]
31+
class GenericCanCombineFrom[B, A] extends CanCombineFrom[CC[B], A, CC[A]] {
32+
override def apply(from: CC[B]) = from.genericCombiner[A]
3333
override def apply() = newCombiner[A]
3434
}
3535
}
36-

core/src/main/scala/scala/collection/parallel/ParIterable.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ trait ParIterable[+T]
3535
/** $factoryInfo
3636
*/
3737
object ParIterable extends ParFactory[ParIterable] {
38-
implicit def canBuildFrom[T]: CanCombineFrom[ParIterable[_], T, ParIterable[T]] = new GenericCanCombineFrom[T]
38+
implicit def canBuildFrom[T, S]: CanCombineFrom[ParIterable[S], T, ParIterable[T]] = new GenericCanCombineFrom[S, T]
3939

4040
def newBuilder[T]: Combiner[T, ParIterable[T]] = ParArrayCombiner[T]()
4141

core/src/main/scala/scala/collection/parallel/ParMap.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,12 @@ self =>
4545

4646

4747

48-
object ParMap extends ParMapFactory[ParMap] {
48+
object ParMap extends ParMapFactory[ParMap, collection.Map] {
4949
def empty[K, V]: ParMap[K, V] = new mutable.ParHashMap[K, V]
5050

5151
def newCombiner[K, V]: Combiner[(K, V), ParMap[K, V]] = mutable.ParHashMapCombiner[K, V]
5252

53-
implicit def canBuildFrom[K, V]: CanCombineFrom[Coll, (K, V), ParMap[K, V]] = new CanCombineFromMap[K, V]
53+
implicit def canBuildFrom[FromK, FromV, K, V]: CanCombineFrom[ParMap[FromK, FromV], (K, V), ParMap[K, V]] = new CanCombineFromMap[FromK, FromV, K, V]
5454

5555
/** An abstract shell used by { mutable, immutable }.Map but not by collection.Map
5656
* because of variance issues.

core/src/main/scala/scala/collection/parallel/ParSeq.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ trait ParSeq[+T] extends ParIterable[T]
4242
}
4343

4444
object ParSeq extends ParFactory[ParSeq] {
45-
implicit def canBuildFrom[T]: CanCombineFrom[ParSeq[_], T, ParSeq[T]] = new GenericCanCombineFrom[T]
45+
implicit def canBuildFrom[S, T]: CanCombineFrom[ParSeq[S], T, ParSeq[T]] = new GenericCanCombineFrom[S, T]
4646

4747
def newBuilder[T]: Combiner[T, ParSeq[T]] = ParArrayCombiner[T]()
4848
def newCombiner[T]: Combiner[T, ParSeq[T]] = ParArrayCombiner[T]()

core/src/main/scala/scala/collection/parallel/ParSet.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,5 +40,5 @@ trait ParSet[T]
4040
object ParSet extends ParSetFactory[ParSet] {
4141
def newCombiner[T]: Combiner[T, ParSet[T]] = mutable.ParHashSetCombiner[T]
4242

43-
implicit def canBuildFrom[T]: CanCombineFrom[ParSet[_], T, ParSet[T]] = new GenericCanCombineFrom[T]
43+
implicit def canBuildFrom[S, T]: CanCombineFrom[ParSet[S], T, ParSet[T]] = new GenericCanCombineFrom[S, T]
4444
}

core/src/main/scala/scala/collection/parallel/RemainsIterator.scala

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@ self =>
465465
def split: Seq[IterableSplitter[S]] = self.split.map { _ map f }
466466
}
467467

468-
override def map[S](f: T => S) = new Mapped(f)
468+
override def map[S](f: T => S): IterableSplitter[S] = new Mapped[S](f)
469469

470470
class Appended[U >: T, PI <: IterableSplitter[U]](protected val that: PI) extends IterableSplitter[U] {
471471
signalDelegate = self.signalDelegate
@@ -500,7 +500,7 @@ self =>
500500
}
501501
}
502502

503-
def zipParSeq[S](that: SeqSplitter[S]) = new Zipped(that)
503+
def zipParSeq[S](that: SeqSplitter[S]): IterableSplitter[(T, S)] = new Zipped(that)
504504

505505
class ZippedAll[U >: T, S](protected val that: SeqSplitter[S], protected val thiselem: U, protected val thatelem: S)
506506
extends IterableSplitter[(U, S)] {
@@ -578,7 +578,7 @@ self =>
578578
def psplit(sizes: Int*): Seq[SeqSplitter[S]] = self.psplit(sizes: _*).map { _ map f }
579579
}
580580

581-
override def map[S](f: T => S) = new RemainsIteratorMapped(f)
581+
override def map[S](f: T => S): SeqSplitter[S] = new RemainsIteratorMapped(f)
582582

583583
class RemainsIteratorAppended[U >: T, PI <: SeqSplitter[U]](it: PI) extends Appended[U, PI](it) with SeqSplitter[U] {
584584
override def dup = super.dup.asInstanceOf[SeqSplitter[U]]
@@ -614,10 +614,10 @@ self =>
614614
class RemainsIteratorZipped[S](ti: SeqSplitter[S]) extends Zipped[S](ti) with SeqSplitter[(T, S)] {
615615
override def dup = super.dup.asInstanceOf[SeqSplitter[(T, S)]]
616616
override def split: Seq[SeqSplitter[(T, S)]] = super.split.asInstanceOf[Seq[SeqSplitter[(T, S)]]]
617-
def psplit(szs: Int*) = (self.psplit(szs: _*) zip that.psplit(szs: _*)) map { p => p._1 zipParSeq p._2 }
617+
def psplit(szs: Int*) = (self.psplit(szs: _*) zip that.psplit(szs: _*)) map { p => (p._1 zipParSeq p._2) }
618618
}
619619

620-
override def zipParSeq[S](that: SeqSplitter[S]) = new RemainsIteratorZipped(that)
620+
override def zipParSeq[S](that: SeqSplitter[S]): SeqSplitter[(T, S)] = new RemainsIteratorZipped(that)
621621

622622
class RemainsIteratorZippedAll[U >: T, S](ti: SeqSplitter[S], thise: U, thate: S) extends ZippedAll[U, S](ti, thise, thate) with SeqSplitter[(U, S)] {
623623
override def dup = super.dup.asInstanceOf[SeqSplitter[(U, S)]]
@@ -635,7 +635,7 @@ self =>
635635
}
636636
def psplit(sizes: Int*): Seq[SeqSplitter[(U, S)]] = {
637637
val (thisit, thatit) = patchem
638-
val zipped = thisit zipParSeq thatit
638+
val zipped = (thisit zipParSeq thatit)
639639
zipped.psplit(sizes: _*)
640640
}
641641
}

core/src/main/scala/scala/collection/parallel/Tasks.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ trait AdaptiveWorkStealingForkJoinTasks extends ForkJoinTasks with AdaptiveWorkS
306306
def split = body.split.map(b => newWrappedTask(b))
307307
}
308308

309-
def newWrappedTask[R, Tp](b: Task[R, Tp]) = new AWSFJTWrappedTask[R, Tp](b)
309+
def newWrappedTask[R, Tp](b: Task[R, Tp]): AWSFJTWrappedTask[R, Tp] = new AWSFJTWrappedTask[R, Tp](b)
310310
}
311311

312312
/** An implementation of the `Tasks` that uses Scala `Future`s to compute

core/src/main/scala/scala/collection/parallel/immutable/ParHashMap.scala

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,9 @@ self =>
9292
phit
9393
}
9494
def split: Seq[IterableSplitter[(K, V)]] = if (remaining < 2) Seq(this) else triter match {
95-
case t: TrieIterator[_] =>
95+
case t: TrieIterator[(K, V)] =>
9696
val previousRemaining = remaining
97-
val ((fst: Iterator[(K, V) @unchecked], fstlength), snd: Iterator[(K, V) @unchecked]) = t.split
97+
val ((fst, fstlength), snd) = t.split
9898
val sndlength = previousRemaining - fstlength
9999
Seq(
100100
new ParHashMapIterator(fst, fstlength),
@@ -140,13 +140,13 @@ self =>
140140
* @define Coll `immutable.ParHashMap`
141141
* @define coll immutable parallel hash map
142142
*/
143-
object ParHashMap extends ParMapFactory[ParHashMap] {
143+
object ParHashMap extends ParMapFactory[ParHashMap, OldHashMap] {
144144
def empty[K, V]: ParHashMap[K, V] = new ParHashMap[K, V]
145145

146146
def newCombiner[K, V]: Combiner[(K, V), ParHashMap[K, V]] = HashMapCombiner[K, V]
147147

148-
implicit def canBuildFrom[K, V]: CanCombineFrom[Coll, (K, V), ParHashMap[K, V]] = {
149-
new CanCombineFromMap[K, V]
148+
implicit def canBuildFrom[FromK, FromV, K, V]: CanCombineFrom[ParHashMap[FromK, FromV], (K, V), ParHashMap[K, V]] = {
149+
new CanCombineFromMap[FromK, FromV, K, V]
150150
}
151151

152152
def fromTrie[K, V](t: OldHashMap[K, V]) = new ParHashMap(t)
@@ -308,7 +308,7 @@ extends scala.collection.parallel.BucketCombiner[(K, V), ParHashMap[K, V], (K, V
308308
case hm1: OldHashMap.OldHashMap1[_, _] =>
309309
val evaledvalue = hm1.value.result()
310310
new OldHashMap.OldHashMap1[K, Repr](hm1.key, hm1.hash, evaledvalue, null)
311-
case hmc: OldHashMap.OldHashMapCollision1[_, _] =>
311+
case hmc: OldHashMap.OldHashMapCollision1[_, Combiner[_, Repr]] =>
312312
val evaledkvs = hmc.kvs map { p => (p._1, p._2.result()) }
313313
new OldHashMap.OldHashMapCollision1[K, Repr](hmc.hash, evaledkvs)
314314
case htm: OldHashMap.HashTrieMap[k, v] =>

core/src/main/scala/scala/collection/parallel/immutable/ParHashSet.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ self =>
7878
extends IterableSplitter[T] {
7979
var i = 0
8080
def dup = triter match {
81-
case t: TrieIterator[_] =>
81+
case t: TrieIterator[T] =>
8282
dupFromIterator(t.dupIterator)
8383
case _ =>
8484
val buff = triter.toBuffer
@@ -91,7 +91,7 @@ self =>
9191
phit
9292
}
9393
def split: Seq[IterableSplitter[T]] = if (remaining < 2) Seq(this) else triter match {
94-
case t: TrieIterator[_] =>
94+
case t: TrieIterator[T] =>
9595
val previousRemaining = remaining
9696
val ((fst, fstlength), snd) = t.split
9797
val sndlength = previousRemaining - fstlength
@@ -125,8 +125,8 @@ self =>
125125
object ParHashSet extends ParSetFactory[ParHashSet] {
126126
def newCombiner[T]: Combiner[T, ParHashSet[T]] = HashSetCombiner[T]
127127

128-
implicit def canBuildFrom[T]: CanCombineFrom[ParHashSet[_], T, ParHashSet[T]] =
129-
new GenericCanCombineFrom[T]
128+
implicit def canBuildFrom[S, T]: CanCombineFrom[ParHashSet[S], T, ParHashSet[T]] =
129+
new GenericCanCombineFrom[S, T]
130130

131131
def fromTrie[T](t: OldHashSet[T]) = new ParHashSet(t)
132132
}

core/src/main/scala/scala/collection/parallel/immutable/ParIterable.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ extends scala.collection.parallel.ParIterable[T]
4040
/** $factoryInfo
4141
*/
4242
object ParIterable extends ParFactory[ParIterable] {
43-
implicit def canBuildFrom[T]: CanCombineFrom[ParIterable[_], T, ParIterable[T]] =
44-
new GenericCanCombineFrom[T]
43+
implicit def canBuildFrom[S, T]: CanCombineFrom[ParIterable[S], T, ParIterable[T]] =
44+
new GenericCanCombineFrom[S, T]
4545

4646
def newBuilder[T]: Combiner[T, ParIterable[T]] = ParVector.newBuilder[T]
4747
def newCombiner[T]: Combiner[T, ParIterable[T]] = ParVector.newCombiner[T]

core/src/main/scala/scala/collection/parallel/immutable/ParMap.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,12 +88,12 @@ trait ParMapLike[
8888

8989

9090

91-
object ParMap extends ParMapFactory[ParMap] {
91+
object ParMap extends ParMapFactory[ParMap, scala.collection.immutable.Map] {
9292
def empty[K, V]: ParMap[K, V] = new ParHashMap[K, V]
9393

9494
def newCombiner[K, V]: Combiner[(K, V), ParMap[K, V]] = HashMapCombiner[K, V]
9595

96-
implicit def canBuildFrom[K, V]: CanCombineFrom[Coll, (K, V), ParMap[K, V]] = new CanCombineFromMap[K, V]
96+
implicit def canBuildFrom[FromK, FromV, K, V]: CanCombineFrom[ParMap[FromK, FromV], (K, V), ParMap[K, V]] = new CanCombineFromMap[FromK, FromV, K, V]
9797

9898
class WithDefault[K, +V](underlying: ParMap[K, V], d: K => V)
9999
extends scala.collection.parallel.ParMap.WithDefault[K, V](underlying, d) with ParMap[K, V] {

core/src/main/scala/scala/collection/parallel/immutable/ParSeq.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ extends scala.collection.parallel.ParSeq[T]
3838
* @define coll mutable parallel sequence
3939
*/
4040
object ParSeq extends ParFactory[ParSeq] {
41-
implicit def canBuildFrom[T]: CanCombineFrom[ParSeq[_], T, ParSeq[T]] = new GenericCanCombineFrom[T]
41+
implicit def canBuildFrom[S, T]: CanCombineFrom[ParSeq[S], T, ParSeq[T]] = new GenericCanCombineFrom[S, T]
4242

4343
def newBuilder[T]: Combiner[T, ParSeq[T]] = ParVector.newBuilder[T]
4444
def newCombiner[T]: Combiner[T, ParSeq[T]] = ParVector.newCombiner[T]

core/src/main/scala/scala/collection/parallel/immutable/ParSet.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,5 +47,5 @@ self =>
4747
object ParSet extends ParSetFactory[ParSet] {
4848
def newCombiner[T]: Combiner[T, ParSet[T]] = HashSetCombiner[T]
4949

50-
implicit def canBuildFrom[T]: CanCombineFrom[ParSet[_], T, ParSet[T]] = new GenericCanCombineFrom[T]
50+
implicit def canBuildFrom[S, T]: CanCombineFrom[ParSet[S], T, ParSet[T]] = new GenericCanCombineFrom[S, T]
5151
}

core/src/main/scala/scala/collection/parallel/immutable/ParVector.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,8 @@ extends ParSeq[T]
9292
* @define coll immutable parallel vector
9393
*/
9494
object ParVector extends ParFactory[ParVector] {
95-
implicit def canBuildFrom[T]: CanCombineFrom[ParVector[_], T, ParVector[T]] =
96-
new GenericCanCombineFrom[T]
95+
implicit def canBuildFrom[S, T]: CanCombineFrom[ParVector[S], T, ParVector[T]] =
96+
new GenericCanCombineFrom[S, T]
9797

9898
def newBuilder[T]: Combiner[T, ParVector[T]] = newCombiner[T]
9999

core/src/main/scala/scala/collection/parallel/mutable/ParArray.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -689,7 +689,7 @@ self =>
689689
* @define coll parallel array
690690
*/
691691
object ParArray extends ParFactory[ParArray] {
692-
implicit def canBuildFrom[T]: CanCombineFrom[ParArray[_], T, ParArray[T]] = new GenericCanCombineFrom[T]
692+
implicit def canBuildFrom[S, T]: CanCombineFrom[ParArray[S], T, ParArray[T]] = new GenericCanCombineFrom[S, T]
693693
def newBuilder[T]: Combiner[T, ParArray[T]] = newCombiner
694694
def newCombiner[T]: Combiner[T, ParArray[T]] = ParArrayCombiner[T]()
695695

core/src/main/scala/scala/collection/parallel/mutable/ParHashMap.scala

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -150,14 +150,14 @@ self =>
150150
* @define Coll `mutable.ParHashMap`
151151
* @define coll parallel hash map
152152
*/
153-
object ParHashMap extends ParMapFactory[ParHashMap] {
153+
object ParHashMap extends ParMapFactory[ParHashMap, scala.collection.mutable.HashMap] {
154154
var iters = 0
155155

156156
def empty[K, V]: ParHashMap[K, V] = new ParHashMap[K, V]
157157

158158
def newCombiner[K, V]: Combiner[(K, V), ParHashMap[K, V]] = ParHashMapCombiner.apply[K, V]
159159

160-
implicit def canBuildFrom[K, V]: CanCombineFrom[Coll, (K, V), ParHashMap[K, V]] = new CanCombineFromMap[K, V]
160+
implicit def canBuildFrom[FromK, FromV, K, V]: CanCombineFrom[ParHashMap[FromK, FromV], (K, V), ParHashMap[K, V]] = new CanCombineFromMap[FromK, FromV, K, V]
161161

162162
final class DefaultEntry[K, V](val key: K, var value: V) extends HashEntry[K, DefaultEntry[K, V]] with Serializable {
163163
override def toString: String = s"DefaultEntry($key -> $value)"
@@ -196,7 +196,7 @@ extends scala.collection.parallel.BucketCombiner[(K, V), ParHashMap[K, V], Defau
196196
} else {
197197
// construct a normal table and fill it sequentially
198198
// TODO parallelize by keeping separate sizemaps and merging them
199-
object table extends HashTable[K, DefaultEntry[K, V], DefaultEntry[K, V]] with WithContents[K, DefaultEntry[K, V], DefaultEntry[K, V]] {
199+
object newTable extends HashTable[K, DefaultEntry[K, V], DefaultEntry[K, V]] with WithContents[K, DefaultEntry[K, V], DefaultEntry[K, V]] {
200200
type Entry = DefaultEntry[K, V]
201201
def insertEntry(e: Entry): Unit = { super.findOrAddEntry(e.key, e) }
202202
def createNewEntry(key: K, entry: Entry): Entry = entry
@@ -205,11 +205,11 @@ extends scala.collection.parallel.BucketCombiner[(K, V), ParHashMap[K, V], Defau
205205
var i = 0
206206
while (i < ParHashMapCombiner.numblocks) {
207207
if (buckets(i) ne null) {
208-
for (elem <- buckets(i)) table.insertEntry(elem)
208+
for (elem <- buckets(i)) newTable.insertEntry(elem)
209209
}
210210
i += 1
211211
}
212-
new ParHashMap(table.hashTableContents)
212+
new ParHashMap(newTable.hashTableContents)
213213
}
214214

215215
/* classes */

core/src/main/scala/scala/collection/parallel/mutable/ParHashSet.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ extends ParSet[T]
113113
* @define coll parallel hash set
114114
*/
115115
object ParHashSet extends ParSetFactory[ParHashSet] {
116-
implicit def canBuildFrom[T]: CanCombineFrom[ParHashSet[_], T, ParHashSet[T]] = new GenericCanCombineFrom[T]
116+
implicit def canBuildFrom[S, T]: CanCombineFrom[ParHashSet[S], T, ParHashSet[T]] = new GenericCanCombineFrom[S, T]
117117

118118
override def newBuilder[T]: Combiner[T, ParHashSet[T]] = newCombiner
119119

core/src/main/scala/scala/collection/parallel/mutable/ParIterable.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ trait ParIterable[T] extends scala.collection.parallel.ParIterable[T]
4242
/** $factoryInfo
4343
*/
4444
object ParIterable extends ParFactory[ParIterable] {
45-
implicit def canBuildFrom[T]: CanCombineFrom[ParIterable[_], T, ParIterable[T]] = new GenericCanCombineFrom[T]
45+
implicit def canBuildFrom[S, T]: CanCombineFrom[ParIterable[S], T, ParIterable[T]] = new GenericCanCombineFrom[S, T]
4646

4747
def newBuilder[T]: Combiner[T, ParIterable[T]] = ParArrayCombiner[T]()
4848
def newCombiner[T]: Combiner[T, ParIterable[T]] = ParArrayCombiner[T]()

core/src/main/scala/scala/collection/parallel/mutable/ParMap.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,12 @@ extends parallel.ParMap[K, V]
6060
def withDefaultValue(d: V): scala.collection.parallel.mutable.ParMap[K, V] = new ParMap.WithDefault[K, V](this, x => d)
6161
}
6262

63-
object ParMap extends ParMapFactory[ParMap] {
63+
object ParMap extends ParMapFactory[ParMap, scala.collection.mutable.Map] {
6464
def empty[K, V]: ParMap[K, V] = new ParHashMap[K, V]
6565

6666
def newCombiner[K, V]: Combiner[(K, V), ParMap[K, V]] = ParHashMapCombiner.apply[K, V]
6767

68-
implicit def canBuildFrom[K, V]: CanCombineFrom[Coll, (K, V), ParMap[K, V]] = new CanCombineFromMap[K, V]
68+
implicit def canBuildFrom[FromK, FromV, K, V]: CanCombineFrom[ParMap[FromK, FromV], (K, V), ParMap[K, V]] = new CanCombineFromMap[FromK, FromV, K, V]
6969

7070
class WithDefault[K, V](underlying: ParMap[K, V], d: K => V)
7171
extends scala.collection.parallel.ParMap.WithDefault(underlying, d) with ParMap[K, V] {

core/src/main/scala/scala/collection/parallel/mutable/ParSeq.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ self =>
4646
* @define coll mutable parallel sequence
4747
*/
4848
object ParSeq extends ParFactory[ParSeq] {
49-
implicit def canBuildFrom[T]: CanCombineFrom[ParSeq[_], T, ParSeq[T]] = new GenericCanCombineFrom[T]
49+
implicit def canBuildFrom[S, T]: CanCombineFrom[ParSeq[S], T, ParSeq[T]] = new GenericCanCombineFrom[S, T]
5050

5151
def newBuilder[T]: Combiner[T, ParSeq[T]] = ParArrayCombiner[T]()
5252

core/src/main/scala/scala/collection/parallel/mutable/ParSet.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ self =>
3737
* @define coll mutable parallel set
3838
*/
3939
object ParSet extends ParSetFactory[ParSet] {
40-
implicit def canBuildFrom[T]: CanCombineFrom[ParSet[_], T, ParSet[T]] = new GenericCanCombineFrom[T]
40+
implicit def canBuildFrom[S, T]: CanCombineFrom[ParSet[S], T, ParSet[T]] = new GenericCanCombineFrom[S, T]
4141

4242
override def newBuilder[T]: Combiner[T, ParSet[T]] = ParHashSet.newBuilder
4343

core/src/main/scala/scala/collection/parallel/mutable/ParTrieMap.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ extends TrieMapIterator[K, V](lev, ct, mustInit)
127127
lazy val totalsize = new ParTrieMap(ct).size
128128
var iterated = 0
129129

130-
protected override def newIterator(_lev: Int, _ct: TrieMap[K, V], _mustInit: Boolean) = new ParTrieMapSplitter[K, V](_lev, _ct, _mustInit)
130+
protected override def newIterator(_lev: Int, _ct: TrieMap[K, V], _mustInit: Boolean): ParTrieMapSplitter[K, V] = new ParTrieMapSplitter[K, V](_lev, _ct, _mustInit)
131131

132132
override def shouldSplitFurther[S](coll: scala.collection.parallel.ParIterable[S], parallelismLevel: Int) = {
133133
val maxsplits = 3 + Integer.highestOneBit(parallelismLevel)
@@ -163,9 +163,9 @@ private[mutable] trait ParTrieMapCombiner[K, V] extends Combiner[(K, V), ParTrie
163163
override def canBeShared = true
164164
}
165165

166-
object ParTrieMap extends ParMapFactory[ParTrieMap] {
166+
object ParTrieMap extends ParMapFactory[ParTrieMap, TrieMap] {
167167
def empty[K, V]: ParTrieMap[K, V] = new ParTrieMap[K, V]
168168
def newCombiner[K, V]: Combiner[(K, V), ParTrieMap[K, V]] = new ParTrieMap[K, V]
169169

170-
implicit def canBuildFrom[K, V]: CanCombineFrom[Coll, (K, V), ParTrieMap[K, V]] = new CanCombineFromMap[K, V]
170+
implicit def canBuildFrom[FromK, FromV, K, V]: CanCombineFrom[ParTrieMap[FromK, FromV], (K, V), ParTrieMap[K, V]] = new CanCombineFromMap[FromK, FromV, K, V]
171171
}

0 commit comments

Comments
 (0)