KT-53957 Fix indy lambdas with extension and context receivers (#5021)

This commit is contained in:
mcpiroman
2022-12-16 17:47:58 +01:00
committed by GitHub
parent b6682d1789
commit a244aaf162
4 changed files with 43 additions and 1 deletions
@@ -0,0 +1,24 @@
// !LANGUAGE: +ContextReceivers
// TARGET_BACKEND: JVM_IR
// JVM_TARGET: 1.8
// LAMBDAS: INDY
class Ctx {
val k = "__K__"
}
class Scope {
val o = "O"
}
fun accept(block: context(Ctx) Scope.(Int) -> String) = 1
fun accept(ref: Any) = 1
val foo: context(Ctx) Scope.(fooParam: Int) -> String = { fooArg -> o + k[fooArg] }
fun box(): String {
accept(foo)
accept(::foo)
return foo(Ctx(), Scope(), 2)
}