Files
kotlin/compiler/testData/codegen/box/reflection/call/inlineClasses/overridingFunOfInlineClass.kt
Mads Ager e7835fecfc JVM_IR: fix a couple of inline class reflection issues.
1. Postpone the computation of the signature for property
   reference getters for extension properties until codegen time.

2. Generate metadata for static replacement functions instead
   of the original functions.
2020-01-03 16:38:53 +01:00

41 lines
1.0 KiB
Kotlin
Vendored

// IGNORE_BACKEND_FIR: JVM_IR
// IGNORE_BACKEND: JS_IR, JS, NATIVE
// WITH_REFLECT
import kotlin.test.assertEquals
interface ITest {
fun test(a: String, b: S): String
}
inline class Z(val x: Int) : ITest {
override fun test(a: String, b: S) = "$x$a${b.x}"
}
inline class L(val x: Long) : ITest {
override fun test(a: String, b: S) = "$x$a${b.x}"
}
inline class S(val x: String) : ITest {
override fun test(a: String, b: S) = "$x$a${b.x}"
}
inline class A(val x: Any) : ITest {
override fun test(a: String, b: S) = "$x$a${b.x}"
}
fun box(): String {
assertEquals("42-+", Z::test.call(Z(42), "-", S("+")))
assertEquals("42-+", Z(42)::test.call("-", S("+")))
assertEquals("42-+", L::test.call(L(42L), "-", S("+")))
assertEquals("42-+", L(42L)::test.call("-", S("+")))
assertEquals("42-+", S::test.call(S("42"), "-", S("+")))
assertEquals("42-+", S("42")::test.call("-", S("+")))
assertEquals("42-+", A::test.call(A("42"), "-", S("+")))
assertEquals("42-+", A("42")::test.call("-", S("+")))
return "OK"
}