scala> class A; class B extends A
defined class A
defined class B
scala> val b = new B; val a: A = b
b: B = B@3358f363
a: A = B@3358f363
scala> List(a).contains(b)
res9: Boolean = true
scala> List(b).contains(a)
:16: warning: [ContainsTypeMismatch] List[B].contains(A) will probably return false, since the collection and target element are of unrelated types.
List(b).contains(a)
^
res10: Boolean = true
The warning shouldn't be raised because it's possible for a List of B to contain an element of type A which is a supertype (not subtype) of B- it's obvious that it does return true.
To demonstrate the problem:
The warning shouldn't be raised because it's possible for a List of B to contain an element of type A which is a supertype (not subtype) of B- it's obvious that it does return true.