You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
traitFoo1[-X] { defbar[Y<:X](y: Y) = y } // typechecks// A variant of Foo1 encoding the type parameter Y using a dependent method type.// error: contravariant type X occurs in covariant position in type <: X of type YtraitFoo2[-X] { defbar(x: { typeY<:X })(y: x.Y) = y }
traitFoo3[+X] { defbar[Y>:X](y: Y) = y } // typechecks// A variant of Foo3 using a dependent method type.// error: covariant type X occurs in contravariant position in type >: X of type YtraitFoo4[+X] { defbar(x: { typeY>:X })(y: x.Y) = y }
The errors appear even if we don't use dependent method types.
// error: covariant type X occurs in contravariant position in type >: X of type YtraitFoo9[+X] { defbar(x: { typeY>:X }):Any }
The text was updated successfully, but these errors were encountered:
The errors appear even if we don't use dependent method types.
The text was updated successfully, but these errors were encountered: