JS backend: fix access to class object members from containing class with implicit receiver.
#KT-4130 Fixed
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
package foo
|
||||
|
||||
open class A {
|
||||
val a = 3
|
||||
fun foo(): Int {
|
||||
return 5
|
||||
}
|
||||
class object: A() {
|
||||
val c = a
|
||||
}
|
||||
}
|
||||
|
||||
class B {
|
||||
class object: A() {
|
||||
}
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
if (A.a != 3) return "A.a != 3, it: ${A.a}"
|
||||
if (A.foo() != 5) return "A.foo() != 5, it: ${A.foo()}"
|
||||
|
||||
val a = A
|
||||
if (a.c != 3) return "a = A; a.c != 3, it: ${a.c}"
|
||||
|
||||
if (A().a != 3) return "A().a != 3, it: ${A().a}"
|
||||
|
||||
if (B.a != 3) return "B.a != 3, it: ${B.a}"
|
||||
val b = B
|
||||
if (b.foo() != 5) return "b = B; b.foo() != 5, it: ${b.foo()}"
|
||||
return "OK"
|
||||
}
|
||||
Reference in New Issue
Block a user