When to if now add braces for if branches inside #KT-12942 Fixed

(cherry picked from commit 29a7bfe)
This commit is contained in:
Mikhail Glukhikh
2016-07-11 19:09:12 +03:00
committed by Mikhail Glukhikh
parent b675b49daf
commit 3fe114fc24
4 changed files with 34 additions and 0 deletions
@@ -0,0 +1,11 @@
// KT-12942: when to if changes semantics
fun test(b: Boolean): String {
<caret>when (b) {
true ->
if (true) return "first"
false ->
if (true) return "second"
}
return "none"
}
@@ -0,0 +1,10 @@
// KT-12942: when to if changes semantics
fun test(b: Boolean): String {
if (b == true) {
if (true) return "first"
} else if (b == false) {
if (true) return "second"
}
return "none"
}