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

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