Formatter: Don't enforce empty line between secondary constructors without body (KT-12175)

#KT-12175 Fixed
This commit is contained in:
Nikolay Krasko
2016-05-04 15:28:55 +03:00
committed by Nikolay Krasko
parent 52cd7109c7
commit b107bc401c
13 changed files with 18 additions and 9 deletions
+1
View File
@@ -24,6 +24,7 @@ New features:
- [KT-12079](https://youtrack.jetbrains.com/issue/KT-12079) Support "Autowired members defined in invalid Spring bean" inspection on Kotlin declarations - [KT-12079](https://youtrack.jetbrains.com/issue/KT-12079) Support "Autowired members defined in invalid Spring bean" inspection on Kotlin declarations
- [KT-11704](https://youtrack.jetbrains.com/issue/KT-11704) Support file path references inside of Kotlin string literals - [KT-11704](https://youtrack.jetbrains.com/issue/KT-11704) Support file path references inside of Kotlin string literals
- [KT-12092](https://youtrack.jetbrains.com/issue/KT-12092) Implement bean references in @Qualifier annotations - [KT-12092](https://youtrack.jetbrains.com/issue/KT-12092) Implement bean references in @Qualifier annotations
- [KT-12175](https://youtrack.jetbrains.com/issue/KT-12175) Don't enforce empty line after one-line constructor
Issues fixed: Issues fixed:
@@ -59,6 +59,7 @@ fun createSpacingBuilder(settings: CodeStyleSettings, builderUtil: KotlinSpacing
inPosition(left = FUN, right = FUN).emptyLinesIfLineBreakInLeft(1) inPosition(left = FUN, right = FUN).emptyLinesIfLineBreakInLeft(1)
inPosition(left = PROPERTY, right = FUN).emptyLinesIfLineBreakInLeft(1) inPosition(left = PROPERTY, right = FUN).emptyLinesIfLineBreakInLeft(1)
inPosition(left = FUN, right = PROPERTY).emptyLinesIfLineBreakInLeft(1) inPosition(left = FUN, right = PROPERTY).emptyLinesIfLineBreakInLeft(1)
inPosition(left = SECONDARY_CONSTRUCTOR, right = SECONDARY_CONSTRUCTOR).emptyLinesIfLineBreakInLeft(1)
// Case left for alternative constructors // Case left for alternative constructors
inPosition(left = FUN, right = CLASS).emptyLinesIfLineBreakInLeft(1) inPosition(left = FUN, right = CLASS).emptyLinesIfLineBreakInLeft(1)
@@ -3,7 +3,6 @@ class Foo : Base {
val x = 1 val x = 1
<caret>constructor(n: Int) : super(n) <caret>constructor(n: Int) : super(n)
constructor(a: Int, b: Int) : super(a, b) constructor(a: Int, b: Int) : super(a, b)
fun foo() { fun foo() {
@@ -3,7 +3,6 @@ class Foo<U> : Base<U, Int> {
val x = 1 val x = 1
<caret>constructor(x: U) : super(x) <caret>constructor(x: U) : super(x)
constructor(x: U, y: Int?) : super(x, y) constructor(x: U, y: Int?) : super(x, y)
fun foo() { fun foo() {
@@ -7,7 +7,6 @@ class Foo : Base {
val x = 1 val x = 1
<caret>constructor(a: Int, b: Int) : super(a, b) <caret>constructor(a: Int, b: Int) : super(a, b)
constructor(n: Int) : super(n) constructor(n: Int) : super(n)
fun foo() { fun foo() {
@@ -7,7 +7,6 @@ class Foo : Base {
val x = 1 val x = 1
constructor(x: Int) : super(x) constructor(x: Int) : super(x)
<caret>constructor(a: Int, b: Int) : super(a, b) <caret>constructor(a: Int, b: Int) : super(a, b)
fun foo() { fun foo() {
@@ -7,7 +7,6 @@ class Foo<U> : Base<U, Int> {
val x = 1 val x = 1
<caret>constructor(x: U, y: Int) : super(x, y) <caret>constructor(x: U, y: Int) : super(x, y)
constructor(n: U) : super(n) constructor(n: U) : super(n)
fun foo() { fun foo() {
@@ -54,6 +54,14 @@ class A {
constructor() : this() { constructor() : this() {
} }
constructor(a: Int) : this()
constructor(a: Byte) : this()
constructor() : this()
constructor() : super() {
}
constructor() : this() constructor() : this()
constructor() : super() { constructor() : super() {
+8
View File
@@ -26,6 +26,14 @@ constructor() {}
constructor() : this() {} constructor() : this() {}
constructor():this() {} constructor():this() {}
constructor(a: Int) : this()
constructor(a: Byte) : this()
constructor(): this () constructor(): this ()
constructor(): super(){} constructor(): super(){}
constructor(): this ()
constructor(): super(){}
} }
@@ -19,7 +19,6 @@ class A {
} }
constructor() constructor()
constructor() { constructor() {
} }
} }
@@ -23,7 +23,6 @@ class A
} }
constructor() constructor()
constructor() constructor()
{ {
} }
@@ -4,7 +4,6 @@ open class <caret>A(n: Int) {
open class B: A { open class B: A {
constructor(n: Int) : super(n) constructor(n: Int) : super(n)
constructor(b: Boolean, n: Int): super(n) constructor(b: Boolean, n: Int): super(n)
} }
@@ -5,7 +5,6 @@ open class A {
open class B: A { open class B: A {
constructor(n: Int) : super(n) constructor(n: Int) : super(n)
constructor(b: Boolean, n: Int): super(n) constructor(b: Boolean, n: Int): super(n)
} }