Files
kotlin-fork/idea/testData/intentions/loopToCallChain/smartCasts/smartCastNotBroken4.kt.after2
T

13 lines
464 B
Plaintext
Vendored

// WITH_RUNTIME
// INTENTION_TEXT: "Replace with 'map{}.map{}.firstOrNull{}'"
// INTENTION_TEXT_2: "Replace with 'asSequence().map{}.map{}.firstOrNull{}'"
fun foo(list: List<String>, o: Any) {
var result: Any? = ""
if (o is CharSequence) {
result = list
.asSequence()
.map { it.length + (o as String).capitalize().hashCode() }
.map { it * o.length }
.firstOrNull { it > 1000 }
}
}