Merge pull request #410 from kuity/unnecessaryParensInWhenToIf

Fix KT-4385 "Unnecessary parentheses in "replace when with if"
This commit is contained in:
asedunov
2014-03-17 13:00:10 +01:00
4 changed files with 31 additions and 1 deletions
@@ -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"
}
}
@@ -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"
}