From bd2e5c73c94673991aa5a34090337c92e650197d Mon Sep 17 00:00:00 2001 From: Carmi Grushko Date: Sun, 8 May 2022 03:18:06 -0700 Subject: [PATCH] Update ktfmt component on FBS:master Reviewed By: strulovich Differential Revision: D36123426 fbshipit-source-id: 32cb667623564a38def123d20b88179bffe20cdb --- .../com/facebook/ktfmt/format/KotlinInputAstVisitor.kt | 3 ++- .../java/com/facebook/ktfmt/format/TypeNameClassifier.kt | 8 +++++--- .../main/java/com/facebook/ktfmt/kdoc/KDocFormatter.kt | 3 ++- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/core/src/main/java/com/facebook/ktfmt/format/KotlinInputAstVisitor.kt b/core/src/main/java/com/facebook/ktfmt/format/KotlinInputAstVisitor.kt index b84a8573..1a0136a5 100644 --- a/core/src/main/java/com/facebook/ktfmt/format/KotlinInputAstVisitor.kt +++ b/core/src/main/java/com/facebook/ktfmt/format/KotlinInputAstVisitor.kt @@ -636,7 +636,8 @@ class KotlinInputAstVisitor( lastIndexToOpen = index } } - is KtArrayAccessExpression, is KtPostfixExpression -> { + is KtArrayAccessExpression, + is KtPostfixExpression -> { // we group these with the last item with a name, and we always close them groupingInfos[lastIndexToOpen].groupOpenCount++ } diff --git a/core/src/main/java/com/facebook/ktfmt/format/TypeNameClassifier.kt b/core/src/main/java/com/facebook/ktfmt/format/TypeNameClassifier.kt index ac4fb7f5..eba3ccc6 100644 --- a/core/src/main/java/com/facebook/ktfmt/format/TypeNameClassifier.kt +++ b/core/src/main/java/com/facebook/ktfmt/format/TypeNameClassifier.kt @@ -47,8 +47,9 @@ object TypeNameClassifier { TYPE(true) { override fun next(n: JavaCaseFormat): TyParseState { return when (n) { - JavaCaseFormat.UPPERCASE, JavaCaseFormat.LOWER_CAMEL, JavaCaseFormat.LOWERCASE -> - FIRST_STATIC_MEMBER + JavaCaseFormat.UPPERCASE, + JavaCaseFormat.LOWER_CAMEL, + JavaCaseFormat.LOWERCASE -> FIRST_STATIC_MEMBER JavaCaseFormat.UPPER_CAMEL -> TYPE } } @@ -73,7 +74,8 @@ object TypeNameClassifier { override fun next(n: JavaCaseFormat): TyParseState { return when (n) { JavaCaseFormat.UPPERCASE -> AMBIGUOUS - JavaCaseFormat.LOWER_CAMEL, JavaCaseFormat.LOWERCASE -> REJECT + JavaCaseFormat.LOWER_CAMEL, + JavaCaseFormat.LOWERCASE -> REJECT JavaCaseFormat.UPPER_CAMEL -> TYPE } } diff --git a/core/src/main/java/com/facebook/ktfmt/kdoc/KDocFormatter.kt b/core/src/main/java/com/facebook/ktfmt/kdoc/KDocFormatter.kt index 0c2ec537..f49ac3d9 100644 --- a/core/src/main/java/com/facebook/ktfmt/kdoc/KDocFormatter.kt +++ b/core/src/main/java/com/facebook/ktfmt/kdoc/KDocFormatter.kt @@ -94,7 +94,8 @@ object KDocFormatter { KDocTokens.LEADING_ASTERISK -> Unit // Ignore, no need to output anything KDocTokens.TAG_NAME -> tokens.add(KDocToken(TAG, tokenText)) KDocTokens.CODE_BLOCK_TEXT -> tokens.add(KDocToken(CODE, tokenText)) - KDocTokens.MARKDOWN_INLINE_LINK, KDocTokens.MARKDOWN_LINK -> { + KDocTokens.MARKDOWN_INLINE_LINK, + KDocTokens.MARKDOWN_LINK -> { tokens.add(KDocToken(MARKDOWN_LINK, tokenText)) } KDocTokens.TEXT -> {