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
{{ message }}
This repository has been archived by the owner on Nov 11, 2021. It is now read-only.
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.
The text was updated successfully, but these errors were encountered:
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.
The text was updated successfully, but these errors were encountered: