Merge pull request #410 from kuity/unnecessaryParensInWhenToIf
Fix KT-4385 "Unnecessary parentheses in "replace when with if"
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
class G {
|
||||
fun cat(x: Int, y: Int): Int {
|
||||
return x + y
|
||||
}
|
||||
}
|
||||
|
||||
fun test(x: Int, y: Int): String {
|
||||
when<caret> (G.cat(x, y)) {
|
||||
1 -> return "one"
|
||||
2 -> return "two"
|
||||
else -> return "big"
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
class G {
|
||||
fun cat(x: Int, y: Int): Int {
|
||||
return x + y
|
||||
}
|
||||
}
|
||||
|
||||
fun test(x: Int, y: Int): String {
|
||||
if (G.cat(x, y) == 1) return "one"
|
||||
else if (G.cat(x, y) == 2) return "two"
|
||||
else return "big"
|
||||
}
|
||||
Reference in New Issue
Block a user