When to if now add braces for if branches inside #KT-12942 Fixed
(cherry picked from commit 29a7bfe)
This commit is contained in:
committed by
Mikhail Glukhikh
parent
b675b49daf
commit
3fe114fc24
@@ -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"
|
||||
}
|
||||
Reference in New Issue
Block a user