Support generic array creation for reified inlined

This commit is contained in:
Denis Zharkov
2014-10-02 15:10:39 +04:00
committed by Andrey Breslav
parent 060c30746f
commit 4a66ab3627
9 changed files with 281 additions and 9 deletions
@@ -0,0 +1,13 @@
import kotlin.InlineOption.*
inline fun<reified T> createArray(n: Int, inlineOptions(ONLY_LOCAL_RETURN) block: () -> T): Array<T> {
return Array<T>(n) { block() }
}
fun box(): String {
val x = createArray<Int>(5) { 3 }
assert(x.all { it == 3 })
return "OK"
}