Files
kotlin-fork/idea/testData/intentions/loopToCallChain/smartCasts/smartCastNotBroken2.kt
T
2016-08-23 22:47:42 +03:00

14 lines
448 B
Kotlin
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): Int? {
if (o is CharSequence) {
<caret>for (s in list) {
val a = s.length + (o as String).capitalize().hashCode()
val x = a * o.length
if (x > 1000) return x
}
return null
}
return 0
}