Files
kotlin-fork/compiler/testData/codegen/bytecodeText/defaultArguments/noAnonymousObjectRegenerationInDefaultStub.kt
T
2020-09-24 07:53:31 +02:00

20 lines
686 B
Kotlin
Vendored

// FILE: test.kt
inline fun <reified T> test(x: T, p: String = "OK"): T {
return object { fun f() = p as T }.f()
}
fun box() : String {
return test("Fail")
}
// The test and test$default methods use the *same* anonymous object
// 2 INVOKESPECIAL TestKt\$test\$1.<init> \(Ljava/lang/String;\)V
// The box method has to regenerate it to instantiate the reified type parameter,
// but the name of the regenerated object differs between the JVM and JVM IR backends.
// JVM_TEMPLATES:
// 1 INVOKESPECIAL TestKt\$box\$\$inlined\$test\$1.<init> \(Ljava/lang/String;\)V
// JVM_IR_TEMPLATES:
// 1 INVOKESPECIAL TestKt\$box\$\$inlined\$test\$default\$1.<init> \(Ljava/lang/String;\)V