Files
kotlin-fork/compiler/testData/diagnostics/testsWithStdLib/cast/AsInsideIn.fir.kt
T
Denis.Zharkov 2ecba6ac39 Remove WITH_NEW_INFERENCE directive from all tests
This directive anyway does not make test run twice with OI, and with NI
It only once run the test with specific settings (// LANGUAGE)
and ignores irrelevant (OI or NI tags)
2021-05-25 13:28:26 +03:00

20 lines
450 B
Kotlin
Vendored

// See also KT-10386
interface A
class B : A
fun foo1(list: List<A>, arg: B?): Boolean {
// Type mismatch
return arg in list // resolved to extension
}
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
}