Closed allanrenucci closed 6 years ago
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
https://travis-ci.org/lampepfl/dotty-community-build/jobs/342277554