Files
kotlin-fork/compiler/testData/codegen/bytecodeText/boxingOptimization/unsignedRangeIteratorSpecialization.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

40 lines
857 B
Kotlin
Vendored

// IGNORE_BACKEND_FIR: JVM_IR
// WITH_STDLIB
// IGNORE_BACKEND: JVM, JVM_IR
// ^ TODO support new mangling rules in optimizer
fun testUIntRangeForEach() {
var s = 0
(1u .. 5u).forEach {
s = s * 10 + it.toInt()
}
if (s != 12345) throw AssertionError("$s")
}
fun testUIntProgressionForEach() {
var s = 0
(5u downTo 1u).forEach {
s = s * 10 + it.toInt()
}
if (s != 54321) throw AssertionError("$s")
}
fun testULongRangeForEach() {
var s = 0
(1UL .. 5UL).forEach {
s = s * 10 + it.toInt()
}
if (s != 12345) throw AssertionError("$s")
}
fun testULongProgressionForEach() {
var s = 0
(5UL downTo 1UL).forEach {
s = s * 10 + it.toInt()
}
if (s != 54321) throw AssertionError("$s")
}
// 0 java/util/Iterator.next \(\)Ljava/lang/Object;
// 2 nextUInt
// 2 nextULong