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
@@ -42,10 +42,12 @@ class HistoryKeyListener(
UP, DOWN
}
override fun keyReleased(e: KeyEvent): Unit = when (e.keyCode) {
KeyEvent.VK_UP -> moveHistoryCursor(HistoryMove.UP)
KeyEvent.VK_DOWN -> moveHistoryCursor(HistoryMove.DOWN)
KeyEvent.VK_LEFT, KeyEvent.VK_RIGHT -> prevCaretOffset = consoleEditor.caretModel.offset
override fun keyReleased(e: KeyEvent) {
when (e.keyCode) {
KeyEvent.VK_UP -> moveHistoryCursor(HistoryMove.UP)
KeyEvent.VK_DOWN -> moveHistoryCursor(HistoryMove.DOWN)
KeyEvent.VK_LEFT, KeyEvent.VK_RIGHT -> prevCaretOffset = consoleEditor.caretModel.offset
}
}
private fun moveHistoryCursor(move: HistoryMove) {