Generate specialized 'toString' for inline classes when possible
#KT-25613
This commit is contained in:
+17
@@ -0,0 +1,17 @@
|
||||
// !LANGUAGE: +InlineClasses
|
||||
|
||||
// FILE: Z.kt
|
||||
inline class Z(val value: Int)
|
||||
|
||||
// FILE: test.kt
|
||||
data class Data(val z1: Z, val z2: Z)
|
||||
|
||||
inline class Inline(val z: Z)
|
||||
|
||||
// @Data.class:
|
||||
// 0 Z.box
|
||||
// 0 Z.unbox
|
||||
|
||||
// @Inline.class:
|
||||
// 0 Z.box
|
||||
// 0 Z.unbox
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
// !LANGUAGE: +InlineClasses
|
||||
|
||||
// FILE: Z.kt
|
||||
inline class Z(val value: Int)
|
||||
|
||||
// FILE: test.kt
|
||||
fun test1_1(z: Z) = "$z"
|
||||
fun test1_2(z: Z) = "$z$z"
|
||||
fun test1_many(z: Z) = "$z $z $z"
|
||||
fun test1_concat1(z: Z) = "-" + z
|
||||
fun test1_concat2(z: Z) = "$z" + z
|
||||
fun test1_concat3(z: Z) = "-" + z + z
|
||||
|
||||
fun test2_1(z: Z?) = "$z"
|
||||
fun test2_2(z: Z?) = "$z$z"
|
||||
fun test2_many(z: Z?) = "$z $z $z"
|
||||
fun test2_concat1(z: Z?) = "-" + z
|
||||
fun test2_concat2(z: Z?) = "$z" + z
|
||||
fun test2_concat3(z: Z?) = "-" + z + z
|
||||
|
||||
// @TestKt.class:
|
||||
// 0 box
|
||||
// 0 unbox
|
||||
+1
-1
@@ -34,4 +34,4 @@ fun test() {
|
||||
// 0 INVOKESTATIC Result.box-impl
|
||||
// 0 INVOKESTATIC Result.unbox-impl
|
||||
// 0 Result\$Failure
|
||||
// 53 Result
|
||||
// 52 Result
|
||||
Reference in New Issue
Block a user