Skip to content

Indirect covariant comparison involving a higher-kinded type argument failsΒ #469

@neko-kai

Description

@neko-kai

From zio/zio#8215

trait Container[T] {
  def getT(): T
}

trait Service[+O[_] <: Container[_]] {
  def giveHello: String
}

final case class AContainer[T](t: T) extends Container[T] {
  override def getT() = t
} 

final case class MyConcreteService() extends Service[AContainer] {
  def giveHello = "Concrete hello!"
}

object Example extends App {

  implicitly[MyConcreteService <:< Service[Container]] // true

  val left = izumi.reflect.Tag[MyConcreteService]
  val right = izumi.reflect.Tag[Service[Container]]

  println(left <:< right) // false
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions