scala / scala3

The Scala 3 compiler, also known as Dotty.
https://dotty.epfl.ch
Apache License 2.0
5.8k stars 1.04k forks source link

Regression in Community Build: ScalaCheck #4032

Closed allanrenucci closed 6 years ago

allanrenucci commented 6 years ago

https://travis-ci.org/lampepfl/dotty-community-build/jobs/342277554

allanrenucci commented 6 years ago

3981 introduced the regression. Here is a minimised reproduction:

import scala.concurrent.Future

class Gen[+T] {
  def map[U](f: T => U): Gen[U] = ???
}

object Gen {
  def oneOf[T](t0: T, t1: T): Gen[T] = ??? // Compile with this line commented
  def oneOf[T](g0: Gen[T], g1: Gen[T]): Gen[T] = ???
}

class Arbitrary[T]

object Arbitrary {
  def arbitrary[T]: Gen[T] = ???

  def arbFuture[T]: Gen[Future[T]] =
    Gen.oneOf(arbitrary[Future[T]], arbitrary[Throwable].map(Future.failed))
}
-- [E007] Type Mismatch Error: tests/allan/Test.scala:53:60 --------------------
53 |    Gen.oneOf(arbitrary[Future[T]], arbitrary[Throwable].map(Future.failed))
   |                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |                             found:    Gen[scala.concurrent.Future[Any]]
   |                             required: Gen[concurrent.Future[T]]
   |                             
one error found