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,6 @@
// !LANGUAGE: +InlineClasses
// FILE: Test.kt
inline fun <R, T> foo(x : R, y : R, block : (R) -> T) : T {
val a = x is Number
@@ -17,7 +20,26 @@ fun bar() {
foo(1, 2) { x -> x is Int }
}
// @TestKt.class:
// 0 valueOf
// 0 Value\s\(\)
// 2 INSTANCEOF
// 1 CHECKCAST
// FILE: Inline.kt
inline class InlinedInt(val x: Int)
// FILE: TestInlined.kt
fun baz() {
foo(InlinedInt(1), InlinedInt(2)) { x -> x is InlinedInt }
}
// @TestInlinedKt.class:
// 0 valueOf
// 0 Value\s\(\)
// 0 INSTANCEOF
// 0 CHECKCAST
// 0 INVOKESTATIC InlinedInt\$Erased.box
// 0 INVOKEVIRTUAL InlinedInt.unbox