Formatter: fix line break between declarations with comment

#KT-12490 Fixed
#KT-35088 Fixed
This commit is contained in:
Dmitry Gridin
2019-11-15 21:57:37 +07:00
parent b6b755506c
commit bfd539d5d1
49 changed files with 191 additions and 12 deletions
@@ -33,6 +33,7 @@ class C1M
// -----
// test
object O6
interface T1
@@ -29,6 +29,7 @@ class C1M
// -----
// test
object O6
interface T1
@@ -1,9 +1,30 @@
interface Some {
fun f1()
fun f2()
fun f3()
/* test */
fun f4()
/* test */ fun f5()
/**
* test
* 2
*/
fun f6()
fun f7()
}
abstract class Abstract() {
abstract fun f1()
abstract fun f2()
// test
abstract fun f3()
// test
/* test */ abstract fun f4()
abstract fun f5()
abstract fun f6()
/* test */ abstract fun f7()
}
@@ -1,9 +1,26 @@
interface Some {
fun f1()
fun f2()
fun f3()
/* test */
fun f4()
/* test */ fun f5()
/**
* test
* 2
*/
fun f6()
fun f7()
}
abstract class Abstract() {
abstract fun f1()
abstract fun f2()
// test
abstract fun f3()
// test
/* test */ abstract fun f4()
abstract fun f5()
abstract fun f6()
/* test */ abstract fun f7()
}
@@ -0,0 +1,11 @@
class Some(b: Boolean) {
// Comment.
constructor(b: Int) : this(b == 0)
/**
* test
* 2
*/
constructor(b: String) : this(b.isEmpty())
constructor(b: Long) : this(b == 0L)
}
@@ -0,0 +1,10 @@
class Some(b: Boolean) {
// Comment.
constructor(b: Int) : this(b == 0)
/**
* test
* 2
*/
constructor(b: String) : this(b.isEmpty())
constructor(b: Long) : this(b == 0L)
}
@@ -8,11 +8,13 @@ class C2
// -----
// test
fun f3 = 1
class C3 {}
// -----
/*test*/
fun f4 = 2
class C4
@@ -8,11 +8,13 @@ class C2
// -----
// test
fun f3 = 1
class C3 {}
// -----
/*test*/
fun f4 = 2
class C4
@@ -13,6 +13,7 @@ class E
class F
// test
fun some() = 1
class G
+1
View File
@@ -10,6 +10,7 @@ class E
: Some
class F
// test
fun some() = 1
class G
fun some() = 1
@@ -26,6 +26,7 @@ enum class E7 {
}
enum class E8 {
// test
A, // A
B // B
}
@@ -28,6 +28,7 @@ enum class E7 {
}
enum class E8 {
// test
A, // A
B // B
}
@@ -25,6 +25,7 @@ enum class E7 {
}
enum class E8 {
// test
A, // A
B // B
}
@@ -1,9 +1,9 @@
// No lines
fun f1() {}
val p1 = 1
fun f2() {}
// test
fun f3() = 1
val p2 = 1
fun f4() = 1
@@ -3,6 +3,7 @@ fun f1() {}
val p1 = 1
fun f2() {}
// test
fun f3() = 1
val p2 = 1
fun f4() = 1
@@ -27,6 +27,9 @@ fun f6() = 1
fun f7() = 8
// test
fun f8() = 42
// Two lines between
fun l1() {}
+2
View File
@@ -25,6 +25,8 @@ fun f5() {
fun f6() = 1
fun f7() = 8
// test
fun f8() = 42
// Two lines between
fun l1() {}
@@ -1,3 +1,4 @@
// test
val p1 by Some
val p2 = 1
val p3: Int get() = 3
+1
View File
@@ -1,3 +1,4 @@
// test
val p1 by Some
val p2 = 1
val p3: Int get() = 3
+4 -1
View File
@@ -24,22 +24,26 @@ fun Int.extFun2() {
val fooVal1 = 1
val fooVal2 = 1
//-----------------------
var fooVar1 = 1
var fooVar2 = 2
//-----------------------
private val Int.extVal1 = 122
private
val
Int.extVal: Int = 1
//-----------------------
public var Int.extVar1: Int = 122
public
var
Int.extVar: Int = 1
//-----------------------
public var varWithAccessors1: Int
get() {
@@ -64,7 +68,6 @@ val
//-----------------------
annotation class A1
annotation class A2
private @[A1 A2 A1]
+1 -1
View File
@@ -2,7 +2,6 @@ typealias A = Int
typealias B = Int
//
typealias C = Int
typealias D =
Int
@@ -23,6 +22,7 @@ object O
typealias I = Int
fun foo() {}
//
fun foo() {}
typealias J = Int