Fix comment to KT-3370 about no formatting of spaces around colon in objects

#KT-3370 Fixed
This commit is contained in:
Nikolay Krasko
2014-04-24 17:57:06 +04:00
parent 17699f7f0e
commit 5e50b98103
5 changed files with 119 additions and 3 deletions
@@ -115,6 +115,8 @@ fun createSpacingBuilder(settings: CodeStyleSettings): KotlinSpacingBuilder {
afterInside(COLON, TYPE_CONSTRAINT).spaceIf(jetSettings.SPACE_AFTER_EXTEND_COLON)
beforeInside(COLON, CLASS).spaceIf(jetSettings.SPACE_BEFORE_EXTEND_COLON)
afterInside(COLON, CLASS).spaceIf(jetSettings.SPACE_AFTER_EXTEND_COLON)
beforeInside(COLON, OBJECT_DECLARATION).spaceIf(jetSettings.SPACE_BEFORE_EXTEND_COLON)
afterInside(COLON, OBJECT_DECLARATION).spaceIf(jetSettings.SPACE_AFTER_EXTEND_COLON)
beforeInside(COLON, TYPE_PARAMETER).spaceIf(jetSettings.SPACE_BEFORE_EXTEND_COLON)
afterInside(COLON, TYPE_PARAMETER).spaceIf(jetSettings.SPACE_AFTER_EXTEND_COLON)
@@ -0,0 +1,36 @@
trait A
object Some1: A {
}
object Some2: A
object Some3
:
A
val a = object: A {
}
val b = object: A {
}
class B {
class object: A {
}
}
class C {
class object:
A {
}
}
// SET_TRUE: SPACE_BEFORE_EXTEND_COLON
// SET_FALSE: SPACE_AFTER_EXTEND_COLON
@@ -0,0 +1,36 @@
trait A
object Some1 :A {
}
object Some2 :A
object Some3
:
A
val a = object :A {
}
val b = object :A {
}
class B {
class object :A {
}
}
class C {
class object :
A {
}
}
// SET_TRUE: SPACE_BEFORE_EXTEND_COLON
// SET_FALSE: SPACE_AFTER_EXTEND_COLON
@@ -0,0 +1,34 @@
trait A
object Some1 : A {
}
object Some2:A
object Some3
:
A
val a = object:A {}
val b = object : A {}
class B {
class object:A {
}
}
class C {
class object :
A {
}
}
// SET_TRUE: SPACE_BEFORE_EXTEND_COLON
// SET_FALSE: SPACE_AFTER_EXTEND_COLON
@@ -254,6 +254,11 @@ public class JetFormatterTestGenerated extends AbstractJetFormatterTest {
doTest("idea/testData/formatter/SpaceAroundExtendColon.after.kt");
}
@TestMetadata("SpaceAroundExtendColonInObjects.after.kt")
public void testSpaceAroundExtendColonInObjects() throws Exception {
doTest("idea/testData/formatter/SpaceAroundExtendColonInObjects.after.kt");
}
@TestMetadata("SpaceBeforeFunctionLiteral.after.kt")
public void testSpaceBeforeFunctionLiteral() throws Exception {
doTest("idea/testData/formatter/SpaceBeforeFunctionLiteral.after.kt");
@@ -327,9 +332,7 @@ public class JetFormatterTestGenerated extends AbstractJetFormatterTest {
@TestMetadata("idea/testData/formatter/modifierList")
public static class ModifierList extends AbstractJetFormatterTest {
public void testAllFilesPresentInModifierList() throws Exception {
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage",
new File("idea/testData/formatter/modifierList"),
Pattern.compile("^([^\\.]+)\\.after\\.kt.*$"), true);
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage", new File("idea/testData/formatter/modifierList"), Pattern.compile("^([^\\.]+)\\.after\\.kt.*$"), true);
}
@TestMetadata("funAnnotationBeforeAnnotation.after.kt")
@@ -514,6 +517,11 @@ public class JetFormatterTestGenerated extends AbstractJetFormatterTest {
doTestInverted("idea/testData/formatter/SpaceAroundExtendColon.after.inv.kt");
}
@TestMetadata("SpaceAroundExtendColonInObjects.after.inv.kt")
public void testSpaceAroundExtendColonInObjects() throws Exception {
doTestInverted("idea/testData/formatter/SpaceAroundExtendColonInObjects.after.inv.kt");
}
@TestMetadata("SpacesAroundOperations.after.inv.kt")
public void testSpacesAroundOperations() throws Exception {
doTestInverted("idea/testData/formatter/SpacesAroundOperations.after.inv.kt");