Files
kotlin/compiler/testData/codegen/box/when/stringOptimization/duplicatingItems.kt
2016-11-16 19:50:10 +03:00

22 lines
409 B
Kotlin
Vendored

// WITH_RUNTIME
import kotlin.test.assertEquals
fun foo(x : String) : String {
when (x) {
"abc" -> return "abc"
"efg", "ghi", "abc" -> return "efg_ghi"
else -> return "other"
}
}
fun box() : String {
assertEquals("abc", foo("abc"))
assertEquals("efg_ghi", foo("efg"))
assertEquals("efg_ghi", foo("ghi"))
assertEquals("other", foo("xyz"))
return "OK"
}