c706673de9
- Merge `duplicatingItemsSameHashCode.kt` and
`duplicatingItemsSameHashCode2.kt` into one test enabled on both
backends, and rename it to
`duplicatingItemsSameHashCodeFewBranches.kt`.
- Rename `duplicatingItemsSameHashCode3.kt` to
`duplicatingItemsSameHashCodeMoreBranches.kt`, and also enable it for
both backends.
- Use JVM_TEMPLATES/JVM_IR_TEMPLATES to check backend-specific behavior:
1) JVM IR does not optimize less than 2 branches by design
2) JVM IR does not generate duplicate branches, also by design
Related to KT-36846.
21 lines
371 B
Kotlin
Vendored
21 lines
371 B
Kotlin
Vendored
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"
|
|
"uvw" -> return "uvw"
|
|
}
|
|
|
|
return "other"
|
|
}
|
|
|
|
// 1 LOOKUPSWITCH
|
|
|
|
// JVM_IR_TEMPLATES:
|
|
// 0 LDC "fail"
|