Support references to local extensions in codegen

This commit is contained in:
Alexander Udalov
2013-12-19 19:08:19 +04:00
parent d3a811aa7e
commit 571adf3acc
6 changed files with 56 additions and 5 deletions
@@ -0,0 +1,6 @@
class A
fun box(): String {
fun A.foo() = "OK"
return A().(A::foo)()
}
@@ -0,0 +1,5 @@
fun box(): String {
class A
fun A.foo() = "OK"
return (::A)().(A::foo)()
}
@@ -0,0 +1,4 @@
fun box(): String {
fun Int.is42With(that: Int) = this + 2 * that == 42
return if (16.(Int::is42With)(13)) "OK" else "Fail"
}
@@ -0,0 +1,11 @@
class A
fun box(): String {
var result = "Fail"
fun A.ext() { result = "OK" }
val f = A::ext
A().f()
return result
}