Files
kotlin-fork/idea/testData/intentions/loopToCallChain/sum/indexUsed2.kt.after
T
Valentin Kipyatkov d0f6e25783 sum and sumBy supported
2016-08-23 22:47:42 +03:00

12 lines
342 B
Plaintext
Vendored

// WITH_RUNTIME
// INTENTION_TEXT: "Replace with 'mapIndexed{}.sum()'"
// INTENTION_TEXT_2: "Replace with 'asSequence().mapIndexed{}.sum()'"
fun foo(list: List<Any>): Int {
val s = list
.mapIndexed { index, item -> getShort(index, item) }
.sum()
return s
}
fun getShort(index: Int, item: Any): Short = TODO()