Formatter: handle spaces around 'is' keyword (#874)

Fixes #KT-12548
This commit is contained in:
Kirill Rakhman
2016-05-30 19:35:33 +02:00
committed by Dmitry Jemerov
parent fbd671c158
commit 93ebb3da65
4 changed files with 17 additions and 0 deletions
@@ -166,6 +166,7 @@ fun createSpacingBuilder(settings: CodeStyleSettings, builderUtil: KotlinSpacing
afterInside(IDENTIFIER, FUN).spacing(0, 0, 0, false, 0)
around(AS_KEYWORD).spaces(1)
around(IS_KEYWORD).spaces(1)
aroundInside(IDENTIFIER, BINARY_EXPRESSION).spaces(1)
// before LPAR in constructor(): this() {}
+5
View File
@@ -0,0 +1,5 @@
fun f() {
if (1 is Int) {
}
}
+5
View File
@@ -0,0 +1,5 @@
fun f() {
if (1 is Int) {
}
}
@@ -349,6 +349,12 @@ public class FormatterTestGenerated extends AbstractFormatterTest {
doTest(fileName);
}
@TestMetadata("Is.after.kt")
public void testIs() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/formatter/Is.after.kt");
doTest(fileName);
}
@TestMetadata("KDoc.after.kt")
public void testKDoc() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/formatter/KDoc.after.kt");