count() to merge with filterNotNull and filterIsInstance + changed test for KT-14191 to use sum()

This commit is contained in:
Valentin Kipyatkov
2016-10-14 16:47:39 +03:00
parent afd25548a2
commit b28d016709
17 changed files with 177 additions and 60 deletions
+12
View File
@@ -0,0 +1,12 @@
// WITH_RUNTIME
// INTENTION_TEXT: "Replace with 'filterNotNull().sum()'"
// INTENTION_TEXT_2: "Replace with 'asSequence().filterNotNull().sum()'"
fun f(list: List<Int?>): Int{
var r = 0
<caret>for (d in list) {
if (d != null) {
r += d
}
}
return r
}