Support 'call' for references to inline class members

This includes overriding and non-overriding functions and properties.

 #KT-26748
This commit is contained in:
Dmitry Petrov
2018-10-16 17:39:30 +03:00
parent 5003388d38
commit 94e1701089
13 changed files with 483 additions and 17 deletions
@@ -0,0 +1,39 @@
// IGNORE_BACKEND: JS_IR, JS, NATIVE, JVM_IR
// 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"
}