Support for property reference inlining

This commit is contained in:
Michael Bogdanov
2016-08-18 13:59:03 +03:00
parent 237afb4b7c
commit 7230965e62
18 changed files with 338 additions and 47 deletions
@@ -0,0 +1,17 @@
// FILE: 1.kt
package test
class Foo(val a: String)
inline fun test(s: () -> String): String {
return s()
}
// FILE: 2.kt
import test.*
fun box(): String {
return test(Foo("OK")::a)
}
@@ -0,0 +1,19 @@
// FILE: 1.kt
package test
object Foo {
val a: String = "OK"
}
inline fun test(s: () -> String): String {
return s()
}
// FILE: 2.kt
import test.*
fun box(): String {
return test(Foo::a)
}
@@ -0,0 +1,20 @@
// FILE: 1.kt
package test
object Foo {
val a: String = "OK"
}
inline fun test(s: () -> String): String {
return s()
}
// FILE: 2.kt
import test.Foo.a
import test.test
fun box(): String {
return test(::a)
}
@@ -0,0 +1,20 @@
// FILE: 1.kt
package test
class Foo(val z: String)
val Foo.a: String
get() = z
inline fun test(s: () -> String): String {
return s()
}
// FILE: 2.kt
import test.*
fun box(): String {
return test(Foo("OK")::a)
}