Files
kotlin-fork/compiler/testData/codegen/box/funInterface/funInterfaceWithReceiver.kt
T
2023-01-17 18:14:17 +00:00

22 lines
344 B
Kotlin
Vendored

fun interface FunWithReceiver {
fun String.foo(): String
}
val prop = FunWithReceiver { this }
fun bar(s: String, f: FunWithReceiver): String {
return with(f) {
s.foo()
}
}
fun box(): String {
val r1 = with(prop) {
"OK".foo()
}
if (r1 != "OK") return "failed 1"
return bar("O") { this + "K" }
}