JVM IR: Mangle overridden symbols in non-inline functions (KT-52394)

This commit is contained in:
Steven Schäfer
2022-05-16 16:46:29 +02:00
committed by teamcity
parent 0fc676a20c
commit 90d09dce2c
10 changed files with 87 additions and 18 deletions
+30
View File
@@ -0,0 +1,30 @@
// WITH_REFLECT
// TARGET_BACKEND: JVM
import kotlin.reflect.full.declaredFunctions
annotation class Anno(val value: String)
@JvmInline
value class A(val value: String)
abstract class B {
@Anno(value = "K")
abstract fun f(): A?
}
class C : B() {
override fun f(): A? = A("O")
}
class D : B() {
override fun f(): Nothing? = null
}
fun box(): String {
val o = if ((D() as B).f() == null) (C() as B).f()!!.value else "Fail"
val annotations = B::class.declaredFunctions.single().annotations
val k = (annotations.single() as Anno).value
return o + k
}