Closed
Description
minimized code
trait Tc[F[_]]
type OfString[F[_]] = F[String]
def foo[F[_]](fs: F[String])(implicit F: Tc[F]): F[String] = ???
def bar[F[_]](fs: OfString[F]): F[String] = foo(fs)(new Tc[F] {})
Compilation output
-- [E007] Type Mismatch Error: Tc.scala:5:64 -----------------------------------
5 |def bar[F[_]](fs: OfString[F]): F[String] = foo(fs)(new Tc[F] {})
| ^
|Found: Object with Tc[F] {...}
|Required: Tc[F²]
|
|where: F is a type in method bar with bounds <: [_$4] => Any
| F² is a type variable with constraint >: [X0] => F[X0] | X0[String] and <: [_$3] => Any
1 error found
expectation
This compiles on Scala 2, and I ran into it while trying to cross-build cats-effect. I don't think it's the same variance issue as #7993, but I could be wrong about that?