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
@@ -5,10 +5,13 @@ interface Z<T>
open class A<T : I, U : I, V> {
// INFO: {"checked": "true"}
var foo1: T
// INFO: {"checked": "true"}
var foo2: Z<T>
// INFO: {"checked": "true"}
var foo3: Any
// INFO: {"checked": "true"}
var foo4: Z<Any>
@@ -2,10 +2,13 @@
abstract class A {
// INFO: {"checked": "true"}
val x = 1
// INFO: {"checked": "true"}
val y: Int get() = 2
// INFO: {"checked": "true"}
val z: Int by lazy { 3 }
// INFO: {"checked": "true"}
abstract val t: Int
@@ -2,10 +2,13 @@
abstract class A {
// INFO: {"checked": "true", "toAbstract": "true"}
abstract val x: Int
// INFO: {"checked": "true", "toAbstract": "true"}
abstract val y: Int
// INFO: {"checked": "true", "toAbstract": "true"}
abstract val z: Int
// INFO: {"checked": "true", "toAbstract": "true"}
abstract val t: Int
@@ -6,18 +6,25 @@ interface Z<T>
abstract class A<T: I, U: I, V>(x: T, y: Any?) {
// INFO: {"checked": "true"}
val foo1: T
// INFO: {"checked": "true"}
val foo2: Z<T>
// INFO: {"checked": "true"}
val foo3: Any?
// INFO: {"checked": "true"}
val foo4: Z<Any?>
// INFO: {"checked": "true", "toAbstract": "true"}
abstract val foo5: T
// INFO: {"checked": "true", "toAbstract": "true"}
abstract val foo6: Z<T>
// INFO: {"checked": "true", "toAbstract": "true"}
abstract val foo7: Any?
// INFO: {"checked": "true", "toAbstract": "true"}
abstract val foo8: Z<Any?>
@@ -2,10 +2,13 @@
interface T {
// INFO: {"checked": "true"}
val x: Int
// INFO: {"checked": "true"}
val y: Int get() = 2
// INFO: {"checked": "true"}
val z: Int
// INFO: {"checked": "true"}
val t: Int
@@ -38,6 +41,7 @@ abstract class B: T {
// INFO: {"checked": "true"}
override val x = 1
// INFO: {"checked": "true"}
override val z: Int by lazy { 3 }
@@ -2,10 +2,13 @@
interface T {
// INFO: {"checked": "true", "toAbstract": "true"}
val x: Int
// INFO: {"checked": "true", "toAbstract": "true"}
val y: Int
// INFO: {"checked": "true", "toAbstract": "true"}
val z: Int
// INFO: {"checked": "true", "toAbstract": "true"}
val t: Int
@@ -1,6 +1,7 @@
open class Temp1 {
// INFO: {"checked": "true"}
private val used: Int = 1
// INFO: {"checked": "true"}
private val using: Int = used + 1
}
@@ -1,12 +1,16 @@
open class A(p: Int) {
// INFO: {"checked": "true"}
val n: Int
// INFO: {"checked": "true"}
val x: Int = 3
// INFO: {"checked": "true"}
val y: Int = 4
// INFO: {"checked": "true"}
val a: Int = 1
// INFO: {"checked": "true"}
val b: Int = x + y
@@ -1,10 +1,13 @@
open class A {
// INFO: {"checked": "true"}
val n: Int
// INFO: {"checked": "true"}
val x: Int = 3
// INFO: {"checked": "true"}
val a: Int = 1
// INFO: {"checked": "true"}
val b: Int = x + y
}
@@ -1,5 +1,6 @@
open class A {
open fun bar() = 1
// INFO: {"checked": "true"}
fun foo() = bar()
}
@@ -5,10 +5,13 @@ abstract class A {
abstract class B : A() {
// INFO: {"checked": "true"}
val x = 1
// INFO: {"checked": "true"}
val y: Int get() = 2
// INFO: {"checked": "true"}
val z: Int by lazy { 3 }
// INFO: {"checked": "true"}
abstract val t: Int
@@ -32,14 +35,18 @@ abstract class B : A() {
class C : A() {
val t = 1
// INFO: {"checked": "true"}
val x = 1
// INFO: {"checked": "true"}
val y: Int get() = 2
// INFO: {"checked": "true"}
val z: Int by lazy { 3 }
fun bar(s: String) = s.length()
// INFO: {"checked": "true"}
fun foo(n: Int): Boolean = n > 0
@@ -1,8 +1,10 @@
abstract class A {
// INFO: {"checked": "true", "toAbstract": "true"}
abstract val x: Int
// INFO: {"checked": "true", "toAbstract": "true"}
abstract val y: Int
// INFO: {"checked": "true", "toAbstract": "true"}
abstract val z: Int
@@ -14,10 +16,13 @@ abstract class A {
abstract class B : A() {
// INFO: {"checked": "true", "toAbstract": "true"}
override val x = 1
// INFO: {"checked": "true", "toAbstract": "true"}
override val y: Int get() = 2
// INFO: {"checked": "true", "toAbstract": "true"}
override val z: Int by lazy { 3 }
// INFO: {"checked": "true", "toAbstract": "true"}
abstract val t: Int
@@ -41,14 +46,18 @@ abstract class B : A() {
class C : A() {
val t = 1
// INFO: {"checked": "true", "toAbstract": "true"}
override val x = 1
// INFO: {"checked": "true", "toAbstract": "true"}
override val y: Int get() = 2
// INFO: {"checked": "true", "toAbstract": "true"}
override val z: Int by lazy { 3 }
fun bar(s: String) = s.length()
// INFO: {"checked": "true", "toAbstract": "true"}
override fun foo(n: Int): Boolean = n > 0
@@ -7,6 +7,7 @@ open class A<T> {
class B<S> : A<Z<S>>() {
// INFO: {"checked": "true"}
val t1: Z<S>
// INFO: {"checked": "true"}
val t2: Z<Z<S>>
@@ -28,6 +29,7 @@ class B<S> : A<Z<S>>() {
class C<K> : A<B<K>>() {
// INFO: {"checked": "true"}
val t1: B<K>
// INFO: {"checked": "true"}
val t2: Z<B<K>>
@@ -5,6 +5,7 @@ interface I {
abstract class A : I {
// INFO: {"checked": "true"}
val x: Int get() = 2
// INFO: {"checked": "true"}
abstract val y: Int
@@ -22,10 +23,12 @@ abstract class A : I {
class B : I {
val y = 1
// INFO: {"checked": "true"}
val x: Int get() = 2
fun bar(s: String) = s.length()
// INFO: {"checked": "true"}
fun foo(n: Int): Boolean = n > 0
@@ -38,6 +41,7 @@ class B : I {
interface J : I {
// INFO: {"checked": "true"}
val x: Int get() = 2
// INFO: {"checked": "true"}
val y: Int
@@ -55,10 +59,12 @@ interface J : I {
interface K : I {
val y: Int get() = 1
// INFO: {"checked": "true"}
val x: Int get() = 2
fun bar(s: String) = s.length()
// INFO: {"checked": "true"}
fun foo(n: Int): Boolean = n > 0
@@ -10,6 +10,7 @@ interface I {
abstract class A : I {
// INFO: {"checked": "true", "toAbstract": "true"}
override val x: Int get() = 2
// INFO: {"checked": "true", "toAbstract": "true"}
abstract val y: Int
@@ -27,10 +28,12 @@ abstract class A : I {
class B : I {
val y = 1
// INFO: {"checked": "true", "toAbstract": "true"}
override val x: Int get() = 2
fun bar(s: String) = s.length()
// INFO: {"checked": "true", "toAbstract": "true"}
override fun foo(n: Int): Boolean = n > 0
@@ -43,6 +46,7 @@ class B : I {
interface J : I {
// INFO: {"checked": "true", "toAbstract": "true"}
override val x: Int get() = 2
// INFO: {"checked": "true", "toAbstract": "true"}
val y: Int
@@ -60,10 +64,12 @@ interface J : I {
interface K : I {
val y: Int get() = 1
// INFO: {"checked": "true", "toAbstract": "true"}
override val x: Int get() = 2
fun bar(s: String) = s.length()
// INFO: {"checked": "true", "toAbstract": "true"}
override fun foo(n: Int): Boolean = n > 0