Do not throw an exception when a when-statement with no else makes no match

This commit is contained in:
Andrey Breslav
2013-10-18 18:34:54 +04:00
parent aacf133ef6
commit ea2b6e4546
10 changed files with 111 additions and 2 deletions
@@ -0,0 +1,9 @@
fun box(): String {
var r = "OK"
val x = 3
val y: Unit = when (x) {
1 -> { r = "Fail 0" }
2 -> { r = "Fail 1" }
}
return r
}