Do not force new line in body for empty functions and function expressions (KT-10828)

#KT-10828 Fixed
This commit is contained in:
Nikolay Krasko
2016-12-06 16:39:17 +03:00
committed by Nikolay Krasko
parent 268d55104c
commit 2841931ffa
130 changed files with 334 additions and 575 deletions
+4 -8
View File
@@ -2,8 +2,7 @@ enum class E1 {
A,
B;
fun foo() {
}
fun foo() {}
}
enum class E2 {
@@ -11,16 +10,14 @@ enum class E2 {
B;
fun foo() {
}
fun foo() {}
}
enum class E3 {
A,
B;
fun foo() {
}
fun foo() {}
}
enum class E4 {
@@ -28,6 +25,5 @@ enum class E4 {
B
;
fun foo() {
}
fun foo() {}
}
@@ -1,5 +1,4 @@
fun some(f: (String) -> Unit) {
}
fun some(f: (String) -> Unit) {}
fun test() {
3 + object {
@@ -1,13 +1,9 @@
fun f1() {
}
fun f1() {}
class C1 {}
// -----
fun f2() {
}
fun f2() {}
class C2
// -----
@@ -24,15 +20,13 @@ class C4
class C5 {}
fun f5() {
}
fun f5() {}
// -----
class C6
fun f6() {
}
fun f6() {}
// -----
@@ -3,29 +3,24 @@ fun f1() {
}
val p1 = 1
fun f2() {
}
fun f2() {}
fun f3() = 1
val p2 = 1
fun f4() = 1
fun f4() {
}
fun f4() {}
val p3: Int
get() = 1
fun f5() = 1
class OneLine {
fun f1() {
}
fun f1() {}
val p1 = 1
fun f2() {
}
fun f2() {}
fun f3() = 1
@@ -33,8 +28,7 @@ class OneLine {
fun f4() = 1
fun f4() {
}
fun f4() {}
val p3: Int
get() = 1
@@ -43,15 +37,13 @@ class OneLine {
}
class TwoLines {
fun f1() {
}
fun f1() {}
val p1 = 1
fun f2() {
}
fun f2() {}
fun f3() = 1
@@ -63,8 +55,7 @@ class TwoLines {
fun f4() = 1
fun f4() {
}
fun f4() {}
val p3: Int
+8 -19
View File
@@ -1,15 +1,9 @@
// No lines between
fun f2() {
}
fun f1() {
}
fun f2() {}
fun f1() {}
fun f3() = 1
fun f4() {
}
fun f4() {}
fun f5() {
}
@@ -18,16 +12,13 @@ fun f7() = 8
// One line
fun f2() {
}
fun f2() {}
fun f1() {
}
fun f1() {}
fun f3() = 1
fun f4() {
}
fun f4() {}
fun f5() {
}
@@ -41,15 +32,13 @@ fun l1() {
}
fun l2() {
}
fun l2() {}
fun l3() = 1
fun l4() {
}
fun l4() {}
fun l5() {
+22 -15
View File
@@ -1,17 +1,13 @@
val a = fun() {
}
val b = fun test() {
}
val a = fun() {}
val b = fun test() {}
val c = fun() {
}
val c = fun() {}
val c = fun() = 4
val c = fun() =
4
val c = fun() {
}
val c = fun() {}
val c = fun() = 4
fun test() = fun test() = 4
@@ -19,18 +15,29 @@ fun test() = fun test() = 4
fun test() {
test(fun() {
})
test(fun test() {
})
test(fun test() {})
test(fun test() = 5)
test(fun test() = fun test(a: Int) = 2)
2.(fun test() {
})()
2.(fun test() {})()
(fun() = 4)
(fun() {
})
(fun() {})
test(fun test() = 4)
}
}
fun d = fun(a: Int,
b: String) {
}
fun e = fun() {
val a = 1
}
fun f = fun() { foo() }
val g: (String) -> Int = fun(p: String): Unit { /* comment */ /* other comment */ }
fun foo() {}
+13 -1
View File
@@ -27,4 +27,16 @@ fun test() {
(fun(){})
test( fun test ( ) = 4 )
}
}
fun d = fun(a: Int,
b: String) {}
fun e = fun() {
val a = 1}
fun f = fun() {foo()}
val g: (String) -> Int = fun(p: String): Unit { /* comment */ /* other comment */ }
fun foo() {}
@@ -42,4 +42,3 @@ fun testWithComments() {
it > 4
}
}
+6 -4
View File
@@ -9,15 +9,13 @@ enum class E3 {
class C1 {}
class C2 {
fun test() {
}
fun test() {}
}
object O1 {}
object O2 {
fun test() {
}
fun test() {}
}
interface T1 {}
@@ -32,3 +30,7 @@ enum class E1 {
val some = 1
}
}
fun e = fun(a: Int,
b: String) {
}
+3
View File
@@ -25,3 +25,6 @@ enum class E1 {
EE2 {
val some = 1}
}
fun e = fun(a: Int,
b: String) {}
+14 -32
View File
@@ -1,40 +1,28 @@
class A {
constructor() {
}
constructor() {}
constructor() {}
constructor() {
}
fun foo() {
}
fun foo() {}
constructor()
fun foo() {
}
fun foo() {}
constructor() {
}
constructor() {}
val x = 1
constructor() {
}
fun foo() {
}
constructor() {}
fun foo() {}
val x = 1
constructor() {
}
constructor() {}
val x = 1
val x = 1
constructor() {
}
constructor() {}
constructor() {
x = 1
@@ -42,30 +30,24 @@ class A {
fun foo() = 1
constructor() {
}
constructor() {}
fun foo() = 1
constructor() : this() {
}
constructor() : this() {
}
constructor() : this() {}
constructor() : this() {}
constructor(a: Int) : this()
constructor(a: Byte) : this()
constructor() : this()
constructor() : super() {
}
constructor() : super() {}
constructor() : this()
constructor() : super() {
}
constructor() : super() {}
constructor() :
this()
@@ -1,15 +1,8 @@
class A {
constructor() {
}
constructor(): this() {
}
constructor(): super() {
}
constructor(): super() {
}
constructor() {}
constructor(): this() {}
constructor(): super() {}
constructor(): super() {}
}
// SET_TRUE: SPACE_BEFORE_EXTEND_COLON
@@ -1,15 +1,8 @@
class A {
constructor() {
}
constructor() :this() {
}
constructor() :super() {
}
constructor() :super() {
}
constructor() {}
constructor() :this() {}
constructor() :super() {}
constructor() :super() {}
}
// SET_TRUE: SPACE_BEFORE_EXTEND_COLON
+3 -7
View File
@@ -7,8 +7,7 @@ data class FooClass2
//-----------------------
public fun fooFun1() {
}
public fun fooFun1() {}
public
fun fooFun2() {
@@ -102,11 +101,8 @@ object FooObject2 {
}
fun <T> foo_1() {
}
fun <T> foo_2() {
}
fun <T> foo_1() {}
fun <T> foo_2() {}
fun
<T>
@@ -1,5 +1,6 @@
class C {
fun foo0() {}
fun foo0() {
}
private
fun foo() {
@@ -1,5 +1,6 @@
class C {
fun foo0() {}
fun foo0() {
}
private
val foo = 1
@@ -1,6 +1,5 @@
class C {
fun foo0() {
}
fun foo0() {}
private
var foo = 1
@@ -1,9 +1,6 @@
class A {
constructor() {
}
constructor() : this() {
}
constructor() {}
constructor() : this() {}
constructor() {