Files
kotlin-fork/idea/testData/intentions/convertToForEachLoop/extraArguments.kt
T
Pradyoth Kukkapalli dbb28c571b New Intention Action: Replace a call to forEach function with for loop.
Replaces an expression of form x.forEach { … } with for (a in x) { … }.
2014-05-07 14:00:50 +04:00

11 lines
197 B
Kotlin

// IS_APPLICABLE: false
// WITH_RUNTIME
class Foo {
fun forEach(predicate: (Int) -> Int, bar: Int): Int = predicate(bar)
}
fun main() {
val x = Foo()
<caret>x.forEach({ it * 2 }, 2)
}