Files
kotlin-fork/compiler/testData/codegen/box/ranges/multiAssignmentIterationOverIntRange.kt
T
Ivan Kylchik c7435ba760 Replace all occurrences of WITH_RUNTIME with WITH_STDLIB
We are going to deprecate `WITH_RUNTIME` directive. The main reason
behind this change is that `WITH_STDLIB` directive better describes
its meaning, specifically it will add kotlin stdlib to test's classpath.
2021-11-17 15:26:38 +03:00

24 lines
546 B
Kotlin
Vendored

// WITH_STDLIB
operator fun Int.component1(): String {
return arrayListOf("zero", "one", "two", "three")[this]
}
operator fun Int.component2(): Int {
return arrayListOf(0, 1, 4, 9)[this]
}
fun box(): String {
val strings = arrayListOf<String>()
val squares = arrayListOf<Int>()
for ((str, sq) in 1..3) {
strings.add(str)
squares.add(sq)
}
if (strings != arrayListOf("one", "two", "three")) return "FAIL: $strings"
if (squares != arrayListOf(1, 4, 9)) return "FAIL: $squares"
return "OK"
}