mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-08 15:53:19 +00:00
19 lines
354 B
Kotlin
Vendored
19 lines
354 B
Kotlin
Vendored
// FILE: 1.kt
|
|
package test
|
|
|
|
public inline fun <T> with2(receiver: T, body: T.() -> String) = receiver.body()
|
|
|
|
// FILE: 2.kt
|
|
import test.*
|
|
|
|
inline fun <T : Any> test(item: T?, defaultLink: T.() -> String): String {
|
|
return with2("") {
|
|
item?.defaultLink() ?: "fail"
|
|
}
|
|
}
|
|
|
|
fun box(): String {
|
|
return test("O") {
|
|
this + "K"
|
|
}
|
|
} |