tests: apply official code style
#KT-38632 Fixed
This commit is contained in:
@@ -3,7 +3,14 @@
|
||||
|
||||
package test
|
||||
|
||||
@Target(AnnotationTarget.CLASS, AnnotationTarget.LOCAL_VARIABLE, AnnotationTarget.VALUE_PARAMETER, AnnotationTarget.CONSTRUCTOR, AnnotationTarget.FUNCTION, AnnotationTarget.EXPRESSION)
|
||||
@Target(
|
||||
AnnotationTarget.CLASS,
|
||||
AnnotationTarget.LOCAL_VARIABLE,
|
||||
AnnotationTarget.VALUE_PARAMETER,
|
||||
AnnotationTarget.CONSTRUCTOR,
|
||||
AnnotationTarget.FUNCTION,
|
||||
AnnotationTarget.EXPRESSION
|
||||
)
|
||||
@Retention(AnnotationRetention.SOURCE)
|
||||
annotation class AnnTarget
|
||||
|
||||
@@ -11,6 +18,6 @@ fun println(v: Int) {}
|
||||
|
||||
fun apply() {
|
||||
var v = 0
|
||||
@AnnTarget v++
|
||||
<caret>@AnnTarget v++
|
||||
println(v)
|
||||
}
|
||||
+4
-4
@@ -1,7 +1,7 @@
|
||||
// "Move to constructor" "true"
|
||||
class Complex(
|
||||
/**
|
||||
* Very complex field x
|
||||
*/
|
||||
val x: Int, y: Double, z: String) {
|
||||
/**
|
||||
* Very complex field x
|
||||
*/
|
||||
val x: Int, y: Double, z: String) {
|
||||
}
|
||||
+4
-4
@@ -1,10 +1,10 @@
|
||||
// "Create property 'parameter4' as constructor parameter" "true"
|
||||
|
||||
data class MyDto(
|
||||
val parameter1: String,
|
||||
val parameter2: String = "",
|
||||
val parameter3: String = "",
|
||||
val parameter4: String
|
||||
val parameter1: String,
|
||||
val parameter2: String = "",
|
||||
val parameter3: String = "",
|
||||
val parameter4: String
|
||||
)
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
|
||||
+1
-1
@@ -2,6 +2,6 @@
|
||||
|
||||
fun test() {
|
||||
foo@ while (true) {
|
||||
<caret>break@foo
|
||||
break@<caret>foo
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,7 @@
|
||||
fun test() {
|
||||
foo@ while (true) {
|
||||
while (true) {
|
||||
<caret> break@foo
|
||||
break@<caret>foo
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,6 @@
|
||||
|
||||
fun test() {
|
||||
foo@ while (true) {
|
||||
<caret>continue@foo
|
||||
continue@<caret>foo
|
||||
}
|
||||
}
|
||||
+6
-4
@@ -7,7 +7,9 @@ fun newFun(p1: Int, a: Int, p2: Int, p3: Int, b: Int){}
|
||||
|
||||
|
||||
fun foo() {
|
||||
newFun(0, // 0
|
||||
-1, 1, // 1
|
||||
2, // 2
|
||||
-2)
|
||||
newFun(
|
||||
0, // 0
|
||||
-1, 1, // 1
|
||||
2, // 2
|
||||
-2
|
||||
)
|
||||
|
||||
+3
-2
@@ -8,6 +8,7 @@ fun newFun(p4: Int, p3: Int, p2: Int, p1: Int, p0: Int){}
|
||||
|
||||
fun foo() {
|
||||
newFun(/* 4 */ 4, 3, 2, // 2
|
||||
/* 1 */ 1,
|
||||
/* 0 */ 0)
|
||||
/* 1 */ 1,
|
||||
/* 0 */ 0
|
||||
)
|
||||
}
|
||||
|
||||
+3
-2
@@ -8,7 +8,8 @@ interface X {
|
||||
fun newFun(x: X, a: Int, b: Int){}
|
||||
|
||||
fun foo(x: X) {
|
||||
newFun(x/*receiver*/, 1, // pass 1
|
||||
2 // pass 2
|
||||
newFun(
|
||||
x/*receiver*/, 1, // pass 1
|
||||
2 // pass 2
|
||||
)
|
||||
}
|
||||
|
||||
+4
-3
@@ -9,7 +9,8 @@ interface X {
|
||||
|
||||
fun foo(x: X) {
|
||||
x.newFun(
|
||||
1,
|
||||
2,
|
||||
0)
|
||||
1,
|
||||
2,
|
||||
0
|
||||
)
|
||||
}
|
||||
|
||||
Vendored
+4
-4
@@ -8,8 +8,8 @@ fun Int.newFun(): Int = this
|
||||
|
||||
fun foo(list: List<String>): Int {
|
||||
return list
|
||||
.filter { it.isNotEmpty() }
|
||||
.map { it.length }
|
||||
.first()
|
||||
.<caret>newFun()
|
||||
.filter { it.isNotEmpty() }
|
||||
.map { it.length }
|
||||
.first()
|
||||
.<caret>newFun()
|
||||
}
|
||||
|
||||
+5
-3
@@ -8,7 +8,9 @@ interface X {
|
||||
}
|
||||
|
||||
fun foo(x: X) {
|
||||
x.<caret>newFun(1,
|
||||
2,
|
||||
3)
|
||||
x.<caret>newFun(
|
||||
1,
|
||||
2,
|
||||
3
|
||||
)
|
||||
}
|
||||
|
||||
+2
-2
@@ -35,6 +35,6 @@ fun createHi(any: Any) = "Hi $any"
|
||||
|
||||
val unDeprecateMe = mutableListOf("Hello").apply {
|
||||
addA(d(::createHi, 1 ) { // Run the quick fix from the IDE and watch it produce broken code.
|
||||
println("Yo")
|
||||
}, Unit)
|
||||
println("Yo")
|
||||
}, Unit)
|
||||
}
|
||||
+1
-2
@@ -9,8 +9,7 @@ fun foo(arg: Boolean) {
|
||||
if (arg) {
|
||||
x = 1
|
||||
}
|
||||
}
|
||||
catch (e: Exception) {
|
||||
} catch (e: Exception) {
|
||||
<caret>x = 2
|
||||
}
|
||||
}
|
||||
+2
-4
@@ -5,9 +5,7 @@ fun foo() {
|
||||
val x: Int
|
||||
try {
|
||||
x = 1
|
||||
}
|
||||
catch (e: Exception) {
|
||||
} catch (e: Exception) {
|
||||
<caret>x = 2
|
||||
}
|
||||
finally {}
|
||||
} finally {}
|
||||
}
|
||||
@@ -5,14 +5,11 @@ fun foo() {
|
||||
val x: Int
|
||||
try {
|
||||
x = 1
|
||||
}
|
||||
catch (e: RuntimeException) {
|
||||
} catch (e: RuntimeException) {
|
||||
<caret>x = 2
|
||||
}
|
||||
catch (e: Exception) {
|
||||
} catch (e: Exception) {
|
||||
x = 3
|
||||
}
|
||||
catch (e: Throwable) {
|
||||
} catch (e: Throwable) {
|
||||
x = 4
|
||||
}
|
||||
}
|
||||
+1
-2
@@ -10,8 +10,7 @@ fun foo() {
|
||||
try {
|
||||
val x = 2
|
||||
x = 3
|
||||
}
|
||||
catch(e: Exception) {
|
||||
} catch(e: Exception) {
|
||||
<caret>x = 4
|
||||
}
|
||||
}
|
||||
+1
-2
@@ -5,8 +5,7 @@ fun foo() {
|
||||
val x: Int
|
||||
try {
|
||||
x = 1
|
||||
}
|
||||
catch (e: Exception) {
|
||||
} catch (e: Exception) {
|
||||
<caret>x = 2
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,6 @@
|
||||
// WITH_RUNTIME
|
||||
fun foo(a: String) {
|
||||
val b = a // comment1
|
||||
// comment2
|
||||
.length
|
||||
// comment2
|
||||
.length
|
||||
}
|
||||
@@ -2,5 +2,5 @@
|
||||
// WITH_RUNTIME
|
||||
fun foo(a: String) {
|
||||
val b = a
|
||||
.length
|
||||
.length
|
||||
}
|
||||
@@ -2,6 +2,6 @@
|
||||
// WITH_RUNTIME
|
||||
fun foo(a: String?) {
|
||||
val b = a // comment1
|
||||
// comment2
|
||||
?.length
|
||||
// comment2
|
||||
?.length
|
||||
}
|
||||
@@ -2,5 +2,5 @@
|
||||
// WITH_RUNTIME
|
||||
fun foo(a: String?) {
|
||||
val b = a
|
||||
?.length
|
||||
?.length
|
||||
}
|
||||
+4
-4
@@ -2,8 +2,8 @@
|
||||
// WITH_RUNTIME
|
||||
fun foo(a: String?) {
|
||||
val b = a // comment1
|
||||
// comment2
|
||||
?.let {
|
||||
it.length
|
||||
}
|
||||
// comment2
|
||||
?.let {
|
||||
it.length
|
||||
}
|
||||
}
|
||||
+3
-3
@@ -2,7 +2,7 @@
|
||||
// WITH_RUNTIME
|
||||
fun foo(a: String?) {
|
||||
val b = a
|
||||
?.let {
|
||||
it.length
|
||||
}
|
||||
?.let {
|
||||
it.length
|
||||
}
|
||||
}
|
||||
+2
-1
@@ -5,4 +5,5 @@
|
||||
// ERROR: Conflicting declarations: value-parameter p4: Any, value-parameter p4: String
|
||||
open class Base<T>(p1: Int, private val p2: Int, p3: Any, p4: String, p5: T, p6: Int)
|
||||
|
||||
class C(p: Int, p2: Int, p3: String, p4: Any, p5: String, val p6: Int, p1: Int, p4: String) : Base<String>(p1, p2, p3, p4, p5, p6)
|
||||
class C(p: Int, p2: Int, p3: String, p4: Any, p5: String, val p6: Int, p1: Int, p4: String) :
|
||||
Base<String>(p1, p2, p3, p4, p5, p6)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// "Replace array of boxed with array of primitive" "true"
|
||||
annotation class SuperAnnotation(
|
||||
val boo: BooleanArray,
|
||||
val str: Array<String>
|
||||
val boo: BooleanArray,
|
||||
val str: Array<String>
|
||||
)
|
||||
@@ -1,5 +1,5 @@
|
||||
// "Replace array of boxed with array of primitive" "true"
|
||||
annotation class SuperAnnotation(
|
||||
val b: ByteArray,
|
||||
val str: Array<String>
|
||||
val b: ByteArray,
|
||||
val str: Array<String>
|
||||
)
|
||||
@@ -1,5 +1,5 @@
|
||||
// "Replace array of boxed with array of primitive" "true"
|
||||
annotation class SuperAnnotation(
|
||||
val c: CharArray,
|
||||
val str: Array<String>
|
||||
val c: CharArray,
|
||||
val str: Array<String>
|
||||
)
|
||||
@@ -1,5 +1,5 @@
|
||||
// "Replace array of boxed with array of primitive" "true"
|
||||
annotation class SuperAnnotation(
|
||||
val f: FloatArray,
|
||||
val str: Array<String>
|
||||
val f: FloatArray,
|
||||
val str: Array<String>
|
||||
)
|
||||
@@ -1,5 +1,5 @@
|
||||
// "Replace array of boxed with array of primitive" "true"
|
||||
annotation class SuperAnnotation(
|
||||
val i: IntArray,
|
||||
val str: Array<String>
|
||||
val i: IntArray,
|
||||
val str: Array<String>
|
||||
)
|
||||
@@ -1,5 +1,5 @@
|
||||
// "Replace array of boxed with array of primitive" "true"
|
||||
annotation class SuperAnnotation(
|
||||
val l: LongArray,
|
||||
val str: Array<String>
|
||||
val l: LongArray,
|
||||
val str: Array<String>
|
||||
)
|
||||
@@ -1,5 +1,5 @@
|
||||
// "Replace array of boxed with array of primitive" "true"
|
||||
annotation class SuperAnnotation(
|
||||
val s: ShortArray,
|
||||
val str: Array<String>
|
||||
val s: ShortArray,
|
||||
val str: Array<String>
|
||||
)
|
||||
Reference in New Issue
Block a user