Files
kotlin-fork/compiler/testData/codegen/box/when/switchOptimizationMultipleMixedConditions.kt
T
Nikolay Lunyak bcfafc601e Add EnumEntries to minimal-stdlib-for-tests
This change allows to revert adding `WITH_STDLIB` directive
to tests which happened at `a9343aeb`.

Co-authored-by: Alexander Udalov <Alexander.Udalov@jetbrains.com>
2023-03-02 10:23:38 +00:00

21 lines
442 B
Kotlin
Vendored

private fun parse(text: String) = when (text) {
Numbers.One.name, "one", "1" -> 1
Numbers.Two.name, "two", "2" -> 2
else -> -1
}
enum class Numbers {
One,
Two,
}
fun box(): String {
val oneParsed = parse("one")
if (oneParsed != 1) return "'one' should map to '1' but was $oneParsed"
val OneParsed = parse("One")
if (OneParsed != 1) return "'One' should map to '1' but was $OneParsed"
return "OK"
}