"Replace 'when' with 'if'" intention: do not suggest if 'when' subject is variable declaration

#KT-35528 Fixed
This commit is contained in:
Toshiaki Kameyama
2019-12-19 09:22:47 +09:00
committed by Dmitry Gridin
parent 1cdcef3b08
commit 49e5f170d1
3 changed files with 20 additions and 4 deletions
@@ -0,0 +1,13 @@
// IS_APPLICABLE: false
enum class Type {
HYDRO,
PYRO
}
fun select(t: Type): Int {
return <caret>when (val i = t.ordinal) {
0 -> 1
1 -> 42
else -> i
}
}