Fix tests after implementing trailing comma in formatter

#KT-34744
This commit is contained in:
Dmitry Gridin
2020-01-14 20:56:48 +07:00
parent d98794479d
commit d06787886a
112 changed files with 598 additions and 371 deletions
@@ -115,8 +115,10 @@ class SmartEnterCompletionTest : KotlinLightCodeInsightFixtureTestCase() {
fun foo(p:Int) {}
fun test() {
foo(1 +
2)<caret>
foo(
1 +
2,
)<caret>
}
"""
)
+7 -5
View File
@@ -1,9 +1,11 @@
import javax.swing.SwingUtilities
fun main(args : Array<String>) {
SwingUtilities.invokeLater(object : Runnable {
override fun run() {
TODO("Not yet implemented")
}
})
SwingUtilities.invokeLater(
object : Runnable {
override fun run() {
TODO("Not yet implemented")
}
},
)
}
+5 -3
View File
@@ -1,7 +1,9 @@
import javax.swing.SwingUtilities
fun main(args : Array<String>) {
SwingUtilities.invokeLater(object : Thread(<caret>) {
})
SwingUtilities.invokeLater(
object : Thread(<caret>) {
},
)
}
@@ -14,7 +14,7 @@ class A {
return JetBundle.message(
"x.in.y",
DescriptorRenderer.COMPACT.render(declarationDescriptor),
IdeDescriptorRenderers.SOURCE_CODE_SHORT_NAMES_NO_ANNOTATIONS.render(containingDescriptor)
IdeDescriptorRenderers.SOURCE_CODE_SHORT_NAMES_NO_ANNOTATIONS.render(containingDescriptor),
)
}
}
@@ -4,9 +4,8 @@ val x = listOf(1, 2, 3).joinToString(
// comment2
prefix = "= ",
// comment3
separator = " + "
separator = " + ",
// comment4
,
// comment1
transform = Int::toString
transform = Int::toString,
)
@@ -7,6 +7,6 @@ val x = listOf(1, 2, 3).joinTo(
// comment2
prefix = "= ",
// comment3
separator = " + "
separator = " + ",
// comment4
) { "$it*$it" }
@@ -3,6 +3,6 @@
fun test() {
<caret>listOfNotNull(
true, // comment1
null // comment2
null, // comment2
).first()
}
@@ -2,6 +2,8 @@
// HIGHLIGHT: INFORMATION
fun test(list: List<Int>) {
println(list.filter { it > 1 }
.filter { it > 2 })
println(
list.filter { it > 1 }
.filter { it > 2 }
)
}
@@ -2,7 +2,9 @@
// HIGHLIGHT: INFORMATION
fun test() {
println(runCatching {
println(
runCatching {
/* lots of code*/
})
}
)
}
@@ -3,9 +3,11 @@
fun foo(x: Int) {}
fun bar() {
foo(run {
foo(1)
foo(2)
1
})
foo(
run {
foo(1)
foo(2)
1
}
)
}
@@ -3,9 +3,12 @@ fun test() {
operator fun get(a: Int, b: Int, fn: (i: Int) -> Int) : Int = 0
}
val test = Test()
test<caret>[1, 2, { i ->
i
}]
test<caret>[
1, 2,
{ i ->
i
}
]
}
fun withSuppression() {
@@ -3,7 +3,9 @@ fun test() {
operator fun get(fn: (i: Int) -> Int) : Int = 0
}
val test = Test()
test<caret>[{ i ->
i
}]
test<caret>[
{ i ->
i
}
]
}
@@ -1,5 +1,7 @@
fun test() {
Foo.Bar().bar({
true
})
Foo.Bar().bar(
{
true
}
)
}
@@ -1,8 +1,10 @@
// WITH_RUNTIME
fun main(args: Array<String>) {
val doSomething = doSomething("one" + 1,
val doSomething = doSomething(
"one" + 1,
"two",
3 * 4)
3 * 4
)
val t = if (doSomething != null) doSomething else throw NullPointerException("Expression 'doSomething(\"one\" + 1, ...' must not be null")
}
@@ -5,6 +5,7 @@ class WithComments/* Some parameter */
/**
* A very important property
*/
val veryImportant: Any) {
val veryImportant: Any
) {
}
@@ -2,7 +2,9 @@ annotation class AnnParam
annotation class AnnProperty
abstract class WithComposedModifiers(@AnnParam vararg @AnnProperty
open val x: String) {
abstract class WithComposedModifiers(
@AnnParam vararg @AnnProperty
open val x: String
) {
}
@@ -1,7 +1,9 @@
fun foo(f: (Int) -> String) {}
fun test() {
foo(fun(it: Int): String {
return ""
})
foo(
fun(it: Int): String {
return ""
}
)
}
@@ -1,7 +1,9 @@
fun bar(f: (Int, Int) -> String) {}
fun test() {
bar(fun(i: Int, j: Int): String {
return "$i$j"
})
bar(
fun(i: Int, j: Int): String {
return "$i$j"
}
)
}
@@ -2,7 +2,9 @@ class Foo
fun bar(f: Foo.() -> Unit) {}
fun main(args: Array<String>) {
bar(fun Foo.() {
bar(
fun Foo.() {
})
}
)
}
@@ -2,7 +2,9 @@ class Foo
fun baz(f: Foo.(i: Int, j: Int) -> Int) {}
fun main(args: Array<String>) {
baz(fun Foo.(i: Int, j: Int): Int {
return i + j
})
baz(
fun Foo.(i: Int, j: Int): Int {
return i + j
}
)
}
@@ -6,7 +6,9 @@ import java.util.*
fun foo(f: () -> ArrayDeque<*>) {}
fun test() {
foo(fun(): ArrayDeque<Int> {
return ArrayDeque<Int>()
})
foo(
fun(): ArrayDeque<Int> {
return ArrayDeque<Int>()
}
)
}
@@ -6,7 +6,9 @@ import java.util.*
fun foo(f: () -> ArrayDeque<*>) {}
fun test() {
foo(fun(): ArrayDeque<*> {
return ArrayDeque<Int>()
})
foo(
fun(): ArrayDeque<*> {
return ArrayDeque<Int>()
}
)
}
@@ -1,9 +1,11 @@
fun foo(f: (Int) -> String) {}
fun test() {
foo(fun(it: Int): String {
// comment1
return ""
// comment2
})
foo(
fun(it: Int): String {
// comment1
return ""
// comment2
}
)
}
@@ -1,7 +1,9 @@
fun foo(f: (Int) -> String) {}
fun test() {
foo(fun(it: Int): String {
return "$it"
})
foo(
fun(it: Int): String {
return "$it"
}
)
}
@@ -1,10 +1,12 @@
fun foo(f: (Int) -> String) {}
fun test() {
foo(fun(it: Int): String {
if (it == 1) {
return "1"
}
return "$it"
})
foo(
fun(it: Int): String {
if (it == 1) {
return "1"
}
return "$it"
}
)
}
@@ -1,13 +1,15 @@
fun foo(f: (Int) -> String) {}
fun test() {
foo(fun(it: Int): String {
if (it == 1) {
return "1"
} else if (it == 2) {
return "2"
} else {
return "$it"
}
})
foo(
fun(it: Int): String {
if (it == 1) {
return "1"
} else if (it == 2) {
return "2"
} else {
return "$it"
}
}
)
}
@@ -2,10 +2,12 @@
fun foo(f: (Int) -> String) {}
fun test() {
foo(fun(it: Int): String {
listOf(1).map {
return@map 2
}
return "$it"
})
foo(
fun(it: Int): String {
listOf(1).map {
return@map 2
}
return "$it"
}
)
}
@@ -1,8 +1,10 @@
fun foo(f: (Int) -> String) {}
fun test() {
foo(fun(it: Int): String {
val b = it == 1
return if (b) "1" else "2"
})
foo(
fun(it: Int): String {
val b = it == 1
return if (b) "1" else "2"
}
)
}
@@ -1,7 +1,9 @@
fun foo(f: (Int) -> String) {}
fun test() {
foo(fun(it: Int): String {
return "$it"
})
foo(
fun(it: Int): String {
return "$it"
}
)
}
@@ -1,5 +1,7 @@
fun main() {
Test().foo(fun(it: Int) {
Test().foo(
fun(it: Int) {
})
}
)
}
@@ -3,5 +3,6 @@ fun baz(name: String, f: (Int) -> String) {}
fun test() {
baz(name = "", f = fun(it: Int): String {
return "$it"
})
}
)
}
@@ -1,7 +1,9 @@
fun foo(f: () -> String) {}
fun test() {
foo(fun(): String {
return ""
})
foo(
fun(): String {
return ""
}
)
}
@@ -3,8 +3,10 @@ fun unit(f: (Int) -> Unit) {}
fun foo(i: Int) {}
fun test() {
unit(fun(it: Int) {
foo(it)
foo(it)
})
unit(
fun(it: Int) {
foo(it)
foo(it)
}
)
}
@@ -7,7 +7,9 @@ data class My(val x: Int)
fun foo(f: () -> My) {}
fun test() {
foo(fun(): My {
return My(42)
})
foo(
fun(): My {
return My(42)
}
)
}
@@ -1,8 +1,10 @@
// IS_APPLICABLE: true
fun foo() {
bar(2, {
it * 3
})
bar(2,
{
it * 3
}
)
}
fun bar(a: Int, b: (Int) -> Int) {
@@ -1,8 +1,10 @@
// IS_APPLICABLE: true
fun foo() {
bar(b = {
it * 3
})
bar(
b = {
it * 3
}
)
}
fun bar(a : Int = 2, b: (Int) -> Int) {
@@ -1,8 +1,10 @@
// IS_APPLICABLE: true
fun foo() {
bar(1, b = {
it * 3
})
bar(1,
b = {
it * 3
}
)
}
fun bar(c: Int, a: Int = 2, b: (Int) -> Int) {
@@ -1,9 +1,11 @@
// IS_APPLICABLE: true
fun foo() {
bar(2, {
val x = 3
it * x
})
bar(2,
{
val x = 3
it * x
}
)
}
fun bar(a: Int, b: (Int) -> Int) {
@@ -1,9 +1,11 @@
// IS_APPLICABLE: true
fun foo() {
bar(a = 2, b = {
val x = 3
it * x
})
bar(a = 2,
b = {
val x = 3
it * x
}
)
}
fun bar(a: Int, b: (Int) -> Int) {
@@ -3,11 +3,13 @@
fun foo(runnable: Runnable) {}
fun bar(list: List<String>) {
foo(Runnable {
list.filter(fun (element: String): Boolean {
if (element == "a") return false
if (element == "b") return@Runnable
return true
})
})
foo(
Runnable {
list.filter(fun (element: String): Boolean {
if (element == "a") return false
if (element == "b") return@Runnable
return true
})
}
)
}
@@ -3,9 +3,11 @@
fun foo(runnable: Runnable) {}
fun bar(p: Int) {
foo(Runnable {
if (p < 0) return@Runnable
println("a")
println("b")
})
foo(
Runnable {
if (p < 0) return@Runnable
println("a")
println("b")
}
)
}
@@ -5,8 +5,10 @@ import java.io.FilenameFilter
fun foo(filter: FilenameFilter) {}
fun bar() {
foo(FilenameFilter { file, name ->
if (file.isDirectory) return@FilenameFilter true
name == "x"
})
foo(
FilenameFilter { file, name ->
if (file.isDirectory) return@FilenameFilter true
name == "x"
}
)
}
@@ -5,18 +5,20 @@ import java.io.FileFilter
fun foo(filter: FileFilter) {}
fun bar() {
foo(FileFilter { file ->
val name = file.name
if (name.startsWith("a")) {
false
}
else {
if (name.endsWith("b"))
true
else {
val l = name.length
l > 10
foo(
FileFilter { file ->
val name = file.name
if (name.startsWith("a")) {
false
}
else {
if (name.endsWith("b"))
true
else {
val l = name.length
l > 10
}
}
}
}
})
)
}
@@ -5,17 +5,19 @@ import java.io.FileFilter
fun foo(filter: FileFilter) {}
fun bar() {
foo(FileFilter { file ->
val name = file.name
when (name) {
"foo" -> true
foo(
FileFilter { file ->
val name = file.name
when (name) {
"foo" -> true
"bar" -> false
"bar" -> false
else -> {
if (name.startsWith("a")) return@FileFilter true
false
else -> {
if (name.startsWith("a")) return@FileFilter true
false
}
}
}
}
})
)
}
@@ -3,8 +3,10 @@
import javax.swing.SwingUtilities
fun bar(p: Int) {
SwingUtilities.invokeLater(Runnable {
if (p < 0) return@Runnable
throw UnsupportedOperationException()
})
SwingUtilities.invokeLater(
Runnable {
if (p < 0) return@Runnable
throw UnsupportedOperationException()
}
)
}
@@ -5,8 +5,10 @@ import java.io.FileFilter
fun foo(filter: FileFilter) {}
fun bar() {
foo(FileFilter { file ->
val name = file.name
name.startsWith("a")
})
foo(
FileFilter { file ->
val name = file.name
name.startsWith("a")
}
)
}
@@ -4,7 +4,9 @@ interface C {
class D(val c: C) {
fun foo() {
this.c/* and this is c */.set("a", // it's "a"
"b" /* and this is "b" */, /* we use 10 */10)
this.c/* and this is c */.set(
"a", // it's "a"
"b" /* and this is "b" */, /* we use 10 */10
)
}
}
@@ -1,7 +1,9 @@
fun main() {
J().foo(object : J.Sam {
override fun bar() {
J().foo(
object : J.Sam {
override fun bar() {
}
})
}
}
)
}
@@ -7,7 +7,9 @@ fun newFun(p1: Int, a: Int, p2: Int, p3: Int, b: Int){}
fun foo() {
newFun(0, // 0
newFun(
0, // 0
-1, 1, // 1
2, // 2
-2)
-2
)
@@ -7,7 +7,12 @@ fun newFun(p4: Int, p3: Int, p2: Int, p1: Int, p0: Int){}
fun foo() {
newFun(/* 4 */ 4, 3, 2, // 2
/* 1 */ 1,
/* 0 */ 0)
newFun(
/* 4 */
4, 3, 2, // 2
/* 1 */
1,
/* 0 */
0
)
}
@@ -8,7 +8,8 @@ interface X {
fun newFun(x: X, a: Int, b: Int){}
fun foo(x: X) {
newFun(x/*receiver*/, 1, // pass 1
newFun(
x/*receiver*/, 1, // pass 1
2 // pass 2
)
}
@@ -11,5 +11,6 @@ fun foo(x: X) {
x.newFun(
1,
2,
0)
0
)
}
@@ -8,7 +8,9 @@ interface X {
}
fun foo(x: X) {
x.<caret>newFun(1,
x.<caret>newFun(
1,
2,
3)
3
)
}
@@ -18,7 +18,9 @@ fun useSimple(s: Int): Int {
fun println(s: String) {}
fun useIt() {
val t = useSimple(simple {
println("abc")
})
val t = useSimple(
simple {
println("abc")
}
)
}
@@ -36,5 +36,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)
}, Unit
)
}
@@ -3,15 +3,19 @@ fun <caret>foo(a: Int, b: Int, d: Int, c: Int, e: Int) {
}
fun test() {
foo(1,
foo(
1,
2,
4,
3,
5)
foo(1, 2,
5
)
foo(
1, 2,
4,
3,
5)
5
)
foo(
1,
2,
@@ -3,7 +3,11 @@ fun foo(x: Int, cl: () -> Int, y: Int): Int {
}
fun bar() {
foo(1, {
3
}, 2)
foo(
1,
{
3
},
2
)
}
@@ -1,18 +1,24 @@
interface T {
fun foo(a: Int = 1,
b: String = "2")
fun foo(
a: Int = 1,
b: String = "2"
)
}
open class A: T {
override fun foo(a: Int,
b: String) {
override fun foo(
a: Int,
b: String
) {
throw UnsupportedOperationException()
}
}
class B: A() {
override fun foo(a: Int,
b: String) {
override fun foo(
a: Int,
b: String
) {
throw UnsupportedOperationException()
}
}
@@ -3,8 +3,10 @@ fun <caret>foo(b: Int, c: Int) {
}
fun test() {
foo(2,
3)
foo(
2,
3
)
foo(2, 3)
foo(
2,
@@ -3,8 +3,10 @@ fun <caret>foo(a: Int, c: Int) {
}
fun test() {
foo(1,
3)
foo(
1,
3
)
foo(1, 3)
foo(
1,
@@ -3,8 +3,10 @@ fun <caret>foo(a: Int, b: Int) {
}
fun test() {
foo(1,
2)
foo(
1,
2
)
foo(1, 2)
foo(
1,
@@ -3,11 +3,15 @@ fun <caret>foo(c: Int, b: Int, a: Int) {
}
fun test() {
foo(3,
foo(
3,
2,
1)
foo(3, 2,
1)
1
)
foo(
3, 2,
1
)
foo(
3,
2,
@@ -3,5 +3,6 @@ fun callInDefault(simple: List<String> = provideSimple(), complex: List<String>
val result = mutableListOf("statement 1")
result.add("statement 2")
result
}) {
}
) {
}
@@ -1,6 +1,8 @@
fun g() {
println(listOf("a", "b").any {
if (it.isEmpty()) return@any false
it.length < 10
})
}
println(
listOf("a", "b").any {
if (it.isEmpty()) return@any false
it.length < 10
}
)
}
@@ -1,8 +1,10 @@
fun foo(i: Int) { }
fun test(i: () -> Int = {
(1
+ 2)
}) {
fun test(
i: () -> Int = {
(1
+ 2)
}
) {
foo(i())
}
@@ -1,8 +1,10 @@
fun foo(i: Int) { }
fun test(i: () -> Int = {
(1 // abc
/*def*/ + 2)
}) {
fun test(
i: () -> Int = {
(1 // abc
/*def*/ + 2)
}
) {
foo(i())
}
@@ -1,8 +1,10 @@
fun foo(i: Int) { }
fun test(i: () -> Int = {
(1
+ 2 - 3)
}) {
fun test(
i: () -> Int = {
(1
+ 2 - 3)
}
) {
foo(i())
}
@@ -1,8 +1,10 @@
fun foo(i: Int) { }
fun test(i: () -> Int = {
(1 + 2
- 3)
}) {
fun test(
i: () -> Int = {
(1 + 2
- 3)
}
) {
foo(i())
}
@@ -1,7 +1,10 @@
fun foo(a: Int, s: (Int) -> String = { a ->
"""c$a
fun foo(
a: Int,
s: (Int) -> String = { a ->
"""c$a
:${a + 1}d"""
}): String {
}
): String {
val x = """_${s(a)}_"""
val y = "_$a:${a + 1}d_"
val z = """_c$a:${a + 1}d_"""
@@ -1,6 +1,8 @@
fun foo(i: Int) { }
fun test(i: Int = (1
+ 2)) {
fun test(
i: Int = (1
+ 2)
) {
foo(i)
}
@@ -1,6 +1,8 @@
fun foo(i: Int) { }
fun test(i: Int = (1 // abc
/*def*/ + 2)) {
fun test(
i: Int = (1 // abc
/*def*/ + 2)
) {
foo(i)
}
@@ -1,6 +1,8 @@
fun foo(i: Int) { }
fun test(i: Int = (1
+ 2 - 3)) {
fun test(
i: Int = (1
+ 2 - 3)
) {
foo(i)
}
@@ -1,6 +1,8 @@
fun foo(i: Int) { }
fun test(i: Int = (1 + 2
- 3)) {
fun test(
i: Int = (1 + 2
- 3)
) {
foo(i)
}
@@ -1,5 +1,8 @@
fun foo(a: Int, s: String = """c$a
:${a + 1}d"""): String {
fun foo(
a: Int,
s: String = """c$a
:${a + 1}d"""
): String {
val x = """_${s}_"""
val y = "_$a:${a + 1}d_"
val z = """_c$a:${a + 1}d_"""
@@ -10,8 +10,10 @@ fun boo(s: Second, body: () -> Unit) { }
fun foo(s: Second) {
boo(s) {
s.testInvoke[{
s.testInvoke[
{
"Hello"
}]
}
]
}
}
@@ -10,8 +10,10 @@ fun boo(s: Second?, body: () -> Unit) { }
fun foo(s: Second?) {
boo(s) {
s?.testInvoke[{
s?.testInvoke[
{
"Hello"
}]
}
]
}
}
@@ -994,7 +994,7 @@ class SmartEnterTest : KotlinLightCodeInsightFixtureTestCase() {
}
""",
"""
some { (p: Int) : Int ->
some { (p: Int): Int ->
<caret>
}
"""
@@ -1007,8 +1007,7 @@ class SmartEnterTest : KotlinLightCodeInsightFixtureTestCase() {
}
""",
"""
some {
(p: Int) : Int ->
some { (p: Int): Int ->
<caret>
}
"""
@@ -1463,7 +1462,7 @@ class SmartEnterTest : KotlinLightCodeInsightFixtureTestCase() {
"""
fun foo(i: Int) = 1
fun test4() {
foo(1, <caret>)
foo(1<caret>)
}
"""
)
@@ -2,5 +2,7 @@ internal annotation class A
internal annotation class B
class U(@param:A @field:B
var i: Int)
class U(
@param:A @field:B
var i: Int
)
@@ -1,5 +1,7 @@
internal annotation class Anon(val stringArray: Array<String>, val intArray: IntArray, // string
val string: String)
internal annotation class Anon(
val stringArray: Array<String>, val intArray: IntArray, // string
val string: String
)
@Anon(string = "a", stringArray = ["a", "b"], intArray = [1, 2])
@Target(AnnotationTarget.CONSTRUCTOR, AnnotationTarget.FIELD)
@@ -1,6 +1,5 @@
internal class C(
private val p1: Int /* parameter p1 */ // field p1
,
private val p1: Int, /* parameter p1 */ // field p1
/**
* Field myP2
*/
@@ -1,12 +1,18 @@
internal class C1(arg1: Int,
arg2: Int,
arg3: Int) {
internal class C1(
arg1: Int,
arg2: Int,
arg3: Int
) {
constructor(x: Int,
y: Int) : this(x, x + y, 0) {
constructor(
x: Int,
y: Int
) : this(x, x + y, 0) {
}
}
internal class C2(private val arg1: Int,
private val arg2: Int,
arg3: Int)
internal class C2(
private val arg1: Int,
private val arg2: Int,
arg3: Int
)
+2 -1
View File
@@ -1,4 +1,5 @@
internal class A(// comment for field2 getter
internal class A(
// comment for field2 getter
// comment for field2 setter
var field2: Int // comment for field2
) {
@@ -1,6 +1,8 @@
internal annotation class TestAnnotation
class Test(@param:TestAnnotation @field:TestAnnotation
@get:TestAnnotation
@set:TestAnnotation
var arg: String?)
class Test(
@param:TestAnnotation @field:TestAnnotation
@get:TestAnnotation
@set:TestAnnotation
var arg: String?
)
@@ -1,7 +1,9 @@
@Deprecated("Ph'nglui mglw'nafh\n" +
" Cthulhu R'lyeh wgah'nagl fhtagn.\n" +
" 'In His House at R'lyeh\n" +
" Dead Cthulhu waits dreaming,\n" +
" yet He shall rise and His kingdom\n" +
" shall cover the Earth.'")
@Deprecated(
"Ph'nglui mglw'nafh\n" +
" Cthulhu R'lyeh wgah'nagl fhtagn.\n" +
" 'In His House at R'lyeh\n" +
" Dead Cthulhu waits dreaming,\n" +
" yet He shall rise and His kingdom\n" +
" shall cover the Earth.'"
)
class TestDeprecatedInJavadocWithMultilineMessage
+4 -2
View File
@@ -2,7 +2,9 @@ internal enum class Color : Runnable {
WHITE, BLACK, RED, YELLOW, BLUE;
override fun run() {
println("name()=" + name +
", toString()=" + toString())
println(
"name()=" + name +
", toString()=" + toString()
)
}
}
@@ -2,9 +2,10 @@ internal class F {
fun f1(p1: Int, p2: Int, p3: Int, p4: Int, vararg p5: Int) {}
fun f2(array: IntArray) {
f1(1, 2,
f1(
1, 2,
3, 4,
*array
)
}
}
}
@@ -3,11 +3,14 @@ internal class C {
fun foo2(
p1: Int,
p2: Int) {
p2: Int
) {
}
fun foo3(p1: Int,
p2: Int) {
fun foo3(
p1: Int,
p2: Int
) {
}
fun foo4(
@@ -2,11 +2,13 @@
import java.util.*
internal class A<T> {
fun foo(nonMutableCollection: Collection<String>,
fun foo(
nonMutableCollection: Collection<String>,
mutableCollection: MutableCollection<String>,
mutableSet: MutableSet<T>,
mutableMap: MutableMap<String, T>) {
mutableMap: MutableMap<String, T>
) {
mutableCollection.addAll(nonMutableCollection)
mutableSet.add(mutableMap.remove("a"))
}
}
}
@@ -2,8 +2,10 @@ internal class C(p1: Int, p2: Int, p3: Int)
internal class User {
fun foo() {
C(1,
C(
1,
2,
3)
3
)
}
}
}
+5 -3
View File
@@ -24,9 +24,11 @@ internal class Client : Frame() {
addWindowListener(a)
addWindowListener(object : WindowAdapter() {
override fun windowClosing() {}
})
addWindowListener(
object : WindowAdapter() {
override fun windowClosing() {}
}
)
val b = object : EmptyWindowListener {
@@ -5,10 +5,12 @@ internal interface I {
internal class C {
val `object`: Any?
get() {
foo(object : I {
override val int: Int
get() = 0
})
foo(
object : I {
override val int: Int
get() = 0
}
)
return string
}
@@ -9,12 +9,15 @@ class C {
@Throws(IOException::class)
internal fun foo() {
ByteArrayInputStream(ByteArray(10)).use { stream ->
bar(object : I {
@Throws(IOException::class)
override fun doIt(stream: InputStream): Int {
return stream.available()
}
}, stream)
bar(
object : I {
@Throws(IOException::class)
override fun doIt(stream: InputStream): Int {
return stream.available()
}
},
stream
)
}
}
@@ -22,4 +25,4 @@ class C {
internal fun bar(i: I, stream: InputStream): Int {
return i.doIt(stream)
}
}
}
@@ -9,12 +9,15 @@ class C {
@Throws(IOException::class)
internal fun foo(): Int {
ByteArrayInputStream(ByteArray(10)).use { stream ->
return bar(object : I {
@Throws(IOException::class)
override fun doIt(stream: InputStream): Int {
return stream.available()
}
}, stream)
return bar(
object : I {
@Throws(IOException::class)
override fun doIt(stream: InputStream): Int {
return stream.available()
}
},
stream
)
}
}
@@ -22,4 +25,4 @@ class C {
internal fun bar(i: I, stream: InputStream): Int {
return i.doIt(stream)
}
}
}
+1 -1
View File
@@ -13,7 +13,7 @@ class A {
return JetBundle.message(
"x.in.y",
DescriptorRenderer.COMPACT.render(declarationDescriptor),
IdeDescriptorRenderers.SOURCE_CODE_SHORT_NAMES_NO_ANNOTATIONS.render(containingDescriptor)
IdeDescriptorRenderers.SOURCE_CODE_SHORT_NAMES_NO_ANNOTATIONS.render(containingDescriptor),
)
}
}
+4 -2
View File
@@ -1,5 +1,7 @@
internal annotation class Anon(val stringArray: Array<String>, val intArray: IntArray, // string
val string: String)
internal annotation class Anon(
val stringArray: Array<String>, val intArray: IntArray, // string
val string: String
)
@Anon(string = "a", stringArray = ["a", "b"], intArray = [1, 2])
@Target(AnnotationTarget.CONSTRUCTOR, AnnotationTarget.FIELD)
+2 -1
View File
@@ -1,7 +1,8 @@
import javaApi.SpecialExternal
//Annotation class:
annotation class Special(val names: Array<String> //array is used
annotation class Special(
val names: Array<String> //array is used
) //Class with annotation:
@Special(names = ["name1"])
@@ -1,7 +1,9 @@
internal class C(// field p1
private val p1: Int /* parameter p1 */,
internal class C(
// field p1
private val p1: Int, /* parameter p1 */
/**
* Field myP2
*/
private val myP2: Int, /* Field p3 */
var p3: Int)
var p3: Int
)
@@ -1,11 +1,17 @@
internal class C1(arg1: Int,
arg2: Int,
arg3: Int) {
constructor(x: Int,
y: Int) : this(x, x + y, 0) {
internal class C1(
arg1: Int,
arg2: Int,
arg3: Int
) {
constructor(
x: Int,
y: Int
) : this(x, x + y, 0) {
}
}
internal class C2(private val arg1: Int,
private val arg2: Int,
arg3: Int)
internal class C2(
private val arg1: Int,
private val arg2: Int,
arg3: Int
)
+4 -2
View File
@@ -1,7 +1,9 @@
internal class A(// comment for field2 setter
internal class A(
// comment for field2 setter
// comment for field2 getter
var field2 // comment for field2
: Int) {
: Int
) {
/**
* Comment for field1 setter
*/
@@ -2,6 +2,8 @@ internal annotation class TestAnnotationField
internal annotation class TestAnnotationParam
internal annotation class TestAnnotationGet
internal annotation class TestAnnotationSet
class Test(@field:TestAnnotationField @set:TestAnnotationSet
@get:TestAnnotationGet
@param:TestAnnotationParam var arg: String)
class Test(
@field:TestAnnotationField @set:TestAnnotationSet
@get:TestAnnotationGet
@param:TestAnnotationParam var arg: String
)

Some files were not shown because too many files have changed in this diff Show More