From 9a080851464823a6e33039f78467eaa4766ccae9 Mon Sep 17 00:00:00 2001 From: Mikhail Zarechenskiy Date: Fri, 3 Jul 2020 15:03:05 +0300 Subject: [PATCH] Fix redundant semicolon inspection before soft keywords Fixes few tests: - RedundantSemicolon.testBetweenSoftModifierKeywordAndDeclaration - RedundantSemicolon.testBetweenSoftModifierKeywordAndDeclaration2 - RedundantSemicolon.testBetweenSoftModifierKeywordAndDeclaration3 This bug was introduced in 741ebeb7b81355a68b03d2f20efeef479c01e222 --- .../kotlin/idea/inspections/RedundantSemicolonInspection.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantSemicolonInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantSemicolonInspection.kt index dbf94e1a8a8..d978ffbe003 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantSemicolonInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantSemicolonInspection.kt @@ -86,10 +86,10 @@ class RedundantSemicolonInspection : AbstractKotlinInspection(), CleanupLocalIns return false // case with statement starting with '{' and call on the previous line } - return !isSemicolonAllowed(semicolon) + return !isSemicolonRequired(semicolon) } - private fun isSemicolonAllowed(semicolon: PsiElement): Boolean { + private fun isSemicolonRequired(semicolon: PsiElement): Boolean { if (isRequiredForCompanion(semicolon)) { return true } @@ -99,7 +99,7 @@ class RedundantSemicolonInspection : AbstractKotlinInspection(), CleanupLocalIns if (prevSibling.safeAs()?.text in softModifierKeywords && nextSibling is KtDeclaration) { // enum; class Foo - return false + return true } if (nextSibling is KtPrefixExpression && nextSibling.operationToken == KtTokens.EXCL) {