Files
kotlin-fork/compiler/testData/diagnostics/testsWithStdLib/cast/AsInsideIn.kt
T
2015-12-15 12:02:33 +03:00

20 lines
465 B
Kotlin
Vendored

// See also KT-10386
interface A
class B : A
fun foo1(list: List<A>, arg: B?): Boolean {
// contains(T): Boolean is deprecated
return arg <!DEPRECATION!>in<!> list
}
fun foo2(list: List<A>, arg: B?): Boolean {
// FAKE: no cast needed
return arg as A? in list
}
fun foo3(list: List<A>, arg: B?): Boolean {
// No warning but KNPE risk
return arg!! in list
}
// But
fun foo4(list: List<A>, arg: B): Boolean {
// Ok
return arg in list
}