Support references to local extensions in codegen
This commit is contained in:
@@ -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
|
||||
}
|
||||
Reference in New Issue
Block a user