Skip to content

Commit e3ef657

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 7996222 commit e3ef657

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
@@ -311,8 +311,12 @@ trait MapOps[K, +V, +CC[_, _] <: IterableOps[_, AnyConstr, _], +C]
311311
fromSpecific(this.view.filterKeys(k => !keysSet.contains(k)))
312312
}
313313

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

0 commit comments

Comments
 (0)