Files
kotlin/compiler/testData/codegen/box/innerNested/protectedNestedClass.kt
Juan Chen 573188bdc4 [FIR2IR]: fix translation of this references in instance methods
Currently FirThisReceiverExpression of instance methods are translated
to references of the class' thisReceiver,
not the method's dispatch receiver,
which causes problems with IrFrameMap::typeOf,
as the class' thisReceiver is not in the typeMap.

This commit translates non-qualified "this" references of
instance methods to references of the methods' dispatch receiver.
2020-01-10 10:43:07 +03:00

26 lines
374 B
Kotlin
Vendored

// See KT-9246 IllegalAccessError when trying to access protected nested class from parent class
// FILE: a.kt
package a
abstract class A {
protected class C {
fun result() = "OK"
}
}
// FILE: b.kt
package b
import a.A
class B : A() {
protected val c = A.C()
val result: String get() = c.result()
}
fun box(): String {
return B().result
}