Files
kotlin-fork/compiler/testData/codegen/box/casts/kt54707.kt
T
Alexander Udalov d7a58a7c6c Keep track of array types in OptimizationBasicInterpreter
Merging array types with different element types, for example
`[Lj/l/String;` and `[Lj/l/Object;`, now produces `[Lj/l/Object;`
(instead of `Lj/l/Object;`), which allows for more precise tracking of
null values because we assume that AALOAD on a non-array typed value is
possible only if that value is null.

 #KT-54802 Fixed
2022-11-07 17:22:38 +01:00

12 lines
292 B
Kotlin
Vendored

fun box(): String =
g(arrayOf("O"))
fun g(x: Array<String>?): String =
x.orEmpty0().f { it + "K" }
inline fun <T> Array<out T>.f(lambda: (T) -> T): T =
lambda(this[0])
inline fun <reified T> Array<out T>?.orEmpty0(): Array<out T> =
this ?: (arrayOfNulls<T>(0) as Array<T>)