From ae3c8579969375f0215b941ca49960ffabc60a26 Mon Sep 17 00:00:00 2001 From: Lukas Rytz Date: Mon, 16 Sep 2019 16:44:52 +0200 Subject: [PATCH] Avoid dotty compiler crash ``` [error] 203 | case hm: mutable.HashMap[K, V] => hm.mapValuesInPlaceImpl(f) [error] | ^ [error] |Recursion limit exceeded. [error] |Maybe there is an illegal cyclic reference? [error] |If that's not the case, you could also try to increase the stacksize using the -Xss JVM option. [error] |A recurring operation is (inner to outer): [error] | [error] | subtype scala.collection.mutable.HashMap <:< LazyRef(...) ``` --- src/library/scala/collection/mutable/Map.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/library/scala/collection/mutable/Map.scala b/src/library/scala/collection/mutable/Map.scala index 6f1e253f8bab..34739492ddd4 100644 --- a/src/library/scala/collection/mutable/Map.scala +++ b/src/library/scala/collection/mutable/Map.scala @@ -200,7 +200,7 @@ trait MapOps[K, V, +CC[X, Y] <: MapOps[X, Y, CC, _], +C <: MapOps[K, V, CC, C]] */ def mapValuesInPlace(f: (K, V) => V): this.type = { if (nonEmpty) this match { - case hm: mutable.HashMap[K, V] => hm.mapValuesInPlaceImpl(f) + case hm: mutable.HashMap[_, _] => hm.asInstanceOf[mutable.HashMap[K, V]].mapValuesInPlaceImpl(f) case _ => val array = this.toArray[Any] val arrayLength = array.length