Files
kotlin-fork/compiler/testData/codegen/box/jvm8/defaults/inline.kt
T
Mark Punzalan 1abdf0561a Generate synthetic functions for local functions with default values, by
re-ordering the lowering phases.

The changes in InterfaceLowering are necessary so that IrElements that
target the removed functions are re-targeted to the new functions in
DefaultImpls. This affects local functions in interface functions since
now LocalDeclarationsLowering comes before InterfaceLowering.
2019-07-01 13:24:08 +02:00

29 lines
463 B
Kotlin
Vendored

// !JVM_DEFAULT_MODE: enable
// TARGET_BACKEND: JVM
// JVM_TARGET: 1.8
// WITH_RUNTIME
interface Test {
@JvmDefault
fun test(): String {
return inlineFun { "O" }
}
fun testDefaultImpls(): String {
return inlineFun { "K" }
}
@JvmDefault
private inline fun inlineFun(s: () -> String) = s()
}
class TestClass : Test {
}
fun box(): String {
val foo = TestClass()
return foo.test() + foo.testDefaultImpls()
}