Files
kotlin-fork/compiler/testData/codegen/box/reified/copyToArray.kt
T
2020-11-09 16:04:43 +03:00

21 lines
486 B
Kotlin
Vendored

// DONT_TARGET_EXACT_BACKEND: WASM
// WASM_MUTE_REASON: STDLIB_GENERATED
// KJS_WITH_FULL_RUNTIME
// WITH_RUNTIME
import kotlin.test.assertEquals
inline fun <reified T> copy(c: Collection<T>): Array<T> {
return c.toTypedArray()
}
fun box(): String {
val a: Array<String> = copy(listOf("a", "b", "c"))
assertEquals("abc", a.joinToString(""))
val b: Array<Int> = copy(listOf(1,2,3))
assertEquals("123", b.map { it.toString() }.joinToString(""))
return "OK"
}