import kotlin.InlineOption.* inline fun createArray(n: Int, inlineOptions(ONLY_LOCAL_RETURN) block: () -> Pair): Pair, Array> { return Pair(Array(n) { block().first }, Array(n) { block().second }) } inline fun recursive( inlineOptions(ONLY_LOCAL_RETURN) 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" }