Allow to import members from object by name

Wrap object members so they do not require dispatch receiver
Hack jvm backend to make it work
This commit is contained in:
Pavel V. Talanov
2015-10-02 16:01:09 +03:00
parent 507293e1ff
commit 37d5c4b223
22 changed files with 713 additions and 45 deletions
@@ -0,0 +1,30 @@
import O.p
import O.f
import C.Companion.p1
import C.Companion.f1
object O {
@JvmStatic
fun f(): Int = 3
@JvmStatic
val p: Int = 6
}
class C {
companion object {
@JvmStatic
fun f1(): Int = 3
@JvmStatic
val p1: Int = 6
}
}
fun box(): String {
if (p + f() != 9) return "fail"
if (p1 + f1() != 9) return "fail2"
return "OK"
}