Implement "Merge when" intention
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
when (n) {
|
||||
1 -> {
|
||||
res = "one"
|
||||
println("A")
|
||||
}
|
||||
2 -> {
|
||||
res = "two"
|
||||
println("B")
|
||||
}
|
||||
else -> {
|
||||
res = "unknown"
|
||||
println("C")
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
when (n) {
|
||||
1 -> res = "one"
|
||||
2 -> res = "two"
|
||||
else -> res = "unknown"
|
||||
}
|
||||
|
||||
when (n) {
|
||||
1 -> println("A")
|
||||
2 -> println("B")
|
||||
else -> println("C")
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
<html>
|
||||
<body>
|
||||
This intention merges two successive 'when' expressions with equivalent branches into the single one
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user