"Eliminate argument of 'when'": do not suggest if 'when' is used as expression and it has no 'else' branch (#2898)
#KT-35526 Fixed
This commit is contained in:
committed by
GitHub
parent
d965ad0a98
commit
8ba5548a0f
@@ -0,0 +1,11 @@
|
||||
enum class Type {
|
||||
HYDRO,
|
||||
PYRO
|
||||
}
|
||||
|
||||
fun select(t: Type) {
|
||||
<caret>when (t) {
|
||||
Type.HYDRO -> 1
|
||||
Type.PYRO -> 42
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
enum class Type {
|
||||
HYDRO,
|
||||
PYRO
|
||||
}
|
||||
|
||||
fun select(t: Type) {
|
||||
when {
|
||||
t == Type.HYDRO -> 1
|
||||
t == Type.PYRO -> 42
|
||||
}
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
// IS_APPLICABLE: false
|
||||
enum class Type {
|
||||
HYDRO,
|
||||
PYRO
|
||||
}
|
||||
|
||||
fun select(t: Type): Int {
|
||||
return <caret>when (t) {
|
||||
Type.HYDRO -> 1
|
||||
Type.PYRO -> 42
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user