diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/RemoveRedundantBackticksInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/RemoveRedundantBackticksInspection.kt index f62b1d248f1..524930a8fe1 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/RemoveRedundantBackticksInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/RemoveRedundantBackticksInspection.kt @@ -46,7 +46,7 @@ class RemoveRedundantBackticksInspection : AbstractKotlinInspection() { } private fun isKeyword(text: String): Boolean { - return (KtTokens.KEYWORDS.types + KtTokens.SOFT_KEYWORDS.types).any { it.toString() == text } + return text == "yield" || (KtTokens.KEYWORDS.types + KtTokens.SOFT_KEYWORDS.types).any { it.toString() == text } } private fun isRedundantBackticks(node: ASTNode): Boolean { @@ -57,10 +57,12 @@ class RemoveRedundantBackticksInspection : AbstractKotlinInspection() { } private fun registerProblem(holder: ProblemsHolder, element: PsiElement) { - holder.registerProblem(element, - "Remove redundant backticks", - ProblemHighlightType.GENERIC_ERROR_OR_WARNING, - RemoveRedundantBackticksQuickFix()) + holder.registerProblem( + element, + "Remove redundant backticks", + ProblemHighlightType.GENERIC_ERROR_OR_WARNING, + RemoveRedundantBackticksQuickFix() + ) } } diff --git a/idea/testData/inspectionsLocal/removeRedundantBackticks/yield.kt b/idea/testData/inspectionsLocal/removeRedundantBackticks/yield.kt new file mode 100644 index 00000000000..aa2702333b6 --- /dev/null +++ b/idea/testData/inspectionsLocal/removeRedundantBackticks/yield.kt @@ -0,0 +1,7 @@ +// PROBLEM: none + +fun test() { + foo(`yield` = 1) +} + +fun foo(yield: Int) {} \ No newline at end of file diff --git a/idea/tests/org/jetbrains/kotlin/idea/inspections/LocalInspectionTestGenerated.java b/idea/tests/org/jetbrains/kotlin/idea/inspections/LocalInspectionTestGenerated.java index 19fecfea053..b78ecc2eb3d 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/inspections/LocalInspectionTestGenerated.java +++ b/idea/tests/org/jetbrains/kotlin/idea/inspections/LocalInspectionTestGenerated.java @@ -4586,6 +4586,11 @@ public class LocalInspectionTestGenerated extends AbstractLocalInspectionTest { public void testProperty() throws Exception { runTest("idea/testData/inspectionsLocal/removeRedundantBackticks/property.kt"); } + + @TestMetadata("yield.kt") + public void testYield() throws Exception { + runTest("idea/testData/inspectionsLocal/removeRedundantBackticks/yield.kt"); + } } @TestMetadata("idea/testData/inspectionsLocal/removeRedundantSpreadOperator")