abf70a586c
Being disabled by default and not well-documented, these functions cause confusion among early adopters as to why their code don't work properly. Assert APIs need a proper design across Kotlin platforms. Since APIs are not available in common code and K/JS, it is premature to have such a general feature in a new experimental platform. Compiler tests: * Mute tests that rely on assert. * Replace JVM-specific assert calls with require calls and unmute passed K/JS tests. Merge-request: KT-MR-8636 Merged-by: Svyatoslav Kuzmich <svyatoslav.kuzmich@jetbrains.com>
23 lines
715 B
Kotlin
Vendored
23 lines
715 B
Kotlin
Vendored
// WITH_STDLIB
|
|
|
|
inline fun<reified T1, reified T2> createArray(n: Int, crossinline block: () -> Pair<T1, T2>): Pair<Array<T1>, Array<T2>> {
|
|
return Pair(Array(n) { block().first }, Array(n) { block().second })
|
|
}
|
|
|
|
inline fun<T1, T2, T3, T4, T5, T6, reified R> recursive(
|
|
crossinline block: () -> R
|
|
): Pair<Array<R>, Array<R>> {
|
|
return createArray(5) { Pair(block(), block()) }
|
|
}
|
|
|
|
fun box(): String {
|
|
val y = createArray(5) { Pair(1, "test") }
|
|
val x = recursive<Int, Int, Int, Int, Int, Int, String>(){ "abc" }
|
|
|
|
require(y.first.all { it == 1 } )
|
|
require(y.second.all { it == "test" })
|
|
require(x.first.all { it == "abc" })
|
|
require(x.second.all { it == "abc" })
|
|
return "OK"
|
|
}
|