JVM_IR KT-46408 properly map fake overrides in method handles

This commit is contained in:
Dmitry Petrov
2021-04-30 13:24:40 +03:00
committed by TeamCityServer
parent ef2c2c2c9e
commit 83e3a702c5
7 changed files with 82 additions and 2 deletions
@@ -0,0 +1,43 @@
// TARGET_BACKEND: JVM
// JVM_TARGET: 1.8
// SAM_CONVERSIONS: INDY
// FILE: kt46408.kt
open class User<IT : Identity> {
protected fun processIdentity(identity: IT) {
identity.ok = "OK"
}
}
class UserAc : User<AcIdentity>() {
fun doStuff(data: Container) {
data.processEachWith(this::processIdentity)
}
}
interface Identity {
var ok: String
}
class AcIdentity(override var ok: String) : Identity
class Container {
var id = AcIdentity("xxx")
fun processEachWith(action: Action<AcIdentity>) {
action.execute(id)
}
}
fun box(): String {
val c = Container()
UserAc().doStuff(c)
return c.id.ok
}
// FILE: Action.java
public interface Action<T> {
void execute(T var1);
}