From 2f0b30cdc4db2645d2a0e5a391c5b136050f324f Mon Sep 17 00:00:00 2001 From: Tagir Valeev Date: Thu, 14 Nov 2024 16:11:22 +0100 Subject: [PATCH] [kotlin-dfa] Test for KTIJ-31635 GitOrigin-RevId: 18e8b35a237f588485edea8c6acf1b4945a50472 --- .../idea/k2/inspections/tests/K2DataFlowInspectionTest.kt | 1 + .../idea/tests/testData/inspections/dfa/NestedThis.kt | 7 +++++++ 2 files changed, 8 insertions(+) create mode 100644 plugins/kotlin/idea/tests/testData/inspections/dfa/NestedThis.kt diff --git a/plugins/kotlin/code-insight/inspections-k2/tests/test/org/jetbrains/kotlin/idea/k2/inspections/tests/K2DataFlowInspectionTest.kt b/plugins/kotlin/code-insight/inspections-k2/tests/test/org/jetbrains/kotlin/idea/k2/inspections/tests/K2DataFlowInspectionTest.kt index 799ce33f9785..c3ce62305b0a 100644 --- a/plugins/kotlin/code-insight/inspections-k2/tests/test/org/jetbrains/kotlin/idea/k2/inspections/tests/K2DataFlowInspectionTest.kt +++ b/plugins/kotlin/code-insight/inspections-k2/tests/test/org/jetbrains/kotlin/idea/k2/inspections/tests/K2DataFlowInspectionTest.kt @@ -82,6 +82,7 @@ class K2DataFlowInspectionTest : AbstractK2InspectionTest() { fun testMath() = doTest() fun testMembers() = doTest() fun testNestedLoopLabel() = doTest() + fun testNestedThis() = doTest() fun testNothingType() = doTest() fun testPlatformType() { // KTIJ-22430 diff --git a/plugins/kotlin/idea/tests/testData/inspections/dfa/NestedThis.kt b/plugins/kotlin/idea/tests/testData/inspections/dfa/NestedThis.kt new file mode 100644 index 000000000000..f4385ea83e85 --- /dev/null +++ b/plugins/kotlin/idea/tests/testData/inspections/dfa/NestedThis.kt @@ -0,0 +1,7 @@ +// WITH_STDLIB +fun Int.test() { + val cond1 = this == 1 + if (cond1 && this > 0) {} + val cond2 = this.run { this == 1 } + if (cond1 && cond2) {} +} \ No newline at end of file