"Remove redundant backticks": Fix false positive for underscore
#KT-28592 Fixed
This commit is contained in:
committed by
Mikhail Glukhikh
parent
84222afe2f
commit
d00236d366
+1
-1
@@ -46,7 +46,7 @@ class RemoveRedundantBackticksInspection : AbstractKotlinInspection() {
|
||||
}
|
||||
|
||||
private fun isKeyword(text: String): Boolean {
|
||||
return text == "yield" || (KtTokens.KEYWORDS.types + KtTokens.SOFT_KEYWORDS.types).any { it.toString() == text }
|
||||
return text == "yield" || text == "_" || (KtTokens.KEYWORDS.types + KtTokens.SOFT_KEYWORDS.types).any { it.toString() == text }
|
||||
}
|
||||
|
||||
private fun isRedundantBackticks(node: ASTNode): Boolean {
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
// PROBLEM: none
|
||||
|
||||
fun test() {
|
||||
try {
|
||||
} catch (_: Throwable) {
|
||||
<caret>`_`.printStackTrace()
|
||||
}
|
||||
}
|
||||
+5
@@ -5474,6 +5474,11 @@ public class LocalInspectionTestGenerated extends AbstractLocalInspectionTest {
|
||||
runTest("idea/testData/inspectionsLocal/removeRedundantBackticks/property.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("underscore.kt")
|
||||
public void testUnderscore() throws Exception {
|
||||
runTest("idea/testData/inspectionsLocal/removeRedundantBackticks/underscore.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("yield.kt")
|
||||
public void testYield() throws Exception {
|
||||
runTest("idea/testData/inspectionsLocal/removeRedundantBackticks/yield.kt");
|
||||
|
||||
Reference in New Issue
Block a user