KT-10139:

Non-exhaustive 'when' without 'else' used in expression is an error
regardless of expected type: it can't be an expression, even of type Unit.
This commit is contained in:
Dmitry Petrov
2015-11-27 18:35:02 +03:00
parent 1a3a296827
commit 76931affc6
12 changed files with 38 additions and 80 deletions
@@ -1,5 +1,5 @@
fun foo(x: Int) {
val y: Unit = when (x) {
val y: Unit = <!NO_ELSE_IN_WHEN!>when<!> (x) {
2 -> {}
3 -> {}
}
@@ -1,5 +1,5 @@
fun foo(x: Int) {
return when (x) {
return <!NO_ELSE_IN_WHEN!>when<!> (x) {
2 -> {}
3 -> {}
}