mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-11 00:21:29 +00:00
16 lines
343 B
Kotlin
16 lines
343 B
Kotlin
import kotlin.test.assertEquals
|
|
|
|
inline fun foo(x: String, block: (String) -> String) = block(x)
|
|
fun noInlineFoo(x: String, block: (String) -> String) = block(x)
|
|
|
|
fun box(): String {
|
|
val res = foo("abc") {
|
|
fun bar(y: String) = y + "cde"
|
|
noInlineFoo(it) { bar(it) }
|
|
}
|
|
|
|
assertEquals("abccde", res)
|
|
|
|
return "OK"
|
|
}
|