sum and sumBy supported

This commit is contained in:
Valentin Kipyatkov
2016-08-18 20:19:35 +03:00
parent 7c92f7974f
commit d0f6e25783
40 changed files with 682 additions and 6 deletions
@@ -0,0 +1,10 @@
// WITH_RUNTIME
// INTENTION_TEXT: "Replace with 'mapIndexed{}.sum()'"
// INTENTION_TEXT_2: "Replace with 'asSequence().mapIndexed{}.sum()'"
fun foo(list: List<Int>): Int {
val <caret>s = list
.asSequence()
.mapIndexed { index, item -> item * index }
.sum()
return s
}