aboutsummaryrefslogblamecommitdiff
path: root/tests/pos/i878.scala
blob: 771ab58ce88c4664f9d4e9e45f1a9b555d8542ef (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
















                                                                                                  
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)
  }
}