// TODO: muted automatically, investigate should it be ran for JS or not // IGNORE_BACKEND: JS // WITH_RUNTIME inline fun createArray(n: Int, crossinline block: () -> Pair): Pair, Array> { return Pair(Array(n) { block().first }, Array(n) { block().second }) } inline fun recursive( crossinline block: () -> R ): Pair, Array> { return createArray(5) { Pair(block(), block()) } } fun box(): String { val y = createArray(5) { Pair(1, "test") } val x = recursive(){ "abc" } assert(y.first.all { it == 1 } ) assert(y.second.all { it == "test" }) assert(x.first.all { it == "abc" }) assert(x.second.all { it == "abc" }) return "OK" }