Files
kotlin-fork/compiler/testData/codegen/box/syntheticAccessors/kt48331.kt
T
pyos 7ce5556de3 JVM_IR: try to fix SyntheticAccessorLowering.isAccessible again
The condition on the relationship between the current class and the type
of the receiver for protected members was the opposite of what the JVMS
says, and yet somehow mostly worked?

 #KT-48331 Fixed
 #KT-20542 Fixed
2021-09-03 15:54:16 +03:00

26 lines
461 B
Kotlin
Vendored

// TARGET_BACKEND: JVM
// FILE: foo.kt
package foo
abstract class Base {
protected abstract fun foo(): String
}
// FILE: bar.kt
import foo.*
abstract class C : Base() {
class A : C() {
override fun foo() = "OK"
}
class B(val x: C) : C() {
// Needs an accessor (`foo` is in another package and `x` is not assignable to `B`)
override fun foo() = x.foo()
fun bar() = foo()
}
}
fun box() = C.B(C.A()).bar()