Formatter: Remove spaces before question mark in nullable types (KT-12830)

#KT-12830 Fixed
This commit is contained in:
Kirill Rakhman
2016-06-23 22:54:30 +02:00
committed by Nikolay Krasko
parent 9a50e91cd8
commit 0320bd8184
5 changed files with 16 additions and 0 deletions
+6
View File
@@ -7,6 +7,12 @@
## 1.0.4
### IDE
###### Issues fixed
- [`KT-12830`](https://youtrack.jetbrains.com/issue/KT-12830) Remove spaces before *?* in nullable types
## 1.0.3
### Compiler
@@ -223,6 +223,8 @@ fun createSpacingBuilder(settings: CodeStyleSettings, builderUtil: KotlinSpacing
beforeInside(INITIALIZER_LIST, ENUM_ENTRY).spaces(0)
beforeInside(QUEST, NULLABLE_TYPE).spaces(0)
val TYPE_COLON_ELEMENTS = TokenSet.create(PROPERTY, FUN, VALUE_PARAMETER, DESTRUCTURING_DECLARATION_ENTRY, FUNCTION_LITERAL)
beforeInside(COLON, TYPE_COLON_ELEMENTS) { spaceIf(kotlinSettings.SPACE_BEFORE_TYPE_COLON) }
afterInside(COLON, TYPE_COLON_ELEMENTS) { spaceIf(kotlinSettings.SPACE_AFTER_TYPE_COLON) }
+1
View File
@@ -0,0 +1 @@
fun foo(): String? = ""
+1
View File
@@ -0,0 +1 @@
fun foo(): String ? = ""
@@ -433,6 +433,12 @@ public class FormatterTestGenerated extends AbstractFormatterTest {
doTest(fileName);
}
@TestMetadata("NullableType.after.kt")
public void testNullableType() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/formatter/NullableType.after.kt");
doTest(fileName);
}
@TestMetadata("ObjectInBody.after.kt")
public void testObjectInBody() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/formatter/ObjectInBody.after.kt");