Skip to content

Broken typecheck for covariant HKT #7648

@DoSOfRedRiver

Description

@DoSOfRedRiver

minimized code

In Scala 2 following code works just fine:

  class IO[+A]

  trait Functor[F[_]]
  trait Monad[F[_]] extends Functor[F]

  class Stream[+F[_], +A] {
    def take[F1[x] >: F[x]](n: Int)(implicit f: Functor[F1]): Stream[F1, A] = {
      this
    }
  }

  implicit val ioMonad: Monad[IO] = null

  new Stream[IO, Int].take[IO](10)

However, the same code in Dotty results in:
Type argument mains.Test.IO does not conform to lower bound my.package.IO

expectation

Expect the same behavior as in Scala 2.

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