Answer to updated question
The problem lies with the definition of f. If you remove the call of f you get this error message:
type arguments [G] do not conform to trait GMC's type parameter bounds [A <: G with M[A]]
In other words, you can't use a bare G as a type parameter for GMC where the type constraint for GMC is G with M[A].
You need to constrain the type that f takes to match the definition of GMC:
def f[A <: G with M[A]](gmc: GMC[A]): Unit = ???
Previous answer
You need to specify the type parameter for T when you create the object:
object X extends T[A] {....}
If you make that change it will compile:
class A
trait T[A]
object X extends T[A] {}
def f(t: T[A]) = {}
f(X) // No error
Xconforms toT[A]what isA? Which type didXused when inheritingT? IsTcovariant, contravariant or invariant?Gwhere isM?fdoesn't compile-