KT-14294 for to stdlib to firstOrNull/lastOrNull: intention is absent if there is additional var before for loop

#KT-14294 Fixed
This commit is contained in:
Valentin Kipyatkov
2016-10-14 21:43:47 +03:00
parent a89ef54578
commit eae23b548f
20 changed files with 287 additions and 18 deletions
@@ -0,0 +1,14 @@
// WITH_RUNTIME
// INTENTION_TEXT: "Replace with 'map{}.map{}.filterTo(){}'"
// INTENTION_TEXT_2: "Replace with 'asSequence().map{}.map{}.filterTo(){}'"
fun foo(list: List<String>, o: Any, result: MutableCollection<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) {
result.add(x)
}
}
}
}