Codegen: fix callable reference to member imported from object
This commit is contained in:
Vendored
+17
@@ -0,0 +1,17 @@
|
||||
import A.foo
|
||||
import A.bar
|
||||
|
||||
object A {
|
||||
fun foo() = "O"
|
||||
fun String.foo() = "K"
|
||||
|
||||
@JvmStatic
|
||||
fun bar(s: Int) = "OK"
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
val static = (::bar)(0)
|
||||
if (static != "OK") return "1"
|
||||
|
||||
return (::foo)() + (String::foo)("")
|
||||
}
|
||||
Vendored
+33
@@ -0,0 +1,33 @@
|
||||
import A.foo
|
||||
import A.bar
|
||||
import A.baz
|
||||
|
||||
object A {
|
||||
var foo = "NotOk"
|
||||
var String.foo: String
|
||||
get() = "K"
|
||||
set(i) {}
|
||||
|
||||
@JvmStatic
|
||||
val bar: String = "OK"
|
||||
|
||||
@JvmStatic
|
||||
val String.baz: String
|
||||
get() = "OK"
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
|
||||
val static = (::bar).get()
|
||||
if (static != "OK") return static
|
||||
|
||||
val staticExt = (String::baz).get("a")
|
||||
if (staticExt != "OK") return staticExt
|
||||
|
||||
val nonExt = ::foo
|
||||
|
||||
nonExt.set("O")
|
||||
val ext = String::foo
|
||||
ext.set("", "Whatever")
|
||||
return nonExt.get() + ext.get("")
|
||||
}
|
||||
Reference in New Issue
Block a user