Skip to content

Broken typecheck for covariant HKT #7648

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
DoSOfRedRiver opened this issue Nov 29, 2019 · 0 comments
Closed

Broken typecheck for covariant HKT #7648

DoSOfRedRiver opened this issue Nov 29, 2019 · 0 comments

Comments

@DoSOfRedRiver
Copy link

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.

@odersky odersky closed this as completed in 590f720 Dec 9, 2019
odersky added a commit that referenced this issue Dec 9, 2019
Fix #7648: Heal variances when comparing eta-expansions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants