Supported index++ pattern as non-last statement and even inside expressions

This commit is contained in:
Valentin Kipyatkov
2016-05-12 17:33:47 +03:00
parent 2c90114d28
commit ebdff775f3
22 changed files with 276 additions and 36 deletions
@@ -0,0 +1,11 @@
// WITH_RUNTIME
// INTENTION_TEXT: "Replace with 'filterNot{}.mapIndexed{}.firstOrNull{}'"
fun foo(list: List<String>): Int? {
var index = 0
<caret>for (s in list) {
if (s.isBlank()) continue
val x = s.length * ++index
if (x > 0) return x
}
return null
}