Files
kotlin/compiler/testData/codegen/bytecodeText/stringOperations/stringBuilderToString.kt
Steven Schäfer ef34e4176f IR: Don't use IrStringConcatenation for ordinary toString calls
We can only use IrStrinConcatentation to represent calls to Any?.toString
and toString calls on primitive types. Otherwise, x.toString() and "$x"
are observably different when x is a non-null type with null value
(e.g., an @NotNull value coming from Java).
2020-03-27 14:58:04 +03:00

12 lines
248 B
Kotlin
Vendored

val chars = listOf('O', 'K')
fun box(): String {
val b = StringBuilder()
for (c in chars) {
b.append(c)
}
return b.toString()
}
// 0 INVOKESTATIC java/lang/String.valueOf
// 1 INVOKEVIRTUAL java/lang/StringBuilder.toString