mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-10 08:31:29 +00:00
Generate switch instruction for 'when' with unsigned subject
This commit is contained in:
28
compiler/testData/codegen/bytecodeText/unsignedTypes/whenByUnsigned.kt
vendored
Normal file
28
compiler/testData/codegen/bytecodeText/unsignedTypes/whenByUnsigned.kt
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
// WITH_RUNTIME
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
|
||||
const val M1: UInt = 2147483648u
|
||||
|
||||
fun testUInt1(x: UInt) =
|
||||
when (x) {
|
||||
0u -> "none"
|
||||
1u -> "one"
|
||||
2u -> "two"
|
||||
3u -> "three"
|
||||
else -> "many"
|
||||
}
|
||||
|
||||
fun testUInt2(x: UInt) =
|
||||
when (x) {
|
||||
0u -> "none"
|
||||
1u -> "one"
|
||||
2u -> "two"
|
||||
3u -> "three"
|
||||
M1 -> "M1"
|
||||
else -> "many"
|
||||
}
|
||||
|
||||
// 2 SWITCH
|
||||
// ^ This captures both TABLESWITCH and LOOKUPSWITCH; we don't care about nuances of *SWITCH instruction generation here.
|
||||
|
||||
// 0 IF_ICMP
|
||||
Reference in New Issue
Block a user