Skip to content
This repository was archived by the owner on Dec 22, 2021. It is now read-only.

Commit 236fa97

Browse files
committed
Failed attempt to fix Dotty compilation error
1 parent 9f4f6f6 commit 236fa97

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

collections/src/main/scala/strawman/collection/MapView.scala

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,19 @@ trait MapView[K, +V]
2525

2626
object MapView {
2727

28-
class Id[K, +V](underlying: MapOps[K, V, AnyConstr, _]) extends MapView[K, V] {
28+
type AnyIterableConstr[X, Y] = IterableOps[_, AnyConstr, _]
29+
type AnyMapOps[K, +V] = MapOps[K, V, AnyIterableConstr, _]
30+
31+
class Id[K, +V](underlying: AnyMapOps[K, V]) extends MapView[K, V] {
2932
def get(key: K): Option[V] = underlying.get(key)
3033
def iterator(): Iterator[(K, V)] = underlying.iterator()
3134
override def knownSize: Int = underlying.knownSize
3235
}
3336

34-
class MapValues[K, +V, +W](underlying: MapOps[K, V, AnyConstr, _], f: V => W) extends MapView[K, W] {
37+
class MapValues[K, +V, +W](underlying: AnyMapOps[K, V], f: V => W) extends MapView[K, W] {
3538
def iterator(): Iterator[(K, W)] = underlying.iterator().map(kv => (kv._1, f(kv._2)))
36-
override def knownSize: Int = underlying.knownSize
3739
def get(key: K): Option[W] = underlying.get(key).map(f)
40+
override def knownSize: Int = underlying.knownSize
3841
}
3942

4043
}

0 commit comments

Comments
 (0)