Remove braces: add parentheses to if-else inside expression
So #KT-18308 Fixed
This commit is contained in:
committed by
Mikhail Glukhikh
parent
19e38bbc72
commit
44c15d8311
@@ -0,0 +1,7 @@
|
||||
// WITH_RUNTIME
|
||||
fun test(b: Boolean) {
|
||||
val list1 = mutableListOf(1)
|
||||
val list2 = mutableListOf(2)
|
||||
|
||||
if (b) list1 else <caret>{list2}.add(3)
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
// WITH_RUNTIME
|
||||
fun test(b: Boolean) {
|
||||
val list1 = mutableListOf(1)
|
||||
val list2 = mutableListOf(2)
|
||||
|
||||
(if (b) list1 else list2).add(3)
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
// WITH_RUNTIME
|
||||
fun test(b: Boolean) {
|
||||
val list1 = mutableListOf(1)
|
||||
val list2 = mutableListOf(2)
|
||||
|
||||
if (b) <caret>{list1} else {list2}.add(3)
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
// WITH_RUNTIME
|
||||
fun test(b: Boolean) {
|
||||
val list1 = mutableListOf(1)
|
||||
val list2 = mutableListOf(2)
|
||||
|
||||
if (b) list1 else {list2}.add(3)
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
// WITH_RUNTIME
|
||||
fun test(b: Boolean) {
|
||||
val list1 = mutableListOf(1)
|
||||
val list2 = mutableListOf(2)
|
||||
|
||||
when {
|
||||
b -> list1
|
||||
else -> <caret>{
|
||||
list2
|
||||
}
|
||||
}.add(3)
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
// WITH_RUNTIME
|
||||
fun test(b: Boolean) {
|
||||
val list1 = mutableListOf(1)
|
||||
val list2 = mutableListOf(2)
|
||||
|
||||
when {
|
||||
b -> list1
|
||||
else -> list2
|
||||
}.add(3)
|
||||
}
|
||||
Reference in New Issue
Block a user