Files
kotlin-fork/backend.native/tests/external/codegen/blackbox/vararg/kt581.kt
T
Ilya Matveev 1b553ebfaf backend/tests: Add blackbox tests from Kotlin JVM
Added tests from testData/codegen/box directory. There are blackbox tests
in other directories and they are to be added.
2017-01-20 14:04:04 +03:00

18 lines
475 B
Kotlin

package whats.the.difference
fun iarray(vararg a : Int) = a // BUG
val IntArray.indices: IntRange get() = IntRange(0, lastIndex())
fun IntArray.lastIndex() = size - 1
fun box() : String {
val vals = iarray(789, 678, 567, 456, 345, 234, 123, 12)
val diffs = HashSet<Int>()
for (i in vals.indices)
for (j in i..vals.lastIndex())
diffs.add(vals[i] - vals[j])
val size = diffs.size
if (size != 8) return "Fail $size"
return "OK"
}