-
Notifications
You must be signed in to change notification settings - Fork 21
Open
Labels
fixed in Scala 3This issue does not exist in the Scala 3 compiler (https://github.com/lampepfl/dotty/)This issue does not exist in the Scala 3 compiler (https://github.com/lampepfl/dotty/)implicit
Milestone
Description
Example:
trait Tc1[A]
trait Tc2[A]
trait Tc12[A] extends Tc1[A] with Tc2[A]
trait Proxy[F[x]]
object Proxy {
implicit val proxy: Proxy[Tc12] = new Proxy[Tc12] {}
}
final case class X()
object X {
implicit def tc12[F[x] >: Tc12[x]: Proxy]: F[X] = new Tc12[X] {}
}
object app extends App {
implicitly[Tc1[X]]
implicitly[Tc2[X]]
implicitly[Tc12[X]]
// all good
implicitly[Tc1[X] with Tc2[X]]
// Error:(19, 13) could not find implicit value for parameter e: Tc1[X] with Tc2[X]
// implicitly[Tc1[X] with Tc2[X]]
}Note, changing the return type of X's instance to F[X] with F[X] or applying an identity type lambda magically works around the issue, even though both transformations are tautological:
implicit def tc12[F[x] >: Tc12[x]: Proxy]: F[X] with F[X] = new Tc12[X] {}type Fixup[A] = A
implicit def tc12[F[x] >: Tc12[x]: Proxy]: Fixup[F[X]] = new Tc12[X] {}Metadata
Metadata
Assignees
Labels
fixed in Scala 3This issue does not exist in the Scala 3 compiler (https://github.com/lampepfl/dotty/)This issue does not exist in the Scala 3 compiler (https://github.com/lampepfl/dotty/)implicit