blob: 046cea2e2ba682f76b36ad23ae5ce0c8ae77e09b [file]
// FULL_JDK
// WITH_STDLIB
// FILE: lib.kt
interface Foo {
val foos: List<Foo>
}
inline fun <reified T : Any> Sequence<*>.firstIsInstanceOrNull(): T? {
for (element in this) if (element is T) return element
return null
}
// FILE: main.kt
fun faultyLvt() {
sequenceOf<Foo>().firstIsInstanceOrNull<Foo>()?.foos.orEmpty()
listOf<Foo>().map { it }
}
fun box(): String {
faultyLvt()
return "OK"
}