JVM IR: More tests for inlining in $default stubs
This commit is contained in:
committed by
max-kammerer
parent
5e27d9b089
commit
111c550f3c
Vendored
+16
@@ -0,0 +1,16 @@
|
||||
inline fun test(p: String = "OK"): String {
|
||||
var x = 1
|
||||
return p
|
||||
}
|
||||
|
||||
fun box() : String {
|
||||
return test()
|
||||
}
|
||||
|
||||
// No $iv suffix on LVT entries in test and test$default
|
||||
// 2 LOCALVARIABLE p Ljava/lang/String;
|
||||
// 2 LOCALVARIABLE x I
|
||||
|
||||
// The $iv suffix should be present in box
|
||||
// 1 LOCALVARIABLE p\$iv Ljava/lang/String;
|
||||
// 1 LOCALVARIABLE x\$iv I
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
// 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
|
||||
Reference in New Issue
Block a user