Skip to content

Commit d5dfd16

Browse files
committed
Add test that demonstrate that #878 is fixed
It was fixed by 2460f96
1 parent 05bfe78 commit d5dfd16

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

tests/pos/i878.scala

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
class X
2+
3+
class Message[-A]
4+
class Seg[+A]
5+
class IChan[A] {
6+
def add[B >: A](x: Seg[B])(implicit ev: Message[B]): IChan[B] = ???
7+
}
8+
9+
class Test {
10+
def test: Unit = {
11+
implicit val mx: Message[X] = ???
12+
val fx: IChan[X] = ???
13+
val sx: Seg[X] = ???
14+
// the implicit `mx` should be used even though the type parameter of Message is contravariant
15+
fx.add(sx)
16+
}
17+
}

0 commit comments

Comments
 (0)