mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-09 00:21:47 +00:00
Do not generate useless methods inside wrapper for inline class
Fix for test data (inlineFunctionInsideInlineClassesBox.kt) is needed to avoid check about "no inline functions". This check has two steps: first, names of inline functions from the metadata are loaded, then these names are checked that they are presented for physical methods in the classfile. Because now there are no physical methods in the classfile, we can't pass the second check, therefore this fix is needed. #KT-24872 Fixed
This commit is contained in:
@@ -12,7 +12,7 @@ inline class Foo(val x: Int) {
|
||||
}
|
||||
}
|
||||
|
||||
// 2 INVOKESTATIC Foo\$Erased.empty \(I\)V
|
||||
// 2 INVOKESTATIC Foo\$Erased.withParam \(ILjava/lang/String;\)V
|
||||
// 2 INVOKESTATIC Foo\$Erased.withInlineClassParam \(II\)V
|
||||
// 1 INVOKESTATIC Foo\$Erased.empty \(I\)V
|
||||
// 1 INVOKESTATIC Foo\$Erased.withParam \(ILjava/lang/String;\)V
|
||||
// 1 INVOKESTATIC Foo\$Erased.withInlineClassParam \(II\)V
|
||||
// 5 INVOKEVIRTUAL
|
||||
@@ -1,7 +1,7 @@
|
||||
// !LANGUAGE: +InlineClasses
|
||||
|
||||
inline class Foo(val x: Int) {
|
||||
inline fun inlineInc(): Foo = Foo(x + 1) // one actual call inside wrapper class Foo
|
||||
inline fun inlineInc(): Foo = Foo(x + 1)
|
||||
fun notInlineInc(): Foo = Foo(x + 1)
|
||||
|
||||
fun foo() {
|
||||
@@ -11,8 +11,8 @@ inline class Foo(val x: Int) {
|
||||
|
||||
fun test(f: Foo) {
|
||||
f.inlineInc().inlineInc().inlineInc()
|
||||
f.notInlineInc() // one here, one inside wrapper class Foo
|
||||
f.notInlineInc() // one here
|
||||
}
|
||||
|
||||
// 1 INVOKESTATIC Foo\$Erased.inlineInc
|
||||
// 2 INVOKESTATIC Foo\$Erased.notInlineInc
|
||||
// 0 INVOKESTATIC Foo\$Erased.inlineInc
|
||||
// 1 INVOKESTATIC Foo\$Erased.notInlineInc
|
||||
|
||||
Reference in New Issue
Block a user