diff --git a/plugins/kotlin/base/analysis/src/org/jetbrains/kotlin/idea/caches/trackers/PureKotlinCodeBlockModificationListener.kt b/plugins/kotlin/base/analysis/src/org/jetbrains/kotlin/idea/caches/trackers/PureKotlinCodeBlockModificationListener.kt index c02498586117..7c456ea5821b 100644 --- a/plugins/kotlin/base/analysis/src/org/jetbrains/kotlin/idea/caches/trackers/PureKotlinCodeBlockModificationListener.kt +++ b/plugins/kotlin/base/analysis/src/org/jetbrains/kotlin/idea/caches/trackers/PureKotlinCodeBlockModificationListener.kt @@ -75,7 +75,7 @@ class PureKotlinCodeBlockModificationListener(val project: Project) : Disposable private inline fun isStringLiteralChange(changeSet: TreeChangeEvent): Boolean = isSpecificChange(changeSet) { it?.elementType == KtTokens.REGULAR_STRING_PART && - it?.psi?.parentOfTypes(KtAnnotationEntry::class, KtWhenCondition::class) == null + it?.psi?.parentOfTypes(KtAnnotationEntry::class, KtIfExpression::class, KtWhenCondition::class) == null } /** diff --git a/plugins/kotlin/idea/tests/test/org/jetbrains/kotlin/idea/codeInsight/OutOfBlockModificationTestGenerated.java b/plugins/kotlin/idea/tests/test/org/jetbrains/kotlin/idea/codeInsight/OutOfBlockModificationTestGenerated.java index 254e0fd9bd83..a12c3c0fd1d9 100644 --- a/plugins/kotlin/idea/tests/test/org/jetbrains/kotlin/idea/codeInsight/OutOfBlockModificationTestGenerated.java +++ b/plugins/kotlin/idea/tests/test/org/jetbrains/kotlin/idea/codeInsight/OutOfBlockModificationTestGenerated.java @@ -213,6 +213,11 @@ public class OutOfBlockModificationTestGenerated extends AbstractOutOfBlockModif runTest("testData/codeInsight/outOfBlock/InGlobalPropertyWithGetter.kt"); } + @TestMetadata("InIfCondition.kt") + public void testInIfCondition() throws Exception { + runTest("testData/codeInsight/outOfBlock/InIfCondition.kt"); + } + @TestMetadata("InKDocComment.kt") public void testInKDocComment() throws Exception { runTest("testData/codeInsight/outOfBlock/InKDocComment.kt"); diff --git a/plugins/kotlin/idea/tests/testData/codeInsight/outOfBlock/InIfCondition.kt b/plugins/kotlin/idea/tests/testData/codeInsight/outOfBlock/InIfCondition.kt new file mode 100644 index 000000000000..ace8e9585f3b --- /dev/null +++ b/plugins/kotlin/idea/tests/testData/codeInsight/outOfBlock/InIfCondition.kt @@ -0,0 +1,10 @@ +// OUT_OF_CODE_BLOCK: FALSE +// ENABLE-WARNINGS + +fun foo(count: Int): String { + return if (count == 0) { + "still zero" + } else { + "no longer zero!" + } +} \ No newline at end of file