Files
kotlin-fork/compiler/testData/codegen/box/funInterface/funInterfaceWithReceiver.kt
T
Mikhail Zarechenskiy 780bc1f607 Fix fun interfaces with extension receivers
#KT-37712 Fixed
2020-04-29 14:15:25 +03:00

25 lines
400 B
Kotlin
Vendored

// IGNORE_BACKEND_FIR: JVM_IR
// IGNORE_BACKEND: JS_IR
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" }
}