Higher-order unification in general is undecidable, so the compiler has to limit it to a reasonable subset, in particular when checking List[Int] <:< F[A]
we end up checking if List <: F
and Int <: A
, and the first check doesn’t succeed, you can write def f[F[X <: Int] <: List[X], A <: Int](as: F[A]) = as
instead.
5 Likes