Files
kotlin-fork/compiler/testData/codegen/box/ranges/unsigned/nullableLoopParameter/rangeExpression.kt
T
2020-05-20 07:19:30 +03:00

21 lines
517 B
Kotlin
Vendored

// IGNORE_BACKEND: JVM
// IGNORE_BACKEND_FIR: JVM_IR
// See KT-38833: Runtime exception is "java.lang.ClassCastException: java.lang.Integer cannot be cast to kotlin.UInt"
// IGNORE_BACKEND: JVM_IR
// IGNORE_LIGHT_ANALYSIS
// WITH_RUNTIME
// KJS_WITH_FULL_RUNTIME
fun box(): String {
var result = 0u
val uIntRange = 1u..3u
for (i: UInt? in uIntRange) {
result = sum(result, i)
}
return if (result == 6u) "OK" else "fail: $result"
}
fun sum(i: UInt, z: UInt?): UInt {
return i + z!!
}