mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-09 15:53:37 +00:00
37 lines
800 B
Kotlin
Vendored
37 lines
800 B
Kotlin
Vendored
// !LANGUAGE: +InlineClasses
|
|
// IGNORE_BACKEND_FIR: JVM_IR
|
|
// WITH_RUNTIME
|
|
// KJS_WITH_FULL_RUNTIME
|
|
|
|
fun box(): String {
|
|
testForInUIntArrayWithUpcactToAny()
|
|
testForInUIntArrayWithUpcactToComparable()
|
|
|
|
return "OK"
|
|
}
|
|
|
|
fun testForInUIntArrayWithUpcactToAny() {
|
|
var test = ""
|
|
for (x: Any in uintArrayOf(1u, 2u, 3u)) {
|
|
test = "$test$x;"
|
|
useUIntAsAny(x)
|
|
}
|
|
if (test != "1;2;3;") throw AssertionError(test)
|
|
}
|
|
|
|
fun testForInUIntArrayWithUpcactToComparable() {
|
|
var test = ""
|
|
for (x: Comparable<*> in uintArrayOf(1u, 2u, 3u)) {
|
|
test = "$test$x;"
|
|
useUIntAsComparable(x)
|
|
}
|
|
if (test != "1;2;3;") throw AssertionError(test)
|
|
}
|
|
|
|
fun useUIntAsAny(a: Any) {
|
|
a as UInt
|
|
}
|
|
|
|
fun useUIntAsComparable(a: Comparable<*>) {
|
|
a as Comparable<*>
|
|
} |