Files
kotlin/compiler/testData/codegen/bytecodeText/whenStringOptimization/duplicatingItemsSameHashCode.kt
Denis Zharkov d4cb822ee8 When by String constants:
Generate TABLESWITCH/LOOKUPSWITCH bytecode operation for when operator by String constants
2014-07-21 17:13:56 +04:00

17 lines
303 B
Kotlin

import kotlin.test.assertEquals
fun foo(x : String) : String {
assert("abz]".hashCode() == "aby|".hashCode())
when (x) {
"abz]" -> return "abz"
"ghi" -> return "ghi"
"aby|" -> return "aby"
"abz]" -> return "fail"
}
return "other"
}
// 1 LOOKUPSWITCH