Open
Description
reproduction steps
using Scala 2.13.3,
import scala.language.implicitConversions
trait Thing[O]
class Something[O] extends Thing[O]
trait Project[M] {
type Projection[O] <: Thing[O]
}
type Aux[X, Y[O] <: Thing[O]] = Project[X] { type Projection[O] = Y[O] }
implicit def projectThing[T[X] <: Thing[X], O]: Project[T[O]] { type Projection[X] = T[X] } = ???
implicit def project1[T <: Thing[_]](thing: T)(implicit projection: Project[T]): projection.Projection["xD"] = ???
implicit def project2[T <: Thing[_], P[O] <: Thing[O]]
(thing: T)(implicit projection: Aux[T, P]): P["xD"] = ???
implicit def project3[T <: Thing[_]](thing: T)(implicit projection: Project[T] { type Projection[O] <: Something[O] }): projection.Projection["xD"] = ???
def something = new Something[Any]
def p1 = project1(something)
def p2 = project2(something)
def p3 = project3(something)
p1: Nothing //correct, Something["xD"]
p2: Nothing //type lost: this.Projection["xD"]
p3: Nothing //correct, Something["xD"]
problem
I would expect all three projections to result in Something["xD"]
. This is of course very problematic in dependent implicits which can't use a member type of one implicit parameter as part of a type of another implicit parameter.