FoldInitializerAndIfToElvis: should not add new line for multiline initializer

#KT-35805 Fixed
This commit is contained in:
Toshiaki Kameyama
2020-01-05 14:50:47 +09:00
committed by igoriakovlev
parent 5eae262264
commit 6cb0190fad
6 changed files with 52 additions and 1 deletions
@@ -0,0 +1,7 @@
fun foo(): Any {
val yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy = 7
val xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
= 24
if (xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx<caret> == null) return yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy
return 42
}
@@ -0,0 +1,6 @@
fun foo(): Any {
val yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy = 7
val xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
= 24 ?: return yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy
return 42
}
@@ -0,0 +1,14 @@
fun foo(vararg args: String): String? = null
fun test(): Int {
val foo = foo(
"1111111111",
"2222222222",
"3333333333",
"4444444444",
"5555555555"
)
<caret>if (foo == null) return 0
return 1
}
@@ -0,0 +1,13 @@
fun foo(vararg args: String): String? = null
fun test(): Int {
val foo = foo(
"1111111111",
"2222222222",
"3333333333",
"4444444444",
"5555555555"
) ?: return 0
return 1
}