Skip to content

Commit bfe3ae5

Browse files
committed
Fix #4188: Test case
1 parent 0b4871d commit bfe3ae5

File tree

2 files changed

+52
-0
lines changed

2 files changed

+52
-0
lines changed

tests/pos/i4188/Test_2.scala

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package collections
2+
3+
import decorators._
4+
5+
object Test {
6+
def test(map: Map[Int, String]) = {
7+
MapDecorator(map.view)
8+
}
9+
}

tests/pos/i4188/collections_1.scala

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
package collections
2+
3+
object collections {
4+
type AnyConstr[X] = Any
5+
}
6+
7+
import collections._
8+
9+
trait Iterable[+A] extends IterableOps[A, Iterable, Iterable[A]]
10+
11+
trait IterableOps[+A, +CC[_], +C]
12+
13+
trait Map[K, +V] extends MapOps[K, V, Map, Map[K, V]]
14+
15+
trait MapOps[K, +V, +CC[_, _] <: IterableOps[_, AnyConstr, _], +C]
16+
extends IterableOps[(K, V), Iterable, C] {
17+
def view: MapView[K, V] = ???
18+
}
19+
20+
trait View[+A] extends Iterable[A] with IterableOps[A, View, View[A]]
21+
22+
trait MapView[K, +V]
23+
extends MapOps[K, V, ({ type l[X, Y] = View[(X, Y)] })#l, View[(K, V)]]
24+
with View[(K, V)]
25+
26+
class MapDecorator[C, M <: HasMapOps[C]]
27+
28+
trait HasMapOps[C] {
29+
30+
/** The type of keys */
31+
type K
32+
33+
/** The type of values */
34+
type V
35+
36+
type A = (K, V)
37+
}
38+
39+
object decorators {
40+
def MapDecorator[C](coll: C)(implicit map: HasMapOps[C]): MapDecorator[C, map.type] = ???
41+
42+
implicit def mapHasMapOps[CC[X, +Y] <: MapOps[X, Y, ({ type l[X, +Y] = IterableOps[_, AnyConstr, _] })#l, _], K0, V0]: HasMapOps[CC[K0, V0]] { type K = K0; type V = V0 } = ???
43+
}

0 commit comments

Comments
 (0)