class F[+T]
class I[T]
def f1[U](f: I[F[U]]) = f
def f2[U](f: I[F[_ <: U]]) = f1(f)
fails to compile with
no type parameters for method f1: (f: I[F[U]])I[F[U]] exist so that it can be applied to arguments (I[F[_ <: U]])
--- because ---
argument expression's type is not compatible with formal parameter type;
found : I[F[_ <: U]]
required: I[F[?U]]
Note: F[_ <: U] >: F[?U], but class I is invariant in type T.
You may wish to define T as -T instead. (SLS 4.5)
I expect this to work, since, in f2, F[U] = F[_ <: U] (as F[+_]), so I[F[_ <: U]] = I[F[U]], thus the type argument to f1 can be inferred as U. This also compiles under Dotty. Explicitly using f1[U](f) or f1(f: I[F[U]]) makes f2 compile, and so does removing the I wrapper from both functions.