diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/cfa/CfgTraverser.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/cfa/CfgTraverser.kt index a9c97806dc2..4bd1a2afb57 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/cfa/CfgTraverser.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/cfa/CfgTraverser.kt @@ -58,19 +58,17 @@ private fun , K : Any, V : Any> ControlFlowGraph.co if (direction == TraverseDirection.Backward && node is CFGNodeWithCfgOwner<*>) { node.subGraphs.forEach { it.collectDataForNodeInternal(direction, initialInfo, visitor, nodeMap, changed) } } - if (!(node.isEnterNode(direction) && node.owner.owner == null)) { - val previousNodes = when (direction) { - TraverseDirection.Forward -> node.previousCfgNodes - TraverseDirection.Backward -> node.followingCfgNodes - } - val previousData = previousNodes.mapNotNull { nodeMap[it] } - val data = nodeMap[node] - val newData = node.accept(visitor, previousData) - val hasChanged = newData != data - changed[node] = hasChanged - if (hasChanged) { - nodeMap[node] = newData - } + val previousNodes = when (direction) { + TraverseDirection.Forward -> node.previousCfgNodes + TraverseDirection.Backward -> node.followingCfgNodes + } + val previousData = previousNodes.mapNotNull { nodeMap[it] } + val data = nodeMap[node] + val newData = node.accept(visitor, previousData) + val hasChanged = newData != data + changed[node] = hasChanged + if (hasChanged) { + nodeMap[node] = newData } if (direction == TraverseDirection.Forward && node is CFGNodeWithCfgOwner<*>) { node.subGraphs.forEach { it.collectDataForNodeInternal(direction, initialInfo, visitor, nodeMap, changed) } diff --git a/compiler/testData/diagnostics/tests/controlFlowAnalysis/assignedInIfElse.fir.kt b/compiler/testData/diagnostics/tests/controlFlowAnalysis/assignedInIfElse.fir.kt deleted file mode 100644 index d372c1e84f2..00000000000 --- a/compiler/testData/diagnostics/tests/controlFlowAnalysis/assignedInIfElse.fir.kt +++ /dev/null @@ -1,16 +0,0 @@ -fun foo(arg: Boolean) { - val x : Int - if (arg) { - x = 4 - } else { - x = 2 - } - - x.hashCode() - - class Local { - fun bar() { - x.hashCode() - } - } -} diff --git a/compiler/testData/diagnostics/tests/controlFlowAnalysis/assignedInIfElse.kt b/compiler/testData/diagnostics/tests/controlFlowAnalysis/assignedInIfElse.kt index 7a2840c0aa3..6d33a389ae8 100644 --- a/compiler/testData/diagnostics/tests/controlFlowAnalysis/assignedInIfElse.kt +++ b/compiler/testData/diagnostics/tests/controlFlowAnalysis/assignedInIfElse.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL fun foo(arg: Boolean) { val x : Int if (arg) {