Perform bytecode optimisations for inline classes

#KT-23742 Fixed
This commit is contained in:
Mikhail Zarechenskiy
2018-06-15 15:36:47 +03:00
parent 7465289811
commit 01d9be65bc
16 changed files with 204 additions and 71 deletions
@@ -1,3 +1,5 @@
// !LANGUAGE: +InlineClasses
// https://youtrack.jetbrains.com/issue/KT-15871
// FILE: Test.kt
@@ -10,8 +12,20 @@ fun getAndCheckInt(a: Int, b: Int) =
// 0 Value
// 0 areEqual
// FILE: TestInlined.kt
fun getAndCheckInlinedInt(a: InlinedInt, b: InlinedInt) =
getAndCheck({ a }, { b })
// @TestInlinedKt.class:
// 0 valueOf
// 0 Value
// 0 areEqual
// 0 INVOKESTATIC InlinedInt\$Erased.box
// 0 INVOKEVIRTUAL InlinedInt.unbox
// FILE: Inline.kt
inline fun <T> getAndCheck(getFirst: () -> T, getSecond: () -> T) =
getFirst() == getSecond()
inline class InlinedInt(val x: Int)