Skip to content

Commit de67588

Browse files
committed
Update Scala version to latest nightly
- Remove extensibility framework (fixes scala#5) - Remove `ImmutableMapDecorator` and `MutableMapDecorator`, because `updatedWith` and `updateWith` have been merged upstream
1 parent 0bff1f2 commit de67588

25 files changed

+53
-378
lines changed

build.sbt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
// TODO Make it a cross project including Scala.js
22

3-
scalaVersion := "2.13.0-M4"
3+
resolvers += "scala-integration" at "https://scala-ci.typesafe.com/artifactory/scala-integration/"
4+
5+
scalaVersion := "2.13.0-pre-370f5c8"
46

57
organization := "org.scala-lang"
68

src/main/scala/scala/collection/MultiDict.scala

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ trait MultiDict[K, V]
1616

1717
def multiMapFactory: MapFactory[MultiDictCC] = MultiDict
1818

19-
override protected[this] def fromSpecificIterable(coll: Iterable[(K, V)]): MultiDictCC[K, V] = multiMapFactory.from(coll)
19+
override protected[this] def fromSpecific(coll: IterableOnce[(K, V)]): MultiDictCC[K, V] = multiMapFactory.from(coll)
2020
override protected[this] def newSpecificBuilder: mutable.Builder[(K, V), MultiDictCC[K, V]] = multiMapFactory.newBuilder[K, V]
2121

2222
def canEqual(that: Any): Boolean = true
@@ -51,7 +51,7 @@ trait MultiDictOps[K, V, +CC[X, Y] <: MultiDict[X, Y], +C <: MultiDict[K, V]]
5151
multiMapFactory.from(it)
5252

5353
protected[this] def fromSpecificSets(it: Iterable[(K, Set[V])]): C =
54-
fromSpecificIterable(it.view.flatMap { case (k, vs) => vs.view.map(v => (k, v)) })
54+
fromSpecific(it.view.flatMap { case (k, vs) => vs.view.map(v => (k, v)) })
5555

5656
protected[this] def fromSets[L, W](it: Iterable[(L, Set[W])]): CC[L, W] =
5757
multiMapFromIterable(it.view.flatMap { case (k, vs) => vs.view.map(v => (k, v)) })
@@ -133,8 +133,10 @@ trait MultiDictOps[K, V, +CC[X, Y] <: MultiDict[X, Y], +C <: MultiDict[K, V]]
133133
)
134134

135135
/** Concatenate the entries given in `that` iterable to `this` multidict */
136-
def concat(that: Iterable[(K, V)]): C =
137-
fromSpecificIterable(new View.Concat(toIterable, that))
136+
def concat(that: IterableOnce[(K, V)]): C = fromSpecific(that match {
137+
case that: collection.Iterable[(K, V)] => new View.Concat(toIterable, that)
138+
case _ => iterator ++ that.iterator
139+
})
138140

139141
override def withFilter(p: ((K, V)) => Boolean): MultiDictOps.WithFilter[K, V, IterableCC, CC] =
140142
new MultiDictOps.WithFilter(this, p)

src/main/scala/scala/collection/MultiSet.scala

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@ trait MultiSetOps[A, +CC[X] <: MultiSet[X], +C <: MultiSet[A]]
3636
extends IterableOps[A, CC, C] {
3737

3838
protected[this] def fromSpecificOccurrences(it: Iterable[(A, Int)]): C =
39-
fromSpecificIterable(it.view.flatMap { case (e, n) => new View.Fill(n)(e) })
39+
fromSpecific(it.view.flatMap { case (e, n) => new View.Fill(n)(e) })
4040

4141
protected[this] def fromOccurrences[E](it: Iterable[(E, Int)]): CC[E] =
4242
// Note new MultiSet(it.to(Map)) would be more efficient but would also loose duplicates
43-
fromIterable(it.view.flatMap { case (e, n) => new View.Fill(n)(e) })
43+
iterableFactory.from(it.view.flatMap { case (e, n) => new View.Fill(n)(e) })
4444

4545
/**
4646
* @return All the elements contained in this multiset and their number of occurrences
@@ -68,8 +68,10 @@ trait MultiSetOps[A, +CC[X] <: MultiSet[X], +C <: MultiSet[A]]
6868
*
6969
* @param that the collection of elements to add to this multiset
7070
*/
71-
def concat(that: Iterable[A]): C =
72-
fromSpecificIterable(new View.Concat(toIterable, that))
71+
def concat(that: IterableOnce[A]): C = fromSpecific(that match {
72+
case that: collection.Iterable[A] => new View.Concat(this, that)
73+
case _ => iterator.concat(that.iterator)
74+
})
7375

7476
/**
7577
* @return a new multiset summing the occurrences of this multiset

src/main/scala/scala/collection/SortedMultiDict.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ trait SortedMultiDict[K, V]
1313

1414
def unsorted: MultiDict[K, V] = this
1515

16-
override protected[this] def fromSpecificIterable(coll: Iterable[(K, V)]): SortedMultiDictCC[K, V] = sortedMultiMapFactory.from(coll)
16+
override protected[this] def fromSpecific(coll: IterableOnce[(K, V)]): SortedMultiDictCC[K, V] = sortedMultiMapFactory.from(coll)
1717
override protected[this] def newSpecificBuilder: mutable.Builder[(K, V), SortedMultiDictCC[K, V]] = sortedMultiMapFactory.newBuilder[K, V]
1818
}
1919

src/main/scala/scala/collection/SortedMultiSet.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ trait SortedMultiSet[A]
1212

1313
def unsorted: MultiSet[A] = this
1414

15-
override protected[this] def fromSpecificIterable(coll: Iterable[A]): SortedIterableCC[A] = sortedIterableFactory.from(coll)
15+
override protected[this] def fromSpecific(coll: IterableOnce[A]): SortedIterableCC[A] = sortedIterableFactory.from(coll)
1616
override protected[this] def newSpecificBuilder: mutable.Builder[A, SortedIterableCC[A]] = sortedIterableFactory.newBuilder[A]
1717

1818
protected[this] def sortedFromIterable[B : Ordering](it: scala.collection.Iterable[B]): SortedIterableCC[B] = sortedIterableFactory.from(it)
@@ -165,7 +165,7 @@ object SortedMultiSetOps {
165165
class WithFilter[A, +IterableCC[_], +CC[X] <: MultiSet[X]](
166166
`this`: SortedMultiSetOps[A, CC, _] with IterableOps[A, IterableCC, _],
167167
p: A => Boolean
168-
) extends IterableOps.WithFilter(`this`, p) {
168+
) extends IterableOps.WithFilter[A, IterableCC](`this`, p) {
169169

170170
def map[B : Ordering](f: A => B): CC[B] =
171171
`this`.sortedIterableFactory.from(new View.Map(filtered, f))

src/main/scala/scala/collection/decorators/HasImmutableMapOps.scala

Lines changed: 0 additions & 43 deletions
This file was deleted.

src/main/scala/scala/collection/decorators/HasIterableOps.scala

Lines changed: 0 additions & 44 deletions
This file was deleted.

src/main/scala/scala/collection/decorators/HasMapOps.scala

Lines changed: 0 additions & 46 deletions
This file was deleted.

src/main/scala/scala/collection/decorators/HasSeqOps.scala

Lines changed: 0 additions & 58 deletions
This file was deleted.

src/main/scala/scala/collection/decorators/ImmutableMapDecorator.scala

Lines changed: 0 additions & 40 deletions
This file was deleted.

src/main/scala/scala/collection/decorators/IterableDecorator.scala

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ package scala
22
package collection
33
package decorators
44

5-
class IterableDecorator[C, I <: HasIterableOps[C]](coll: C)(implicit val it: I) {
5+
import scala.collection.generic.IsIterable
6+
7+
class IterableDecorator[C, I <: IsIterable[C]](coll: C)(implicit val it: I) {
68

79
/**
810
* Left to right fold that stops if the combination function `op`

src/main/scala/scala/collection/decorators/MapDecorator.scala

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
package scala.collection
22
package decorators
33

4-
class MapDecorator[C, M <: HasMapOps[C]](coll: C)(implicit val map: M) {
4+
import scala.collection.generic.IsMap
5+
6+
class MapDecorator[C, M <: IsMap[C]](coll: C)(implicit val map: M) {
57

68
/**
79
* Combines entries of `this` Map with entries of `that` Map that have the same key,

0 commit comments

Comments
 (0)