Files
kotlin-fork/compiler/testData/codegen/box/callableReference/inlineArrayConstructors.kt
T
pyos 9f53d70109 JVM_IR: move ArrayConstructor below function reference phases
This allows taking function references to inline array constructors.

Also, redundant classes are no longer generated when function references
are passed as arguments to the array constructors.

 #KT-46426 Fixed
2021-05-06 18:25:53 +03:00

12 lines
325 B
Kotlin
Vendored

// WITH_RUNTIME
// IGNORE_BACKEND: JS_IR
fun createArray(ctor: (Int, (Int) -> Char) -> CharArray) =
ctor(1) { 'O' }
inline fun createArrayInline(ctor: (Int, (Int) -> Char) -> CharArray) =
ctor(1) { 'K' }
fun box(): String =
createArray(::CharArray)[0].toString() + createArrayInline(::CharArray)[0].toString()