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:
@@ -0,0 +1,16 @@
|
||||
// WITH_RUNTIME
|
||||
// INTENTION_TEXT: "Replace with 'map{}.map{}.firstOrNull{}'"
|
||||
// INTENTION_TEXT_2: "Replace with 'asSequence().map{}.map{}.firstOrNull{}'"
|
||||
fun foo(list: List<String>, o: Any) {
|
||||
if (o is CharSequence) {
|
||||
var result: Any? = null
|
||||
<caret>for (s in list) {
|
||||
val a = s.length + (o as String).capitalize().hashCode()
|
||||
val x = a * o.length
|
||||
if (x > 1000) {
|
||||
result = x
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user