Files
kotlin-fork/compiler/testData/codegen/box/jvm8/defaults/inlineProperty.kt
T
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

31 lines
500 B
Kotlin
Vendored

// !JVM_DEFAULT_MODE: enable
// TARGET_BACKEND: JVM
// JVM_TARGET: 1.8
// WITH_RUNTIME
interface Test {
@JvmDefault
fun test(): String {
return inlineProp
}
fun testDefaultImpls(): String {
return inlineProp
}
@JvmDefault
private inline val inlineProp: String
get() = "OK"
}
class TestClass : Test {
}
fun box(): String {
val foo = TestClass()
if (foo.test() != "OK") return "fail: ${foo.test()}"
return foo.testDefaultImpls()
}