- Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Description
This test case currently fails:
object Mapper { class MapTo[A, B](val f: A => B) inline def mapOne[X](x: X) = implicit match { case m: MapTo[X, y] => m.f(x) } inline def mapTuple[Xs <: Tuple](xs: Xs) <: Tuple = xs match { case xs: (x1 *: xs1) => implicit match { case m: MapTo[`x1`, y] => m.f(xs.head.asInstanceOf[x1]) *: mapTuple(xs.tail : xs1) } case () => () } } object Test extends App { import Mapper._ val xs = (1, "hello") locally { implicit val i1: MapTo[Int, Double] = new MapTo[Int, Double](_.toDouble) implicit val i2: MapTo[String, Boolean] = new MapTo[String, Boolean](_.length > 3) val r1 = mapOne[X = Int](1) val r2 = mapTuple(xs) } }
The problem is that in the type pattern MapTo[X, y]
of the implicit match case
case m: MapTo[X, y] => m.f(x)
the y
is bound to a GADT bound TypeRef
. But the implicit search only knows how to constrain TypeParamRefs
.
Hopefully, we get closer to a solution by identifying GADT bound and constrained variables.
Metadata
Metadata
Assignees
Labels
No labels