Change formatting of function expressions without names

No spaces between 'fun' and value parameter list
This commit is contained in:
Denis Zharkov
2015-05-19 11:17:06 +03:00
parent 2deb7faf05
commit b650753643
8 changed files with 19 additions and 13 deletions
@@ -139,6 +139,7 @@ fun createSpacingBuilder(settings: CodeStyleSettings): KotlinSpacingBuilder {
betweenInside(FUN_KEYWORD, IDENTIFIER, FUN).spaces(1)
betweenInside(FUN_KEYWORD, TYPE_REFERENCE, FUN).spaces(1)
betweenInside(FUN_KEYWORD, VALUE_PARAMETER_LIST, FUN).spacing(0, 0, 0, false, 0)
betweenInside(TYPE_REFERENCE, DOT, FUN).spacing(0, 0, 0, false, 0)
betweenInside(DOT, IDENTIFIER, FUN).spacing(0, 0, 0, false, 0)
afterInside(IDENTIFIER, FUN).spacing(0, 0, 0, false, 0)
@@ -1,4 +1,4 @@
val a = fun () {
val a = fun() {
}
val b = fun test() {
}
@@ -17,6 +17,8 @@ val c = fun() = 4
fun test() = fun test() = 4
fun test() {
test(fun() {
})
test(fun test() {
})
test(fun test() = 5)
@@ -1,18 +1,21 @@
val a = fun () {}
val b = fun test() {}
val c=fun(){}
val c=fun()=4
val c=fun (){}
val c=fun ()=4
val c=fun()=
val c=fun ()=
4
val c = fun() {}
val c = fun() = 4
val c = fun () = 4
fun test() = fun test() = 4
fun test() {
test(fun
() {
})
test(fun test() {})
test(fun test() = 5)
@@ -6,5 +6,5 @@ fun foo(a: Any) {}
val a = foo a@ {
val a = fun (): Int = 1
val a = fun(): Int = 1
}
@@ -3,4 +3,4 @@ val h = { -> }
val l = bar@ fun Int.bar() {
}
val s = (fun (): Int = 5)()
val s = (fun(): Int = 5)()
@@ -1,8 +1,8 @@
// "Migrate lambda syntax in whole project" "true"
val a = fun (): Int {
val a = fun(): Int {
val b = fun (): Int = 5
val b = fun(): Int = 5
return b()
}
@@ -1,7 +1,7 @@
// "Migrate lambda syntax" "true"
val a = fun (p: Int): String {
val a = fun(p: Int): String {
val v = p + 1
return v.toString()
// returns v.toString()
@@ -871,7 +871,7 @@ class SmartEnterTest : JetLightCodeInsightFixtureTestCase() {
"""
,
"""
fun (p: Int, s: String) {
fun(p: Int, s: String) {
<caret>
}
"""
@@ -886,7 +886,7 @@ class SmartEnterTest : JetLightCodeInsightFixtureTestCase() {
,
"""
trait Some {
fun (p: Int)
fun(p: Int)
<caret>
}
"""
@@ -901,7 +901,7 @@ class SmartEnterTest : JetLightCodeInsightFixtureTestCase() {
,
"""
class Some {
abstract fun (p: Int)
abstract fun(p: Int)
<caret>
}
"""