Files
kotlin/compiler/testData/codegen/bytecodeText/inlineClasses/interfaceJvmDefaultImplStubs.kt
Steven Schäfer 465e9f2d68 JVM IR: Always produce stubs for interface methods in inline classes
This matches the behavior of the JVM backend, with the exception of
@JvmDefault methods, which are currently broken on the JVM backend.
2020-02-28 14:48:17 +01:00

37 lines
742 B
Kotlin
Vendored

// !LANGUAGE: +InlineClasses
// IGNORE_BACKEND: JVM
// The JVM backend does not generate the g-impl method, but ends up calling it from box.
// !JVM_DEFAULT_MODE: enable
// JVM_TARGET: 1.8
// FILE: test.kt
fun box(): String {
val b = B(0)
return b.f() + b.g()
}
interface A {
fun f() = "O"
@JvmDefault
fun g() = "K"
}
inline class B(val x: Int) : A
// 1 public static f-impl\(I\)Ljava/lang/String;
// 1 public f\(\)Ljava/lang/String;
// 1 public static g-impl\(I\)Ljava/lang/String;
// 0 public g\(\)Ljava/lang/String;
// 1 INVOKESTATIC B.g-impl \(I\)Ljava/lang/String;
// JVM_TEMPLATES:
// 2 INVOKESTATIC B.f-impl \(I\)Ljava/lang/String;
// JVM_IR_TEMPLATES:
// 1 INVOKESTATIC B.f-impl \(I\)Ljava/lang/String;