mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-08 08:31:26 +00:00
22 lines
524 B
Kotlin
Vendored
22 lines
524 B
Kotlin
Vendored
// TODO: muted automatically, investigate should it be ran for JS or not
|
|
// IGNORE_BACKEND: JS
|
|
|
|
// WITH_RUNTIME
|
|
|
|
inline fun<reified T> createArray(n: Int, crossinline block: () -> T): Array<T> {
|
|
return Array<T>(n) { block() }
|
|
}
|
|
|
|
inline fun<T1, T2, T3, T4, T5, T6, reified R> recursive(
|
|
crossinline block: () -> R
|
|
): Array<R> {
|
|
return createArray(5) { block() }
|
|
}
|
|
|
|
fun box(): String {
|
|
val x = recursive<Int, Int, Int, Int, Int, Int, String>(){ "abc" }
|
|
|
|
assert(x.all { it == "abc" })
|
|
return "OK"
|
|
}
|