Fix redundant semicolon inspection before soft keywords

Fixes few tests:
 - RedundantSemicolon.testBetweenSoftModifierKeywordAndDeclaration
 - RedundantSemicolon.testBetweenSoftModifierKeywordAndDeclaration2
 - RedundantSemicolon.testBetweenSoftModifierKeywordAndDeclaration3

 This bug was introduced in 741ebeb7b8
This commit is contained in:
Mikhail Zarechenskiy
2020-07-03 15:03:05 +03:00
parent a0ecfce7b7
commit 9a08085146
@@ -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<KtNameReferenceExpression>()?.text in softModifierKeywords && nextSibling is KtDeclaration) {
// enum; class Foo
return false
return true
}
if (nextSibling is KtPrefixExpression && nextSibling.operationToken == KtTokens.EXCL) {