Fix backend issue related to JvmStatic val with accessor
Do not treat accessors to JvmStatic properties as having dispatch receiver #KT-11585 Fixed
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
var result = "fail 1"
|
||||
object Foo {
|
||||
@JvmStatic
|
||||
private val a = "OK"
|
||||
|
||||
fun foo() = run { result = a }
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
Foo.foo()
|
||||
|
||||
return result
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
var result = "fail 2"
|
||||
class Foo {
|
||||
val b = { a }
|
||||
val c = Runnable { result = a }
|
||||
|
||||
companion object {
|
||||
@JvmStatic
|
||||
private val a = "OK"
|
||||
}
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
if (Foo().b() != "OK") return "fail 1"
|
||||
|
||||
Foo().c.run()
|
||||
|
||||
return result
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
var result = "fail 2"
|
||||
object Foo {
|
||||
@JvmStatic
|
||||
private val a = "OK"
|
||||
|
||||
val b = { a }
|
||||
val c = Runnable { result = a }
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
if (Foo.b() != "OK") return "fail 1"
|
||||
|
||||
Foo.c.run()
|
||||
|
||||
return result
|
||||
}
|
||||
Reference in New Issue
Block a user