blob: 771ab58ce88c4664f9d4e9e45f1a9b555d8542ef (
plain) (
tree)
|
|
class X
class Message[-A]
class Seg[+A]
class IChan[A] {
def add[B >: A](x: Seg[B])(implicit ev: Message[B]): IChan[B] = ???
}
class Test {
def test: Unit = {
implicit val mx: Message[X] = ???
val fx: IChan[X] = ???
val sx: Seg[X] = ???
// the implicit `mx` should be used even though the type parameter of Message is contravariant
fx.add(sx)
}
}
|