Skip to content

Commit 76a9c8c

Browse files
committed
Future-proof the collections for Dotty
Just like what we did for concat in scala#7696, we add a dummy parameter list to avoid signature clashes between mixin forwarders, but this change should be less controversial since it only affects a deprecated method. Note that this isn't actually needed to compile with Dotty master yet because we only emit mixin forwarders when required to, but we will soon switch to emitting them all the time like scalac does (scala/scala3#2563), therefore we need to get the fix in first (and most importantly in time for 2.13).
1 parent 481a78b commit 76a9c8c

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/library/scala/collection/Map.scala

+5-1
Original file line numberDiff line numberDiff line change
@@ -310,8 +310,12 @@ trait MapOps[K, +V, +CC[_, _] <: IterableOps[_, AnyConstr, _], +C]
310310
fromSpecific(this.view.filterKeys(k => !keysSet.contains(k)))
311311
}
312312

313+
// The implicit dummy parameter is necessary to avoid erased signature clashes
314+
// between this `++:` and the overload overriden below.
315+
// Note that these clashes only happen in Dotty because it adds mixin
316+
// forwarders before erasure unlike Scala 2.
313317
@deprecated("Use ++ instead of ++: for collections of type Iterable", "2.13.0")
314-
def ++: [V1 >: V](that: IterableOnce[(K,V1)]): CC[K,V1] = {
318+
def ++: [V1 >: V](that: IterableOnce[(K,V1)])(implicit dummy: DummyImplicit): CC[K,V1] = {
315319
val thatIterable: Iterable[(K, V1)] = that match {
316320
case that: Iterable[(K, V1)] => that
317321
case that => View.from(that)

0 commit comments

Comments
 (0)