KT-14336 for to stdlib to takeWhile: propose conversion into takeWhile if break is located in else branch
#KT-14336 Fixed
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
// WITH_RUNTIME
|
||||
// INTENTION_TEXT: "Replace with 'takeWhile{}'"
|
||||
// IS_APPLICABLE_2: false
|
||||
fun foo(n: Int, list: List<Int>): List<Int>{
|
||||
val result = mutableListOf<Int>()
|
||||
<caret>for (i in list) {
|
||||
if (i < n)
|
||||
break
|
||||
else
|
||||
result.add(i)
|
||||
}
|
||||
return result
|
||||
}
|
||||
Reference in New Issue
Block a user