Add tests for nullable loop variable in for-loop over unsigned progression.
This commit is contained in:
committed by
Alexander Udalov
parent
b85da8411d
commit
b5b361bb09
Vendored
+18
@@ -0,0 +1,18 @@
|
||||
// IGNORE_BACKEND: JVM
|
||||
// See KT-38833: Runtime exception is "java.lang.ClassCastException: java.lang.Integer cannot be cast to kotlin.UInt"
|
||||
|
||||
// WITH_RUNTIME
|
||||
// KJS_WITH_FULL_RUNTIME
|
||||
|
||||
fun box(): String {
|
||||
var result = 0u
|
||||
val uIntRange: UIntProgression = 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!!
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
// IGNORE_BACKEND: JVM
|
||||
// See KT-38833: Runtime exception is "java.lang.ClassCastException: java.lang.Integer cannot be cast to kotlin.UInt"
|
||||
|
||||
// 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!!
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
// IGNORE_BACKEND: JVM
|
||||
// See KT-38833: Runtime exception is "java.lang.ClassCastException: java.lang.Integer cannot be cast to kotlin.UInt"
|
||||
|
||||
// WITH_RUNTIME
|
||||
// KJS_WITH_FULL_RUNTIME
|
||||
|
||||
fun box(): String {
|
||||
var result = 0u
|
||||
for (i: UInt? in 1u..3u) {
|
||||
result = sum(result, i)
|
||||
}
|
||||
return if (result == 6u) "OK" else "fail: $result"
|
||||
}
|
||||
|
||||
fun sum(i: UInt, z: UInt?): UInt {
|
||||
return i + z!!
|
||||
}
|
||||
Reference in New Issue
Block a user