Formatter: now always adds space between reference expression and function literal. Test is included.

#KT-3932 fixed
This commit is contained in:
sayon
2013-08-27 17:54:25 +04:00
parent a0500f56d2
commit a3bfd25825
4 changed files with 12 additions and 0 deletions
@@ -113,6 +113,8 @@ public class JetFormattingModelBuilder implements FormattingModelBuilder {
.beforeInside(LBRACE, WHEN).spacing(1, 1, 0, true, 0) //omit blank lines before '{' in 'when' statement
.aroundInside(ARROW, FUNCTION_TYPE).spaceIf(jetSettings.SPACE_AROUND_FUNCTION_TYPE_ARROW)
.betweenInside(REFERENCE_EXPRESSION, FUNCTION_LITERAL_EXPRESSION, CALL_EXPRESSION).spaces(1)
;
}
@@ -0,0 +1,3 @@
fun f() {
array(1, 2, 3).map{ v -> v }
}
@@ -0,0 +1,3 @@
fun f() {
array(1, 2, 3).map { v -> v }
}
@@ -147,6 +147,10 @@ public class JetFormatterTest extends AbstractJetFormatterTest {
doTestWithInvert();
}
public void testReferenceExpressionFunctionLiteral() throws Exception {
doTest();
}
@Override
public void doTest() throws Exception {
String originalFileText = AbstractJetFormatterTest.loadFile(getTestName(false) + ".kt");