Skip to content

Fix #4188: Test case #8488

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions tests/pos/i4188/Test_2.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package collections

import decorators._

object Test {
def test(map: Map[Int, String]) = {
MapDecorator(map.view)
}
}
43 changes: 43 additions & 0 deletions tests/pos/i4188/collections_1.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package collections

object collections {
type AnyConstr[X] = Any
}

import collections._

trait Iterable[+A] extends IterableOps[A, Iterable, Iterable[A]]

trait IterableOps[+A, +CC[_], +C]

trait Map[K, +V] extends MapOps[K, V, Map, Map[K, V]]

trait MapOps[K, +V, +CC[_, _] <: IterableOps[_, AnyConstr, _], +C]
extends IterableOps[(K, V), Iterable, C] {
def view: MapView[K, V] = ???
}

trait View[+A] extends Iterable[A] with IterableOps[A, View, View[A]]

trait MapView[K, +V]
extends MapOps[K, V, ({ type l[X, Y] = View[(X, Y)] })#l, View[(K, V)]]
with View[(K, V)]

class MapDecorator[C, M <: HasMapOps[C]]

trait HasMapOps[C] {

/** The type of keys */
type K

/** The type of values */
type V

type A = (K, V)
}

object decorators {
def MapDecorator[C](coll: C)(implicit map: HasMapOps[C]): MapDecorator[C, map.type] = ???

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 } = ???
}