From 63bd920f166ec3ca3fd47db54f774d7826bc597e Mon Sep 17 00:00:00 2001 From: Dmitriy Novozhilov Date: Thu, 29 Aug 2019 16:15:24 +0300 Subject: [PATCH] [FIR] Tests. Make cfg graphs more strict --- .../fir/resolve/dfa/cfg/ControlFlowGraph.kt | 71 +- .../dfa/cfg/ControlFlowGraphRenderer.kt | 3 - .../testData/resolve/cfg/binaryOperations.dot | 306 +++-- .../cfg/booleanOperatorsWithConsts.dot | 574 ++++++--- .../resolve/testData/resolve/cfg/complex.dot | 120 +- .../testData/resolve/cfg/initBlock.dot | 22 +- .../resolve/testData/resolve/cfg/jumps.dot | 415 +++--- .../resolve/testData/resolve/cfg/lambdas.dot | 182 ++- .../resolve/testData/resolve/cfg/loops.dot | 592 ++++++--- .../resolve/cfg/propertiesAndInitBlocks.dot | 289 +++-- .../resolve/testData/resolve/cfg/simple.dot | 50 +- .../resolve/testData/resolve/cfg/tryCatch.dot | 347 +++-- .../fir/resolve/testData/resolve/cfg/when.dot | 205 +-- .../resolve/smartcasts/booleanOperators.dot | 587 +++++---- .../resolve/smartcasts/boundSmartcasts.dot | 369 ++++-- .../testData/resolve/smartcasts/casts.dot | 435 ++++--- .../testData/resolve/smartcasts/elvis.dot | 136 +- .../resolve/smartcasts/endlessLoops.dot | 724 +++++++---- .../resolve/smartcasts/equalsAndIdentity.dot | 428 ++++--- .../resolve/smartcasts/equalsToBoolean.dot | 606 +++++---- .../resolve/smartcasts/inPlaceLambdas.dot | 246 ++-- .../resolve/smartcasts/nullability.dot | 1132 +++++++++++------ .../testData/resolve/smartcasts/returns.dot | 371 ++++-- .../testData/resolve/smartcasts/simpleIf.dot | 229 ++-- .../testData/resolve/smartcasts/when.dot | 699 ++++++---- .../kotlin/fir/AbstractFirCfgBuildingTest.kt | 128 +- 26 files changed, 5897 insertions(+), 3369 deletions(-) diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/dfa/cfg/ControlFlowGraph.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/dfa/cfg/ControlFlowGraph.kt index ea9a41c8e1e..d6135cd9ce6 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/dfa/cfg/ControlFlowGraph.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/dfa/cfg/ControlFlowGraph.kt @@ -38,32 +38,35 @@ interface ReturnableNothingNode { val returnsNothing: Boolean } +interface EnterNode +interface ExitNode + // ----------------------------------- Named function ----------------------------------- -class FunctionEnterNode(owner: ControlFlowGraph, override val fir: FirFunction<*>, level: Int) : CFGNode>(owner, level) -class FunctionExitNode(owner: ControlFlowGraph, override val fir: FirFunction<*>, level: Int) : CFGNode>(owner, level) +class FunctionEnterNode(owner: ControlFlowGraph, override val fir: FirFunction<*>, level: Int) : CFGNode>(owner, level), EnterNode +class FunctionExitNode(owner: ControlFlowGraph, override val fir: FirFunction<*>, level: Int) : CFGNode>(owner, level), ExitNode // ----------------------------------- Property ----------------------------------- -class PropertyEnterNode(owner: ControlFlowGraph, override val fir: FirProperty, level: Int) : CFGNode(owner, level) -class PropertyExitNode(owner: ControlFlowGraph, override val fir: FirProperty, level: Int) : CFGNode(owner, level) +class PropertyEnterNode(owner: ControlFlowGraph, override val fir: FirProperty, level: Int) : CFGNode(owner, level), EnterNode +class PropertyExitNode(owner: ControlFlowGraph, override val fir: FirProperty, level: Int) : CFGNode(owner, level), ExitNode // ----------------------------------- Init ----------------------------------- -class InitBlockEnterNode(owner: ControlFlowGraph, override val fir: FirAnonymousInitializer, level: Int) : CFGNode(owner, level) -class InitBlockExitNode(owner: ControlFlowGraph, override val fir: FirAnonymousInitializer, level: Int) : CFGNode(owner, level) +class InitBlockEnterNode(owner: ControlFlowGraph, override val fir: FirAnonymousInitializer, level: Int) : CFGNode(owner, level), EnterNode +class InitBlockExitNode(owner: ControlFlowGraph, override val fir: FirAnonymousInitializer, level: Int) : CFGNode(owner, level), ExitNode // ----------------------------------- Block ----------------------------------- -class BlockEnterNode(owner: ControlFlowGraph, override val fir: FirBlock, level: Int) : CFGNode(owner, level) -class BlockExitNode(owner: ControlFlowGraph, override val fir: FirBlock, level: Int) : CFGNode(owner, level) +class BlockEnterNode(owner: ControlFlowGraph, override val fir: FirBlock, level: Int) : CFGNode(owner, level), EnterNode +class BlockExitNode(owner: ControlFlowGraph, override val fir: FirBlock, level: Int) : CFGNode(owner, level), ExitNode // ----------------------------------- When ----------------------------------- -class WhenEnterNode(owner: ControlFlowGraph, override val fir: FirWhenExpression, level: Int) : CFGNode(owner, level) -class WhenExitNode(owner: ControlFlowGraph, override val fir: FirWhenExpression, level: Int) : CFGNode(owner, level) -class WhenBranchConditionEnterNode(owner: ControlFlowGraph, override val fir: FirWhenBranch, level: Int) : CFGNode(owner, level) -class WhenBranchConditionExitNode(owner: ControlFlowGraph, override val fir: FirWhenBranch, level: Int) : CFGNode(owner, level) { +class WhenEnterNode(owner: ControlFlowGraph, override val fir: FirWhenExpression, level: Int) : CFGNode(owner, level), EnterNode +class WhenExitNode(owner: ControlFlowGraph, override val fir: FirWhenExpression, level: Int) : CFGNode(owner, level), ExitNode +class WhenBranchConditionEnterNode(owner: ControlFlowGraph, override val fir: FirWhenBranch, level: Int) : CFGNode(owner, level), EnterNode +class WhenBranchConditionExitNode(owner: ControlFlowGraph, override val fir: FirWhenBranch, level: Int) : CFGNode(owner, level), ExitNode { lateinit var trueCondition: Condition lateinit var falseCondition: Condition } @@ -71,25 +74,25 @@ class WhenBranchResultExitNode(owner: ControlFlowGraph, override val fir: FirWhe // ----------------------------------- Loop ----------------------------------- -class LoopEnterNode(owner: ControlFlowGraph, override val fir: FirLoop, level: Int) : CFGNode(owner, level) -class LoopBlockEnterNode(owner: ControlFlowGraph, override val fir: FirLoop, level: Int) : CFGNode(owner, level) -class LoopBlockExitNode(owner: ControlFlowGraph, override val fir: FirLoop, level: Int) : CFGNode(owner, level) -class LoopConditionEnterNode(owner: ControlFlowGraph, override val fir: FirExpression, level: Int) : CFGNode(owner, level) -class LoopConditionExitNode(owner: ControlFlowGraph, override val fir: FirExpression, level: Int) : CFGNode(owner, level) -class LoopExitNode(owner: ControlFlowGraph, override val fir: FirLoop, level: Int) : CFGNode(owner, level) +class LoopEnterNode(owner: ControlFlowGraph, override val fir: FirLoop, level: Int) : CFGNode(owner, level), EnterNode +class LoopBlockEnterNode(owner: ControlFlowGraph, override val fir: FirLoop, level: Int) : CFGNode(owner, level), EnterNode +class LoopBlockExitNode(owner: ControlFlowGraph, override val fir: FirLoop, level: Int) : CFGNode(owner, level), ExitNode +class LoopConditionEnterNode(owner: ControlFlowGraph, override val fir: FirExpression, level: Int) : CFGNode(owner, level), EnterNode +class LoopConditionExitNode(owner: ControlFlowGraph, override val fir: FirExpression, level: Int) : CFGNode(owner, level), ExitNode +class LoopExitNode(owner: ControlFlowGraph, override val fir: FirLoop, level: Int) : CFGNode(owner, level), ExitNode // ----------------------------------- Try-catch-finally ----------------------------------- -class TryExpressionEnterNode(owner: ControlFlowGraph, override val fir: FirTryExpression, level: Int) : CFGNode(owner, level) -class TryMainBlockEnterNode(owner: ControlFlowGraph, override val fir: FirTryExpression, level: Int) : CFGNode(owner, level) -class TryMainBlockExitNode(owner: ControlFlowGraph, override val fir: FirTryExpression, level: Int) : CFGNode(owner, level) -class CatchClauseEnterNode(owner: ControlFlowGraph, override val fir: FirCatch, level: Int) : CFGNode(owner, level) -class CatchClauseExitNode(owner: ControlFlowGraph, override val fir: FirCatch, level: Int) : CFGNode(owner, level) -class FinallyBlockEnterNode(owner: ControlFlowGraph, override val fir: FirTryExpression, level: Int) : CFGNode(owner, level) -class FinallyBlockExitNode(owner: ControlFlowGraph, override val fir: FirTryExpression, level: Int) : CFGNode(owner, level) -class FinallyProxyEnterNode(owner: ControlFlowGraph, override val fir: FirTryExpression, level: Int) : CFGNode(owner, level) -class FinallyProxyExitNode(owner: ControlFlowGraph, override val fir: FirTryExpression, level: Int) : CFGNode(owner, level) -class TryExpressionExitNode(owner: ControlFlowGraph, override val fir: FirTryExpression, level: Int) : CFGNode(owner, level) +class TryExpressionEnterNode(owner: ControlFlowGraph, override val fir: FirTryExpression, level: Int) : CFGNode(owner, level), EnterNode +class TryMainBlockEnterNode(owner: ControlFlowGraph, override val fir: FirTryExpression, level: Int) : CFGNode(owner, level), EnterNode +class TryMainBlockExitNode(owner: ControlFlowGraph, override val fir: FirTryExpression, level: Int) : CFGNode(owner, level), ExitNode +class CatchClauseEnterNode(owner: ControlFlowGraph, override val fir: FirCatch, level: Int) : CFGNode(owner, level), EnterNode +class CatchClauseExitNode(owner: ControlFlowGraph, override val fir: FirCatch, level: Int) : CFGNode(owner, level), ExitNode +class FinallyBlockEnterNode(owner: ControlFlowGraph, override val fir: FirTryExpression, level: Int) : CFGNode(owner, level), EnterNode +class FinallyBlockExitNode(owner: ControlFlowGraph, override val fir: FirTryExpression, level: Int) : CFGNode(owner, level), ExitNode +class FinallyProxyEnterNode(owner: ControlFlowGraph, override val fir: FirTryExpression, level: Int) : CFGNode(owner, level), EnterNode +class FinallyProxyExitNode(owner: ControlFlowGraph, override val fir: FirTryExpression, level: Int) : CFGNode(owner, level), ExitNode +class TryExpressionExitNode(owner: ControlFlowGraph, override val fir: FirTryExpression, level: Int) : CFGNode(owner, level), ExitNode // ----------------------------------- Boolean operators ----------------------------------- @@ -98,13 +101,13 @@ abstract class AbstractBinaryExitNode(owner: ControlFlowGraph, l val rightOperandNode: CFGNode<*> get() = previousNodes[1] } -class BinaryAndEnterNode(owner: ControlFlowGraph, override val fir: FirBinaryLogicExpression, level: Int) : CFGNode(owner, level) +class BinaryAndEnterNode(owner: ControlFlowGraph, override val fir: FirBinaryLogicExpression, level: Int) : CFGNode(owner, level), EnterNode class BinaryAndExitLeftOperandNode(owner: ControlFlowGraph, override val fir: FirBinaryLogicExpression, level: Int) : CFGNode(owner, level) -class BinaryAndExitNode(owner: ControlFlowGraph, override val fir: FirBinaryLogicExpression, level: Int) : AbstractBinaryExitNode(owner, level) +class BinaryAndExitNode(owner: ControlFlowGraph, override val fir: FirBinaryLogicExpression, level: Int) : AbstractBinaryExitNode(owner, level), ExitNode -class BinaryOrEnterNode(owner: ControlFlowGraph, override val fir: FirBinaryLogicExpression, level: Int) : CFGNode(owner, level) +class BinaryOrEnterNode(owner: ControlFlowGraph, override val fir: FirBinaryLogicExpression, level: Int) : CFGNode(owner, level), EnterNode class BinaryOrExitLeftOperandNode(owner: ControlFlowGraph, override val fir: FirBinaryLogicExpression, level: Int) : CFGNode(owner, level) -class BinaryOrExitNode(owner: ControlFlowGraph, override val fir: FirBinaryLogicExpression, level: Int) : AbstractBinaryExitNode(owner, level) +class BinaryOrExitNode(owner: ControlFlowGraph, override val fir: FirBinaryLogicExpression, level: Int) : AbstractBinaryExitNode(owner, level), ExitNode // ----------------------------------- Operator call ----------------------------------- @@ -153,8 +156,8 @@ class VariableAssignmentNode(owner: ControlFlowGraph, override val fir: FirVaria // ----------------------------------- Other ----------------------------------- -class AnnotationEnterNode(owner: ControlFlowGraph, override val fir: FirAnnotationCall, level: Int) : CFGNode(owner, level) -class AnnotationExitNode(owner: ControlFlowGraph, override val fir: FirAnnotationCall, level: Int) : CFGNode(owner, level) +class AnnotationEnterNode(owner: ControlFlowGraph, override val fir: FirAnnotationCall, level: Int) : CFGNode(owner, level), EnterNode +class AnnotationExitNode(owner: ControlFlowGraph, override val fir: FirAnnotationCall, level: Int) : CFGNode(owner, level), ExitNode // ----------------------------------- Stub ----------------------------------- diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/dfa/cfg/ControlFlowGraphRenderer.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/dfa/cfg/ControlFlowGraphRenderer.kt index 20b7afbc253..a9ab53e3e04 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/dfa/cfg/ControlFlowGraphRenderer.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/dfa/cfg/ControlFlowGraphRenderer.kt @@ -149,9 +149,6 @@ fun CFGNode<*>.render(): String = else -> TODO(this@render.toString()) } ) - if (isDead) { - append(DEAD) - } } private fun FirFunction<*>.name(): String = when (this) { diff --git a/compiler/fir/resolve/testData/resolve/cfg/binaryOperations.dot b/compiler/fir/resolve/testData/resolve/cfg/binaryOperations.dot index 7ee0e47d9b4..127dff7a2ce 100644 --- a/compiler/fir/resolve/testData/resolve/cfg/binaryOperations.dot +++ b/compiler/fir/resolve/testData/resolve/cfg/binaryOperations.dot @@ -1,29 +1,54 @@ digraph binaryOperations_kt { -graph [splines=ortho, nodesep=3] + graph [splines=ortho nodesep=3] + node [shape=box penwidth=2] + edge [penwidth=2] -subgraph cluster_test_1 { - 0 [shape=box label="Enter function test_1" style="filled"]; - 1 [shape=box label="Enter block"]; - 2 [shape=box label="Enter when"]; - 3 [shape=box label="Enter when branch condition "]; - 4 [shape=box label="Enter ||"]; - 5 [shape=box label="Access variable R|/b1|"]; - 6 [shape=box label="Exit left part of ||"]; - 7 [shape=box label="Access variable R|/b2|"]; - 8 [shape=box label="Exit ||"]; - 9 [shape=box label="Exit when branch condition"]; - 10 [shape=box label="Enter block"]; - 11 [shape=box label="Const: Int(1)"]; - 12 [shape=box label="Exit block"]; - 13 [shape=box label="Exit when branch result"]; - 14 [shape=box label="Enter when branch condition else"]; - 15 [shape=box label="Exit when branch condition"]; - 16 [shape=box label="Enter block"]; - 17 [shape=box label="Exit block"]; - 18 [shape=box label="Exit when branch result"]; - 19 [shape=box label="Exit when"]; - 20 [shape=box label="Exit block"]; - 21 [shape=box label="Exit function test_1" style="filled"]; + subgraph cluster_0 { + color=red + 0 [label="Enter function test_1" style="filled" fillcolor=red]; + subgraph cluster_1 { + color=blue + 1 [label="Enter block"]; + subgraph cluster_2 { + color=blue + 2 [label="Enter when"]; + subgraph cluster_3 { + color=blue + 3 [label="Enter when branch condition "]; + subgraph cluster_4 { + color=blue + 4 [label="Enter ||"]; + 5 [label="Access variable R|/b1|"]; + 6 [label="Exit left part of ||"]; + 7 [label="Access variable R|/b2|"]; + 8 [label="Exit ||"]; + } + 9 [label="Exit when branch condition"]; + } + subgraph cluster_5 { + color=blue + 10 [label="Enter block"]; + 11 [label="Const: Int(1)"]; + 12 [label="Exit block"]; + } + 13 [label="Exit when branch result"]; + subgraph cluster_6 { + color=blue + 14 [label="Enter when branch condition else"]; + 15 [label="Exit when branch condition"]; + } + subgraph cluster_7 { + color=blue + 16 [label="Enter block"]; + 17 [label="Exit block"]; + } + 18 [label="Exit when branch result"]; + 19 [label="Exit when"]; + } + 20 [label="Exit block"]; + } + 21 [label="Exit function test_1" style="filled" fillcolor=red]; + } 0 -> {1}; 1 -> {2}; @@ -46,31 +71,53 @@ subgraph cluster_test_1 { 18 -> {19}; 19 -> {20}; 20 -> {21}; -} -subgraph cluster_test_2 { - 22 [shape=box label="Enter function test_2" style="filled"]; - 23 [shape=box label="Enter block"]; - 24 [shape=box label="Enter when"]; - 25 [shape=box label="Enter when branch condition "]; - 26 [shape=box label="Enter &&"]; - 27 [shape=box label="Access variable R|/b1|"]; - 28 [shape=box label="Exit left part of &&"]; - 29 [shape=box label="Access variable R|/b2|"]; - 30 [shape=box label="Exit &&"]; - 31 [shape=box label="Exit when branch condition"]; - 32 [shape=box label="Enter block"]; - 33 [shape=box label="Const: Int(1)"]; - 34 [shape=box label="Exit block"]; - 35 [shape=box label="Exit when branch result"]; - 36 [shape=box label="Enter when branch condition else"]; - 37 [shape=box label="Exit when branch condition"]; - 38 [shape=box label="Enter block"]; - 39 [shape=box label="Exit block"]; - 40 [shape=box label="Exit when branch result"]; - 41 [shape=box label="Exit when"]; - 42 [shape=box label="Exit block"]; - 43 [shape=box label="Exit function test_2" style="filled"]; + subgraph cluster_8 { + color=red + 22 [label="Enter function test_2" style="filled" fillcolor=red]; + subgraph cluster_9 { + color=blue + 23 [label="Enter block"]; + subgraph cluster_10 { + color=blue + 24 [label="Enter when"]; + subgraph cluster_11 { + color=blue + 25 [label="Enter when branch condition "]; + subgraph cluster_12 { + color=blue + 26 [label="Enter &&"]; + 27 [label="Access variable R|/b1|"]; + 28 [label="Exit left part of &&"]; + 29 [label="Access variable R|/b2|"]; + 30 [label="Exit &&"]; + } + 31 [label="Exit when branch condition"]; + } + subgraph cluster_13 { + color=blue + 32 [label="Enter block"]; + 33 [label="Const: Int(1)"]; + 34 [label="Exit block"]; + } + 35 [label="Exit when branch result"]; + subgraph cluster_14 { + color=blue + 36 [label="Enter when branch condition else"]; + 37 [label="Exit when branch condition"]; + } + subgraph cluster_15 { + color=blue + 38 [label="Enter block"]; + 39 [label="Exit block"]; + } + 40 [label="Exit when branch result"]; + 41 [label="Exit when"]; + } + 42 [label="Exit block"]; + } + 43 [label="Exit function test_2" style="filled" fillcolor=red]; + } 22 -> {23}; 23 -> {24}; @@ -93,35 +140,60 @@ subgraph cluster_test_2 { 40 -> {41}; 41 -> {42}; 42 -> {43}; -} -subgraph cluster_test_3 { - 44 [shape=box label="Enter function test_3" style="filled"]; - 45 [shape=box label="Enter block"]; - 46 [shape=box label="Enter when"]; - 47 [shape=box label="Enter when branch condition "]; - 48 [shape=box label="Enter ||"]; - 49 [shape=box label="Enter &&"]; - 50 [shape=box label="Access variable R|/b1|"]; - 51 [shape=box label="Exit left part of &&"]; - 52 [shape=box label="Access variable R|/b2|"]; - 53 [shape=box label="Exit &&"]; - 54 [shape=box label="Exit left part of ||"]; - 55 [shape=box label="Access variable R|/b3|"]; - 56 [shape=box label="Exit ||"]; - 57 [shape=box label="Exit when branch condition"]; - 58 [shape=box label="Enter block"]; - 59 [shape=box label="Const: Int(1)"]; - 60 [shape=box label="Exit block"]; - 61 [shape=box label="Exit when branch result"]; - 62 [shape=box label="Enter when branch condition else"]; - 63 [shape=box label="Exit when branch condition"]; - 64 [shape=box label="Enter block"]; - 65 [shape=box label="Exit block"]; - 66 [shape=box label="Exit when branch result"]; - 67 [shape=box label="Exit when"]; - 68 [shape=box label="Exit block"]; - 69 [shape=box label="Exit function test_3" style="filled"]; + subgraph cluster_16 { + color=red + 44 [label="Enter function test_3" style="filled" fillcolor=red]; + subgraph cluster_17 { + color=blue + 45 [label="Enter block"]; + subgraph cluster_18 { + color=blue + 46 [label="Enter when"]; + subgraph cluster_19 { + color=blue + 47 [label="Enter when branch condition "]; + subgraph cluster_20 { + color=blue + 48 [label="Enter ||"]; + subgraph cluster_21 { + color=blue + 49 [label="Enter &&"]; + 50 [label="Access variable R|/b1|"]; + 51 [label="Exit left part of &&"]; + 52 [label="Access variable R|/b2|"]; + 53 [label="Exit &&"]; + } + 54 [label="Exit left part of ||"]; + 55 [label="Access variable R|/b3|"]; + 56 [label="Exit ||"]; + } + 57 [label="Exit when branch condition"]; + } + subgraph cluster_22 { + color=blue + 58 [label="Enter block"]; + 59 [label="Const: Int(1)"]; + 60 [label="Exit block"]; + } + 61 [label="Exit when branch result"]; + subgraph cluster_23 { + color=blue + 62 [label="Enter when branch condition else"]; + 63 [label="Exit when branch condition"]; + } + subgraph cluster_24 { + color=blue + 64 [label="Enter block"]; + 65 [label="Exit block"]; + } + 66 [label="Exit when branch result"]; + 67 [label="Exit when"]; + } + 68 [label="Exit block"]; + } + 69 [label="Exit function test_3" style="filled" fillcolor=red]; + } 44 -> {45}; 45 -> {46}; @@ -148,35 +220,60 @@ subgraph cluster_test_3 { 66 -> {67}; 67 -> {68}; 68 -> {69}; -} -subgraph cluster_test_4 { - 70 [shape=box label="Enter function test_4" style="filled"]; - 71 [shape=box label="Enter block"]; - 72 [shape=box label="Enter when"]; - 73 [shape=box label="Enter when branch condition "]; - 74 [shape=box label="Enter ||"]; - 75 [shape=box label="Access variable R|/b1|"]; - 76 [shape=box label="Exit left part of ||"]; - 77 [shape=box label="Enter &&"]; - 78 [shape=box label="Access variable R|/b2|"]; - 79 [shape=box label="Exit left part of &&"]; - 80 [shape=box label="Access variable R|/b3|"]; - 81 [shape=box label="Exit &&"]; - 82 [shape=box label="Exit ||"]; - 83 [shape=box label="Exit when branch condition"]; - 84 [shape=box label="Enter block"]; - 85 [shape=box label="Const: Int(1)"]; - 86 [shape=box label="Exit block"]; - 87 [shape=box label="Exit when branch result"]; - 88 [shape=box label="Enter when branch condition else"]; - 89 [shape=box label="Exit when branch condition"]; - 90 [shape=box label="Enter block"]; - 91 [shape=box label="Exit block"]; - 92 [shape=box label="Exit when branch result"]; - 93 [shape=box label="Exit when"]; - 94 [shape=box label="Exit block"]; - 95 [shape=box label="Exit function test_4" style="filled"]; + subgraph cluster_25 { + color=red + 70 [label="Enter function test_4" style="filled" fillcolor=red]; + subgraph cluster_26 { + color=blue + 71 [label="Enter block"]; + subgraph cluster_27 { + color=blue + 72 [label="Enter when"]; + subgraph cluster_28 { + color=blue + 73 [label="Enter when branch condition "]; + subgraph cluster_29 { + color=blue + 74 [label="Enter ||"]; + 75 [label="Access variable R|/b1|"]; + 76 [label="Exit left part of ||"]; + subgraph cluster_30 { + color=blue + 77 [label="Enter &&"]; + 78 [label="Access variable R|/b2|"]; + 79 [label="Exit left part of &&"]; + 80 [label="Access variable R|/b3|"]; + 81 [label="Exit &&"]; + } + 82 [label="Exit ||"]; + } + 83 [label="Exit when branch condition"]; + } + subgraph cluster_31 { + color=blue + 84 [label="Enter block"]; + 85 [label="Const: Int(1)"]; + 86 [label="Exit block"]; + } + 87 [label="Exit when branch result"]; + subgraph cluster_32 { + color=blue + 88 [label="Enter when branch condition else"]; + 89 [label="Exit when branch condition"]; + } + subgraph cluster_33 { + color=blue + 90 [label="Enter block"]; + 91 [label="Exit block"]; + } + 92 [label="Exit when branch result"]; + 93 [label="Exit when"]; + } + 94 [label="Exit block"]; + } + 95 [label="Exit function test_4" style="filled" fillcolor=red]; + } 70 -> {71}; 71 -> {72}; @@ -203,6 +300,5 @@ subgraph cluster_test_4 { 92 -> {93}; 93 -> {94}; 94 -> {95}; -} } diff --git a/compiler/fir/resolve/testData/resolve/cfg/booleanOperatorsWithConsts.dot b/compiler/fir/resolve/testData/resolve/cfg/booleanOperatorsWithConsts.dot index b540e64eb20..f51dbdb1d45 100644 --- a/compiler/fir/resolve/testData/resolve/cfg/booleanOperatorsWithConsts.dot +++ b/compiler/fir/resolve/testData/resolve/cfg/booleanOperatorsWithConsts.dot @@ -1,29 +1,54 @@ digraph booleanOperatorsWithConsts_kt { -graph [splines=ortho, nodesep=3] + graph [splines=ortho nodesep=3] + node [shape=box penwidth=2] + edge [penwidth=2] -subgraph cluster_test_1 { - 0 [shape=box label="Enter function test_1" style="filled"]; - 1 [shape=box label="Enter block"]; - 2 [shape=box label="Enter when"]; - 3 [shape=box label="Enter when branch condition "]; - 4 [shape=box label="Enter ||"]; - 5 [shape=box label="Access variable R|/b|"]; - 6 [shape=box label="Exit left part of ||"]; - 7 [shape=box label="Const: Boolean(false)"]; - 8 [shape=box label="Exit ||"]; - 9 [shape=box label="Exit when branch condition"]; - 10 [shape=box label="Enter block"]; - 11 [shape=box label="Const: Int(1)"]; - 12 [shape=box label="Exit block"]; - 13 [shape=box label="Exit when branch result"]; - 14 [shape=box label="Enter when branch condition else"]; - 15 [shape=box label="Exit when branch condition"]; - 16 [shape=box label="Enter block"]; - 17 [shape=box label="Exit block"]; - 18 [shape=box label="Exit when branch result"]; - 19 [shape=box label="Exit when"]; - 20 [shape=box label="Exit block"]; - 21 [shape=box label="Exit function test_1" style="filled"]; + subgraph cluster_0 { + color=red + 0 [label="Enter function test_1" style="filled" fillcolor=red]; + subgraph cluster_1 { + color=blue + 1 [label="Enter block"]; + subgraph cluster_2 { + color=blue + 2 [label="Enter when"]; + subgraph cluster_3 { + color=blue + 3 [label="Enter when branch condition "]; + subgraph cluster_4 { + color=blue + 4 [label="Enter ||"]; + 5 [label="Access variable R|/b|"]; + 6 [label="Exit left part of ||"]; + 7 [label="Const: Boolean(false)"]; + 8 [label="Exit ||"]; + } + 9 [label="Exit when branch condition"]; + } + subgraph cluster_5 { + color=blue + 10 [label="Enter block"]; + 11 [label="Const: Int(1)"]; + 12 [label="Exit block"]; + } + 13 [label="Exit when branch result"]; + subgraph cluster_6 { + color=blue + 14 [label="Enter when branch condition else"]; + 15 [label="Exit when branch condition"]; + } + subgraph cluster_7 { + color=blue + 16 [label="Enter block"]; + 17 [label="Exit block"]; + } + 18 [label="Exit when branch result"]; + 19 [label="Exit when"]; + } + 20 [label="Exit block"]; + } + 21 [label="Exit function test_1" style="filled" fillcolor=red]; + } 0 -> {1}; 1 -> {2}; @@ -46,32 +71,54 @@ subgraph cluster_test_1 { 18 -> {19}; 19 -> {20}; 20 -> {21}; -} -subgraph cluster_test_2 { - 22 [shape=box label="Enter function test_2" style="filled"]; - 23 [shape=box label="Enter block"]; - 24 [shape=box label="Enter when"]; - 25 [shape=box label="Enter when branch condition "]; - 26 [shape=box label="Enter ||"]; - 27 [shape=box label="Const: Boolean(false)"]; - 28 [shape=box label="Exit left part of ||"]; - 29 [shape=box label="Access variable R|/b|"]; - 30 [shape=box label="Stub[DEAD]"]; - 31 [shape=box label="Exit ||"]; - 32 [shape=box label="Exit when branch condition"]; - 33 [shape=box label="Enter block"]; - 34 [shape=box label="Const: Int(1)"]; - 35 [shape=box label="Exit block"]; - 36 [shape=box label="Exit when branch result"]; - 37 [shape=box label="Enter when branch condition else"]; - 38 [shape=box label="Exit when branch condition"]; - 39 [shape=box label="Enter block"]; - 40 [shape=box label="Exit block"]; - 41 [shape=box label="Exit when branch result"]; - 42 [shape=box label="Exit when"]; - 43 [shape=box label="Exit block"]; - 44 [shape=box label="Exit function test_2" style="filled"]; + subgraph cluster_8 { + color=red + 22 [label="Enter function test_2" style="filled" fillcolor=red]; + subgraph cluster_9 { + color=blue + 23 [label="Enter block"]; + subgraph cluster_10 { + color=blue + 24 [label="Enter when"]; + subgraph cluster_11 { + color=blue + 25 [label="Enter when branch condition "]; + subgraph cluster_12 { + color=blue + 26 [label="Enter ||"]; + 27 [label="Const: Boolean(false)"]; + 28 [label="Exit left part of ||"]; + 29 [label="Access variable R|/b|"]; + 30 [label="Stub" style="filled" fillcolor=gray]; + 31 [label="Exit ||"]; + } + 32 [label="Exit when branch condition"]; + } + subgraph cluster_13 { + color=blue + 33 [label="Enter block"]; + 34 [label="Const: Int(1)"]; + 35 [label="Exit block"]; + } + 36 [label="Exit when branch result"]; + subgraph cluster_14 { + color=blue + 37 [label="Enter when branch condition else"]; + 38 [label="Exit when branch condition"]; + } + subgraph cluster_15 { + color=blue + 39 [label="Enter block"]; + 40 [label="Exit block"]; + } + 41 [label="Exit when branch result"]; + 42 [label="Exit when"]; + } + 43 [label="Exit block"]; + } + 44 [label="Exit function test_2" style="filled" fillcolor=red]; + } 22 -> {23}; 23 -> {24}; @@ -96,31 +143,53 @@ subgraph cluster_test_2 { 41 -> {42}; 42 -> {43}; 43 -> {44}; -} -subgraph cluster_test_3 { - 45 [shape=box label="Enter function test_3" style="filled"]; - 46 [shape=box label="Enter block"]; - 47 [shape=box label="Enter when"]; - 48 [shape=box label="Enter when branch condition "]; - 49 [shape=box label="Enter ||"]; - 50 [shape=box label="Access variable R|/b|"]; - 51 [shape=box label="Exit left part of ||"]; - 52 [shape=box label="Const: Boolean(true)"]; - 53 [shape=box label="Exit ||"]; - 54 [shape=box label="Exit when branch condition"]; - 55 [shape=box label="Enter block"]; - 56 [shape=box label="Const: Int(1)"]; - 57 [shape=box label="Exit block"]; - 58 [shape=box label="Exit when branch result"]; - 59 [shape=box label="Enter when branch condition else"]; - 60 [shape=box label="Exit when branch condition"]; - 61 [shape=box label="Enter block"]; - 62 [shape=box label="Exit block"]; - 63 [shape=box label="Exit when branch result"]; - 64 [shape=box label="Exit when"]; - 65 [shape=box label="Exit block"]; - 66 [shape=box label="Exit function test_3" style="filled"]; + subgraph cluster_16 { + color=red + 45 [label="Enter function test_3" style="filled" fillcolor=red]; + subgraph cluster_17 { + color=blue + 46 [label="Enter block"]; + subgraph cluster_18 { + color=blue + 47 [label="Enter when"]; + subgraph cluster_19 { + color=blue + 48 [label="Enter when branch condition "]; + subgraph cluster_20 { + color=blue + 49 [label="Enter ||"]; + 50 [label="Access variable R|/b|"]; + 51 [label="Exit left part of ||"]; + 52 [label="Const: Boolean(true)"]; + 53 [label="Exit ||"]; + } + 54 [label="Exit when branch condition"]; + } + subgraph cluster_21 { + color=blue + 55 [label="Enter block"]; + 56 [label="Const: Int(1)"]; + 57 [label="Exit block"]; + } + 58 [label="Exit when branch result"]; + subgraph cluster_22 { + color=blue + 59 [label="Enter when branch condition else"]; + 60 [label="Exit when branch condition"]; + } + subgraph cluster_23 { + color=blue + 61 [label="Enter block"]; + 62 [label="Exit block"]; + } + 63 [label="Exit when branch result"]; + 64 [label="Exit when"]; + } + 65 [label="Exit block"]; + } + 66 [label="Exit function test_3" style="filled" fillcolor=red]; + } 45 -> {46}; 46 -> {47}; @@ -143,32 +212,54 @@ subgraph cluster_test_3 { 63 -> {64}; 64 -> {65}; 65 -> {66}; -} -subgraph cluster_test_4 { - 67 [shape=box label="Enter function test_4" style="filled"]; - 68 [shape=box label="Enter block"]; - 69 [shape=box label="Enter when"]; - 70 [shape=box label="Enter when branch condition "]; - 71 [shape=box label="Enter ||"]; - 72 [shape=box label="Const: Boolean(true)"]; - 73 [shape=box label="Stub[DEAD]"]; - 74 [shape=box label="Exit left part of ||[DEAD]"]; - 75 [shape=box label="Access variable R|/b|[DEAD]"]; - 76 [shape=box label="Exit ||"]; - 77 [shape=box label="Exit when branch condition"]; - 78 [shape=box label="Enter block"]; - 79 [shape=box label="Const: Int(1)"]; - 80 [shape=box label="Exit block"]; - 81 [shape=box label="Exit when branch result"]; - 82 [shape=box label="Enter when branch condition else"]; - 83 [shape=box label="Exit when branch condition"]; - 84 [shape=box label="Enter block"]; - 85 [shape=box label="Exit block"]; - 86 [shape=box label="Exit when branch result"]; - 87 [shape=box label="Exit when"]; - 88 [shape=box label="Exit block"]; - 89 [shape=box label="Exit function test_4" style="filled"]; + subgraph cluster_24 { + color=red + 67 [label="Enter function test_4" style="filled" fillcolor=red]; + subgraph cluster_25 { + color=blue + 68 [label="Enter block"]; + subgraph cluster_26 { + color=blue + 69 [label="Enter when"]; + subgraph cluster_27 { + color=blue + 70 [label="Enter when branch condition "]; + subgraph cluster_28 { + color=blue + 71 [label="Enter ||"]; + 72 [label="Const: Boolean(true)"]; + 73 [label="Stub" style="filled" fillcolor=gray]; + 74 [label="Exit left part of ||" style="filled" fillcolor=gray]; + 75 [label="Access variable R|/b|" style="filled" fillcolor=gray]; + 76 [label="Exit ||"]; + } + 77 [label="Exit when branch condition"]; + } + subgraph cluster_29 { + color=blue + 78 [label="Enter block"]; + 79 [label="Const: Int(1)"]; + 80 [label="Exit block"]; + } + 81 [label="Exit when branch result"]; + subgraph cluster_30 { + color=blue + 82 [label="Enter when branch condition else"]; + 83 [label="Exit when branch condition"]; + } + subgraph cluster_31 { + color=blue + 84 [label="Enter block"]; + 85 [label="Exit block"]; + } + 86 [label="Exit when branch result"]; + 87 [label="Exit when"]; + } + 88 [label="Exit block"]; + } + 89 [label="Exit function test_4" style="filled" fillcolor=red]; + } 67 -> {68}; 68 -> {69}; @@ -193,31 +284,53 @@ subgraph cluster_test_4 { 86 -> {87}; 87 -> {88}; 88 -> {89}; -} -subgraph cluster_test_5 { - 90 [shape=box label="Enter function test_5" style="filled"]; - 91 [shape=box label="Enter block"]; - 92 [shape=box label="Enter when"]; - 93 [shape=box label="Enter when branch condition "]; - 94 [shape=box label="Enter &&"]; - 95 [shape=box label="Access variable R|/b|"]; - 96 [shape=box label="Exit left part of &&"]; - 97 [shape=box label="Const: Boolean(false)"]; - 98 [shape=box label="Exit &&"]; - 99 [shape=box label="Exit when branch condition"]; - 100 [shape=box label="Enter block"]; - 101 [shape=box label="Const: Int(1)"]; - 102 [shape=box label="Exit block"]; - 103 [shape=box label="Exit when branch result"]; - 104 [shape=box label="Enter when branch condition else"]; - 105 [shape=box label="Exit when branch condition"]; - 106 [shape=box label="Enter block"]; - 107 [shape=box label="Exit block"]; - 108 [shape=box label="Exit when branch result"]; - 109 [shape=box label="Exit when"]; - 110 [shape=box label="Exit block"]; - 111 [shape=box label="Exit function test_5" style="filled"]; + subgraph cluster_32 { + color=red + 90 [label="Enter function test_5" style="filled" fillcolor=red]; + subgraph cluster_33 { + color=blue + 91 [label="Enter block"]; + subgraph cluster_34 { + color=blue + 92 [label="Enter when"]; + subgraph cluster_35 { + color=blue + 93 [label="Enter when branch condition "]; + subgraph cluster_36 { + color=blue + 94 [label="Enter &&"]; + 95 [label="Access variable R|/b|"]; + 96 [label="Exit left part of &&"]; + 97 [label="Const: Boolean(false)"]; + 98 [label="Exit &&"]; + } + 99 [label="Exit when branch condition"]; + } + subgraph cluster_37 { + color=blue + 100 [label="Enter block"]; + 101 [label="Const: Int(1)"]; + 102 [label="Exit block"]; + } + 103 [label="Exit when branch result"]; + subgraph cluster_38 { + color=blue + 104 [label="Enter when branch condition else"]; + 105 [label="Exit when branch condition"]; + } + subgraph cluster_39 { + color=blue + 106 [label="Enter block"]; + 107 [label="Exit block"]; + } + 108 [label="Exit when branch result"]; + 109 [label="Exit when"]; + } + 110 [label="Exit block"]; + } + 111 [label="Exit function test_5" style="filled" fillcolor=red]; + } 90 -> {91}; 91 -> {92}; @@ -240,33 +353,55 @@ subgraph cluster_test_5 { 108 -> {109}; 109 -> {110}; 110 -> {111}; -} -subgraph cluster_test_6 { - 112 [shape=box label="Enter function test_6" style="filled"]; - 113 [shape=box label="Enter block"]; - 114 [shape=box label="Enter when"]; - 115 [shape=box label="Enter when branch condition "]; - 116 [shape=box label="Enter &&"]; - 117 [shape=box label="Const: Boolean(false)"]; - 118 [shape=box label="Stub[DEAD]"]; - 119 [shape=box label="Exit left part of &&[DEAD]"]; - 120 [shape=box label="Access variable R|/b|[DEAD]"]; - 121 [shape=box label="Stub[DEAD]"]; - 122 [shape=box label="Exit &&"]; - 123 [shape=box label="Exit when branch condition"]; - 124 [shape=box label="Enter block"]; - 125 [shape=box label="Const: Int(1)"]; - 126 [shape=box label="Exit block"]; - 127 [shape=box label="Exit when branch result"]; - 128 [shape=box label="Enter when branch condition else"]; - 129 [shape=box label="Exit when branch condition"]; - 130 [shape=box label="Enter block"]; - 131 [shape=box label="Exit block"]; - 132 [shape=box label="Exit when branch result"]; - 133 [shape=box label="Exit when"]; - 134 [shape=box label="Exit block"]; - 135 [shape=box label="Exit function test_6" style="filled"]; + subgraph cluster_40 { + color=red + 112 [label="Enter function test_6" style="filled" fillcolor=red]; + subgraph cluster_41 { + color=blue + 113 [label="Enter block"]; + subgraph cluster_42 { + color=blue + 114 [label="Enter when"]; + subgraph cluster_43 { + color=blue + 115 [label="Enter when branch condition "]; + subgraph cluster_44 { + color=blue + 116 [label="Enter &&"]; + 117 [label="Const: Boolean(false)"]; + 118 [label="Stub" style="filled" fillcolor=gray]; + 119 [label="Exit left part of &&" style="filled" fillcolor=gray]; + 120 [label="Access variable R|/b|" style="filled" fillcolor=gray]; + 121 [label="Stub" style="filled" fillcolor=gray]; + 122 [label="Exit &&"]; + } + 123 [label="Exit when branch condition"]; + } + subgraph cluster_45 { + color=blue + 124 [label="Enter block"]; + 125 [label="Const: Int(1)"]; + 126 [label="Exit block"]; + } + 127 [label="Exit when branch result"]; + subgraph cluster_46 { + color=blue + 128 [label="Enter when branch condition else"]; + 129 [label="Exit when branch condition"]; + } + subgraph cluster_47 { + color=blue + 130 [label="Enter block"]; + 131 [label="Exit block"]; + } + 132 [label="Exit when branch result"]; + 133 [label="Exit when"]; + } + 134 [label="Exit block"]; + } + 135 [label="Exit function test_6" style="filled" fillcolor=red]; + } 112 -> {113}; 113 -> {114}; @@ -292,31 +427,53 @@ subgraph cluster_test_6 { 132 -> {133}; 133 -> {134}; 134 -> {135}; -} -subgraph cluster_test_7 { - 136 [shape=box label="Enter function test_7" style="filled"]; - 137 [shape=box label="Enter block"]; - 138 [shape=box label="Enter when"]; - 139 [shape=box label="Enter when branch condition "]; - 140 [shape=box label="Enter &&"]; - 141 [shape=box label="Access variable R|/b|"]; - 142 [shape=box label="Exit left part of &&"]; - 143 [shape=box label="Const: Boolean(true)"]; - 144 [shape=box label="Exit &&"]; - 145 [shape=box label="Exit when branch condition"]; - 146 [shape=box label="Enter block"]; - 147 [shape=box label="Const: Int(1)"]; - 148 [shape=box label="Exit block"]; - 149 [shape=box label="Exit when branch result"]; - 150 [shape=box label="Enter when branch condition else"]; - 151 [shape=box label="Exit when branch condition"]; - 152 [shape=box label="Enter block"]; - 153 [shape=box label="Exit block"]; - 154 [shape=box label="Exit when branch result"]; - 155 [shape=box label="Exit when"]; - 156 [shape=box label="Exit block"]; - 157 [shape=box label="Exit function test_7" style="filled"]; + subgraph cluster_48 { + color=red + 136 [label="Enter function test_7" style="filled" fillcolor=red]; + subgraph cluster_49 { + color=blue + 137 [label="Enter block"]; + subgraph cluster_50 { + color=blue + 138 [label="Enter when"]; + subgraph cluster_51 { + color=blue + 139 [label="Enter when branch condition "]; + subgraph cluster_52 { + color=blue + 140 [label="Enter &&"]; + 141 [label="Access variable R|/b|"]; + 142 [label="Exit left part of &&"]; + 143 [label="Const: Boolean(true)"]; + 144 [label="Exit &&"]; + } + 145 [label="Exit when branch condition"]; + } + subgraph cluster_53 { + color=blue + 146 [label="Enter block"]; + 147 [label="Const: Int(1)"]; + 148 [label="Exit block"]; + } + 149 [label="Exit when branch result"]; + subgraph cluster_54 { + color=blue + 150 [label="Enter when branch condition else"]; + 151 [label="Exit when branch condition"]; + } + subgraph cluster_55 { + color=blue + 152 [label="Enter block"]; + 153 [label="Exit block"]; + } + 154 [label="Exit when branch result"]; + 155 [label="Exit when"]; + } + 156 [label="Exit block"]; + } + 157 [label="Exit function test_7" style="filled" fillcolor=red]; + } 136 -> {137}; 137 -> {138}; @@ -339,32 +496,54 @@ subgraph cluster_test_7 { 154 -> {155}; 155 -> {156}; 156 -> {157}; -} -subgraph cluster_test_8 { - 158 [shape=box label="Enter function test_8" style="filled"]; - 159 [shape=box label="Enter block"]; - 160 [shape=box label="Enter when"]; - 161 [shape=box label="Enter when branch condition "]; - 162 [shape=box label="Enter &&"]; - 163 [shape=box label="Const: Boolean(true)"]; - 164 [shape=box label="Exit left part of &&"]; - 165 [shape=box label="Access variable R|/b|"]; - 166 [shape=box label="Stub[DEAD]"]; - 167 [shape=box label="Exit &&"]; - 168 [shape=box label="Exit when branch condition"]; - 169 [shape=box label="Enter block"]; - 170 [shape=box label="Const: Int(1)"]; - 171 [shape=box label="Exit block"]; - 172 [shape=box label="Exit when branch result"]; - 173 [shape=box label="Enter when branch condition else"]; - 174 [shape=box label="Exit when branch condition"]; - 175 [shape=box label="Enter block"]; - 176 [shape=box label="Exit block"]; - 177 [shape=box label="Exit when branch result"]; - 178 [shape=box label="Exit when"]; - 179 [shape=box label="Exit block"]; - 180 [shape=box label="Exit function test_8" style="filled"]; + subgraph cluster_56 { + color=red + 158 [label="Enter function test_8" style="filled" fillcolor=red]; + subgraph cluster_57 { + color=blue + 159 [label="Enter block"]; + subgraph cluster_58 { + color=blue + 160 [label="Enter when"]; + subgraph cluster_59 { + color=blue + 161 [label="Enter when branch condition "]; + subgraph cluster_60 { + color=blue + 162 [label="Enter &&"]; + 163 [label="Const: Boolean(true)"]; + 164 [label="Exit left part of &&"]; + 165 [label="Access variable R|/b|"]; + 166 [label="Stub" style="filled" fillcolor=gray]; + 167 [label="Exit &&"]; + } + 168 [label="Exit when branch condition"]; + } + subgraph cluster_61 { + color=blue + 169 [label="Enter block"]; + 170 [label="Const: Int(1)"]; + 171 [label="Exit block"]; + } + 172 [label="Exit when branch result"]; + subgraph cluster_62 { + color=blue + 173 [label="Enter when branch condition else"]; + 174 [label="Exit when branch condition"]; + } + subgraph cluster_63 { + color=blue + 175 [label="Enter block"]; + 176 [label="Exit block"]; + } + 177 [label="Exit when branch result"]; + 178 [label="Exit when"]; + } + 179 [label="Exit block"]; + } + 180 [label="Exit function test_8" style="filled" fillcolor=red]; + } 158 -> {159}; 159 -> {160}; @@ -389,6 +568,5 @@ subgraph cluster_test_8 { 177 -> {178}; 178 -> {179}; 179 -> {180}; -} } diff --git a/compiler/fir/resolve/testData/resolve/cfg/complex.dot b/compiler/fir/resolve/testData/resolve/cfg/complex.dot index 5582bb27489..a5f647cf0ba 100644 --- a/compiler/fir/resolve/testData/resolve/cfg/complex.dot +++ b/compiler/fir/resolve/testData/resolve/cfg/complex.dot @@ -1,52 +1,83 @@ digraph complex_kt { -graph [splines=ortho, nodesep=3] + graph [splines=ortho nodesep=3] + node [shape=box penwidth=2] + edge [penwidth=2] -subgraph cluster_fetchPluginReleaseDate { - 0 [shape=box label="Enter function fetchPluginReleaseDate" style="filled"]; - 1 [shape=box label="Enter block"]; - 2 [shape=box label="Const: String(https://plugins.jetbrains.com/api/plugins/)"]; - 3 [shape=box label="Access variable R|/pluginId|"]; - 4 [shape=box label="Access variable #"]; - 5 [shape=box label="Const: String(/updates?version=)"]; - 6 [shape=box label="Access variable R|/version|"]; - 7 [shape=box label="Variable declaration: lval url: R|kotlin/String|"]; - 8 [shape=box label="Try expression enter"]; - 9 [shape=box label="Try main block enter"]; - 10 [shape=box label="Enter block"]; - 11 [shape=box label="Access variable #"]; - 12 [shape=box label="Access variable R|/url|"]; - 13 [shape=box label="Function call: #.#(R|/url|)"]; - 14 [shape=box label="Function call: #.#(R|/url|).#( = connect@fun .(): { + subgraph cluster_0 { + color=red + 0 [label="Enter function fetchPluginReleaseDate" style="filled" fillcolor=red]; + subgraph cluster_1 { + color=blue + 1 [label="Enter block"]; + 2 [label="Const: String(https://plugins.jetbrains.com/api/plugins/)"]; + 3 [label="Access variable R|/pluginId|"]; + 4 [label="Access variable #"]; + 5 [label="Const: String(/updates?version=)"]; + 6 [label="Access variable R|/version|"]; + 7 [label="Variable declaration: lval url: R|kotlin/String|"]; + subgraph cluster_2 { + color=blue + 8 [label="Try expression enter"]; + subgraph cluster_3 { + color=blue + 9 [label="Try main block enter"]; + subgraph cluster_4 { + color=blue + 10 [label="Enter block"]; + 11 [label="Access variable #"]; + 12 [label="Access variable R|/url|"]; + 13 [label="Function call: #.#(R|/url|)"]; + 14 [label="Function call: #.#(R|/url|).#( = connect@fun .(): { GsonBuilder#().create#().fromJson#(it#.inputStream#.reader#(), (Array#()).java#) } )"]; - 15 [shape=box label="Exit block"]; - 16 [shape=box label="Try main block exit"]; - 17 [shape=box label="Catch enter"]; - 18 [shape=box label="Enter block"]; - 19 [shape=box label="Const: String(Can't parse json response)"]; - 20 [shape=box label="Access variable R|/syntaxException|"]; - 21 [shape=box label="Function call: #(String(Can't parse json response), R|/syntaxException|)"]; - 22 [shape=box label="Throw: throw #(String(Can't parse json response), R|/syntaxException|)"]; - 23 [shape=box label="Stub[DEAD]"]; - 24 [shape=box label="Exit block[DEAD]"]; - 25 [shape=box label="Catch exit[DEAD]"]; - 26 [shape=box label="Catch enter"]; - 27 [shape=box label="Enter block"]; - 28 [shape=box label="Access variable R|/ioException|"]; - 29 [shape=box label="Function call: #(R|/ioException|)"]; - 30 [shape=box label="Throw: throw #(R|/ioException|)"]; - 31 [shape=box label="Stub[DEAD]"]; - 32 [shape=box label="Exit block[DEAD]"]; - 33 [shape=box label="Catch exit[DEAD]"]; - 34 [shape=box label="Try expression exit"]; - 35 [shape=box label="Variable declaration: lval pluginDTOs: R|kotlin/Array|"]; - 36 [shape=box label="Exit block"]; - 37 [shape=box label="Enter annotation"]; - 38 [shape=box label="Access variable #"]; - 39 [shape=box label="Access variable #"]; - 40 [shape=box label="Exit annotation"]; - 41 [shape=box label="Exit function fetchPluginReleaseDate" style="filled"]; + 15 [label="Exit block"]; + } + 16 [label="Try main block exit"]; + } + subgraph cluster_5 { + color=blue + 17 [label="Catch enter"]; + subgraph cluster_6 { + color=blue + 18 [label="Enter block"]; + 19 [label="Const: String(Can't parse json response)"]; + 20 [label="Access variable R|/syntaxException|"]; + 21 [label="Function call: #(String(Can't parse json response), R|/syntaxException|)"]; + 22 [label="Throw: throw #(String(Can't parse json response), R|/syntaxException|)"]; + 23 [label="Stub" style="filled" fillcolor=gray]; + 24 [label="Exit block" style="filled" fillcolor=gray]; + } + 25 [label="Catch exit" style="filled" fillcolor=gray]; + } + subgraph cluster_7 { + color=blue + 26 [label="Catch enter"]; + subgraph cluster_8 { + color=blue + 27 [label="Enter block"]; + 28 [label="Access variable R|/ioException|"]; + 29 [label="Function call: #(R|/ioException|)"]; + 30 [label="Throw: throw #(R|/ioException|)"]; + 31 [label="Stub" style="filled" fillcolor=gray]; + 32 [label="Exit block" style="filled" fillcolor=gray]; + } + 33 [label="Catch exit" style="filled" fillcolor=gray]; + } + 34 [label="Try expression exit"]; + } + 35 [label="Variable declaration: lval pluginDTOs: R|kotlin/Array|"]; + 36 [label="Exit block"]; + } + subgraph cluster_9 { + color=blue + 37 [label="Enter annotation"]; + 38 [label="Access variable #"]; + 39 [label="Access variable #"]; + 40 [label="Exit annotation"]; + } + 41 [label="Exit function fetchPluginReleaseDate" style="filled" fillcolor=red]; + } 0 -> {1}; 1 -> {2}; @@ -91,6 +122,5 @@ subgraph cluster_fetchPluginReleaseDate { 38 -> {39}; 39 -> {40}; 40 -> {41}; -} } diff --git a/compiler/fir/resolve/testData/resolve/cfg/initBlock.dot b/compiler/fir/resolve/testData/resolve/cfg/initBlock.dot index 3a4e2ace95e..f973aeb1fcd 100644 --- a/compiler/fir/resolve/testData/resolve/cfg/initBlock.dot +++ b/compiler/fir/resolve/testData/resolve/cfg/initBlock.dot @@ -1,18 +1,22 @@ digraph initBlock_kt { -graph [splines=ortho, nodesep=3] + graph [splines=ortho nodesep=3] + node [shape=box penwidth=2] + edge [penwidth=2] -subgraph cluster__init_ { - 0 [shape=box label="Enter function " style="filled"]; - 1 [shape=box label="Exit function " style="filled"]; + subgraph cluster_0 { + color=red + 0 [label="Enter function " style="filled" fillcolor=red]; + 1 [label="Exit function " style="filled" fillcolor=red]; + } 0 -> {1}; -} -subgraph cluster__init_ { - 2 [shape=box label="Enter function " style="filled"]; - 3 [shape=box label="Exit function " style="filled"]; + subgraph cluster_1 { + color=red + 2 [label="Enter function " style="filled" fillcolor=red]; + 3 [label="Exit function " style="filled" fillcolor=red]; + } 2 -> {3}; -} } diff --git a/compiler/fir/resolve/testData/resolve/cfg/jumps.dot b/compiler/fir/resolve/testData/resolve/cfg/jumps.dot index 393933fe04e..b325cb98245 100644 --- a/compiler/fir/resolve/testData/resolve/cfg/jumps.dot +++ b/compiler/fir/resolve/testData/resolve/cfg/jumps.dot @@ -1,33 +1,55 @@ digraph jumps_kt { -graph [splines=ortho, nodesep=3] + graph [splines=ortho nodesep=3] + node [shape=box penwidth=2] + edge [penwidth=2] -subgraph cluster_test_1 { - 0 [shape=box label="Enter function test_1" style="filled"]; - 1 [shape=box label="Enter block"]; - 2 [shape=box label="Enter when"]; - 3 [shape=box label="Enter when branch condition "]; - 4 [shape=box label="Access variable R|/x|"]; - 5 [shape=box label="Const: Null(null)"]; - 6 [shape=box label="Operator =="]; - 7 [shape=box label="Exit when branch condition"]; - 8 [shape=box label="Enter block"]; - 9 [shape=box label="Function call: R|kotlin/KotlinNullPointerException.KotlinNullPointerException|()"]; - 10 [shape=box label="Throw: throw R|kotlin/KotlinNullPointerException.KotlinNullPointerException|()"]; - 11 [shape=box label="Stub[DEAD]"]; - 12 [shape=box label="Exit block[DEAD]"]; - 13 [shape=box label="Exit when branch result[DEAD]"]; - 14 [shape=box label="Enter when branch condition else"]; - 15 [shape=box label="Exit when branch condition"]; - 16 [shape=box label="Enter block"]; - 17 [shape=box label="Access variable R|/x|"]; - 18 [shape=box label="Exit block"]; - 19 [shape=box label="Exit when branch result"]; - 20 [shape=box label="Exit when"]; - 21 [shape=box label="Variable declaration: lval y: R|kotlin/Int|"]; - 22 [shape=box label="Access variable R|/y|"]; - 23 [shape=box label="Function call: R|/y|.R|kotlin/Int.inc|()"]; - 24 [shape=box label="Exit block"]; - 25 [shape=box label="Exit function test_1" style="filled"]; + subgraph cluster_0 { + color=red + 0 [label="Enter function test_1" style="filled" fillcolor=red]; + subgraph cluster_1 { + color=blue + 1 [label="Enter block"]; + subgraph cluster_2 { + color=blue + 2 [label="Enter when"]; + subgraph cluster_3 { + color=blue + 3 [label="Enter when branch condition "]; + 4 [label="Access variable R|/x|"]; + 5 [label="Const: Null(null)"]; + 6 [label="Operator =="]; + 7 [label="Exit when branch condition"]; + } + subgraph cluster_4 { + color=blue + 8 [label="Enter block"]; + 9 [label="Function call: R|kotlin/KotlinNullPointerException.KotlinNullPointerException|()"]; + 10 [label="Throw: throw R|kotlin/KotlinNullPointerException.KotlinNullPointerException|()"]; + 11 [label="Stub" style="filled" fillcolor=gray]; + 12 [label="Exit block" style="filled" fillcolor=gray]; + } + 13 [label="Exit when branch result" style="filled" fillcolor=gray]; + subgraph cluster_5 { + color=blue + 14 [label="Enter when branch condition else"]; + 15 [label="Exit when branch condition"]; + } + subgraph cluster_6 { + color=blue + 16 [label="Enter block"]; + 17 [label="Access variable R|/x|"]; + 18 [label="Exit block"]; + } + 19 [label="Exit when branch result"]; + 20 [label="Exit when"]; + } + 21 [label="Variable declaration: lval y: R|kotlin/Int|"]; + 22 [label="Access variable R|/y|"]; + 23 [label="Function call: R|/y|.R|kotlin/Int.inc|()"]; + 24 [label="Exit block"]; + } + 25 [label="Exit function test_1" style="filled" fillcolor=red]; + } 0 -> {1}; 1 -> {2}; @@ -55,33 +77,52 @@ subgraph cluster_test_1 { 22 -> {23}; 23 -> {24}; 24 -> {25}; -} -subgraph cluster_test_2 { - 26 [shape=box label="Enter function test_2" style="filled"]; - 27 [shape=box label="Enter block"]; - 28 [shape=box label="Enter when"]; - 29 [shape=box label="Enter when branch condition "]; - 30 [shape=box label="Access variable R|/x|"]; - 31 [shape=box label="Const: Null(null)"]; - 32 [shape=box label="Operator =="]; - 33 [shape=box label="Exit when branch condition"]; - 34 [shape=box label="Enter block"]; - 35 [shape=box label="Access variable R|/x|"]; - 36 [shape=box label="Exit block"]; - 37 [shape=box label="Exit when branch result"]; - 38 [shape=box label="Enter when branch condition else"]; - 39 [shape=box label="Exit when branch condition"]; - 40 [shape=box label="Enter block"]; - 41 [shape=box label="Access variable R|/x|"]; - 42 [shape=box label="Exit block"]; - 43 [shape=box label="Exit when branch result"]; - 44 [shape=box label="Exit when"]; - 45 [shape=box label="Variable declaration: lval y: R|kotlin/Int?|"]; - 46 [shape=box label="Access variable R|/y|"]; - 47 [shape=box label="Function call: R|/y|.#()"]; - 48 [shape=box label="Exit block"]; - 49 [shape=box label="Exit function test_2" style="filled"]; + subgraph cluster_7 { + color=red + 26 [label="Enter function test_2" style="filled" fillcolor=red]; + subgraph cluster_8 { + color=blue + 27 [label="Enter block"]; + subgraph cluster_9 { + color=blue + 28 [label="Enter when"]; + subgraph cluster_10 { + color=blue + 29 [label="Enter when branch condition "]; + 30 [label="Access variable R|/x|"]; + 31 [label="Const: Null(null)"]; + 32 [label="Operator =="]; + 33 [label="Exit when branch condition"]; + } + subgraph cluster_11 { + color=blue + 34 [label="Enter block"]; + 35 [label="Access variable R|/x|"]; + 36 [label="Exit block"]; + } + 37 [label="Exit when branch result"]; + subgraph cluster_12 { + color=blue + 38 [label="Enter when branch condition else"]; + 39 [label="Exit when branch condition"]; + } + subgraph cluster_13 { + color=blue + 40 [label="Enter block"]; + 41 [label="Access variable R|/x|"]; + 42 [label="Exit block"]; + } + 43 [label="Exit when branch result"]; + 44 [label="Exit when"]; + } + 45 [label="Variable declaration: lval y: R|kotlin/Int?|"]; + 46 [label="Access variable R|/y|"]; + 47 [label="Function call: R|/y|.#()"]; + 48 [label="Exit block"]; + } + 49 [label="Exit function test_2" style="filled" fillcolor=red]; + } 26 -> {27}; 27 -> {28}; @@ -106,29 +147,45 @@ subgraph cluster_test_2 { 46 -> {47}; 47 -> {48}; 48 -> {49}; -} -subgraph cluster_test_3 { - 50 [shape=box label="Enter function test_3" style="filled"]; - 51 [shape=box label="Enter block"]; - 52 [shape=box label="Enter while loop"]; - 53 [shape=box label="Enter loop condition"]; - 54 [shape=box label="Const: Boolean(true)"]; - 55 [shape=box label="Exit loop condition"]; - 56 [shape=box label="Enter loop block"]; - 57 [shape=box label="Enter block"]; - 58 [shape=box label="Access variable R|/x|"]; - 59 [shape=box label="Type operator: x as Int"]; - 60 [shape=box label="Jump: break@@@[Boolean(true)] "]; - 61 [shape=box label="Stub[DEAD]"]; - 62 [shape=box label="Exit block[DEAD]"]; - 63 [shape=box label="Exit loop block[DEAD]"]; - 64 [shape=box label="Stub[DEAD]"]; - 65 [shape=box label="Exit whileloop"]; - 66 [shape=box label="Access variable R|/x|"]; - 67 [shape=box label="Function call: R|/x|.R|kotlin/Int.inc|()"]; - 68 [shape=box label="Exit block"]; - 69 [shape=box label="Exit function test_3" style="filled"]; + subgraph cluster_14 { + color=red + 50 [label="Enter function test_3" style="filled" fillcolor=red]; + subgraph cluster_15 { + color=blue + 51 [label="Enter block"]; + subgraph cluster_16 { + color=blue + 52 [label="Enter while loop"]; + subgraph cluster_17 { + color=blue + 53 [label="Enter loop condition"]; + 54 [label="Const: Boolean(true)"]; + 55 [label="Exit loop condition"]; + } + subgraph cluster_18 { + color=blue + 56 [label="Enter loop block"]; + subgraph cluster_19 { + color=blue + 57 [label="Enter block"]; + 58 [label="Access variable R|/x|"]; + 59 [label="Type operator: x as Int"]; + 60 [label="Jump: break@@@[Boolean(true)] "]; + 61 [label="Stub" style="filled" fillcolor=gray]; + 62 [label="Exit block" style="filled" fillcolor=gray]; + } + 63 [label="Exit loop block" style="filled" fillcolor=gray]; + } + 64 [label="Stub" style="filled" fillcolor=gray]; + 65 [label="Exit whileloop"]; + } + 66 [label="Access variable R|/x|"]; + 67 [label="Function call: R|/x|.R|kotlin/Int.inc|()"]; + 68 [label="Exit block"]; + } + 69 [label="Exit function test_3" style="filled" fillcolor=red]; + } 50 -> {51}; 51 -> {52}; @@ -151,29 +208,45 @@ subgraph cluster_test_3 { 66 -> {67}; 67 -> {68}; 68 -> {69}; -} -subgraph cluster_test_4 { - 70 [shape=box label="Enter function test_4" style="filled"]; - 71 [shape=box label="Enter block"]; - 72 [shape=box label="Enter do-while loop"]; - 73 [shape=box label="Enter loop block"]; - 74 [shape=box label="Enter block"]; - 75 [shape=box label="Access variable R|/x|"]; - 76 [shape=box label="Type operator: x as Int"]; - 77 [shape=box label="Jump: break@@@[Boolean(true)] "]; - 78 [shape=box label="Stub[DEAD]"]; - 79 [shape=box label="Exit block[DEAD]"]; - 80 [shape=box label="Exit loop block[DEAD]"]; - 81 [shape=box label="Enter loop condition[DEAD]"]; - 82 [shape=box label="Const: Boolean(true)[DEAD]"]; - 83 [shape=box label="Exit loop condition[DEAD]"]; - 84 [shape=box label="Stub[DEAD]"]; - 85 [shape=box label="Exit do-whileloop"]; - 86 [shape=box label="Access variable R|/x|"]; - 87 [shape=box label="Function call: R|/x|.R|kotlin/Int.inc|()"]; - 88 [shape=box label="Exit block"]; - 89 [shape=box label="Exit function test_4" style="filled"]; + subgraph cluster_20 { + color=red + 70 [label="Enter function test_4" style="filled" fillcolor=red]; + subgraph cluster_21 { + color=blue + 71 [label="Enter block"]; + subgraph cluster_22 { + color=blue + 72 [label="Enter do-while loop"]; + subgraph cluster_23 { + color=blue + 73 [label="Enter loop block"]; + subgraph cluster_24 { + color=blue + 74 [label="Enter block"]; + 75 [label="Access variable R|/x|"]; + 76 [label="Type operator: x as Int"]; + 77 [label="Jump: break@@@[Boolean(true)] "]; + 78 [label="Stub" style="filled" fillcolor=gray]; + 79 [label="Exit block" style="filled" fillcolor=gray]; + } + 80 [label="Exit loop block" style="filled" fillcolor=gray]; + } + subgraph cluster_25 { + color=blue + 81 [label="Enter loop condition" style="filled" fillcolor=gray]; + 82 [label="Const: Boolean(true)" style="filled" fillcolor=gray]; + 83 [label="Exit loop condition" style="filled" fillcolor=gray]; + } + 84 [label="Stub" style="filled" fillcolor=gray]; + 85 [label="Exit do-whileloop"]; + } + 86 [label="Access variable R|/x|"]; + 87 [label="Function call: R|/x|.R|kotlin/Int.inc|()"]; + 88 [label="Exit block"]; + } + 89 [label="Exit function test_4" style="filled" fillcolor=red]; + } 70 -> {71}; 71 -> {72}; @@ -195,37 +268,68 @@ subgraph cluster_test_4 { 86 -> {87}; 87 -> {88}; 88 -> {89}; -} -subgraph cluster_test_5 { - 90 [shape=box label="Enter function test_5" style="filled"]; - 91 [shape=box label="Enter block"]; - 92 [shape=box label="Enter while loop"]; - 93 [shape=box label="Enter loop condition"]; - 94 [shape=box label="Access variable R|/b|"]; - 95 [shape=box label="Exit loop condition"]; - 96 [shape=box label="Enter loop block"]; - 97 [shape=box label="Enter block"]; - 98 [shape=box label="Enter when"]; - 99 [shape=box label="Enter when branch condition "]; - 100 [shape=box label="Access variable R|/b|"]; - 101 [shape=box label="Exit when branch condition"]; - 102 [shape=box label="Enter block"]; - 103 [shape=box label="Jump: continue@@@[R|/b|] "]; - 104 [shape=box label="Stub[DEAD]"]; - 105 [shape=box label="Exit block[DEAD]"]; - 106 [shape=box label="Exit when branch result[DEAD]"]; - 107 [shape=box label="Enter when branch condition else"]; - 108 [shape=box label="Exit when branch condition"]; - 109 [shape=box label="Enter block"]; - 110 [shape=box label="Exit block"]; - 111 [shape=box label="Exit when branch result"]; - 112 [shape=box label="Exit when"]; - 113 [shape=box label="Exit block"]; - 114 [shape=box label="Exit loop block"]; - 115 [shape=box label="Exit whileloop"]; - 116 [shape=box label="Exit block"]; - 117 [shape=box label="Exit function test_5" style="filled"]; + subgraph cluster_26 { + color=red + 90 [label="Enter function test_5" style="filled" fillcolor=red]; + subgraph cluster_27 { + color=blue + 91 [label="Enter block"]; + subgraph cluster_28 { + color=blue + 92 [label="Enter while loop"]; + subgraph cluster_29 { + color=blue + 93 [label="Enter loop condition"]; + 94 [label="Access variable R|/b|"]; + 95 [label="Exit loop condition"]; + } + subgraph cluster_30 { + color=blue + 96 [label="Enter loop block"]; + subgraph cluster_31 { + color=blue + 97 [label="Enter block"]; + subgraph cluster_32 { + color=blue + 98 [label="Enter when"]; + subgraph cluster_33 { + color=blue + 99 [label="Enter when branch condition "]; + 100 [label="Access variable R|/b|"]; + 101 [label="Exit when branch condition"]; + } + subgraph cluster_34 { + color=blue + 102 [label="Enter block"]; + 103 [label="Jump: continue@@@[R|/b|] "]; + 104 [label="Stub" style="filled" fillcolor=gray]; + 105 [label="Exit block" style="filled" fillcolor=gray]; + } + 106 [label="Exit when branch result" style="filled" fillcolor=gray]; + subgraph cluster_35 { + color=blue + 107 [label="Enter when branch condition else"]; + 108 [label="Exit when branch condition"]; + } + subgraph cluster_36 { + color=blue + 109 [label="Enter block"]; + 110 [label="Exit block"]; + } + 111 [label="Exit when branch result"]; + 112 [label="Exit when"]; + } + 113 [label="Exit block"]; + } + 114 [label="Exit loop block"]; + } + 115 [label="Exit whileloop"]; + } + 116 [label="Exit block"]; + } + 117 [label="Exit function test_5" style="filled" fillcolor=red]; + } 90 -> {91}; 91 -> {92}; @@ -255,36 +359,50 @@ subgraph cluster_test_5 { 114 -> {93}; 115 -> {116}; 116 -> {117}; -} -subgraph cluster_run { - 118 [shape=box label="Enter function run" style="filled"]; - 119 [shape=box label="Enter block"]; - 120 [shape=box label="Function call: R|/block|.R|FakeOverride|()"]; - 121 [shape=box label="Exit block"]; - 122 [shape=box label="Exit function run" style="filled"]; + subgraph cluster_37 { + color=red + 118 [label="Enter function run" style="filled" fillcolor=red]; + subgraph cluster_38 { + color=blue + 119 [label="Enter block"]; + 120 [label="Function call: R|/block|.R|FakeOverride|()"]; + 121 [label="Exit block"]; + } + 122 [label="Exit function run" style="filled" fillcolor=red]; + } 118 -> {119}; 119 -> {120}; 120 -> {121}; 121 -> {122}; -} -subgraph cluster_test_6 { - 123 [shape=box label="Enter function test_6" style="filled"]; - 124 [shape=box label="Enter block"]; - 125 [shape=box label="Enter function anonymousFunction"]; - 126 [shape=box label="Enter block"]; - 127 [shape=box label="Jump: ^@run Unit"]; - 128 [shape=box label="Stub[DEAD]"]; - 129 [shape=box label="Exit block[DEAD]"]; - 130 [shape=box label="Exit function anonymousFunction"]; - 131 [shape=box label="Function call: R|/run|( = run@fun (): R|kotlin/Unit| { + subgraph cluster_39 { + color=red + 123 [label="Enter function test_6" style="filled" fillcolor=red]; + subgraph cluster_40 { + color=blue + 124 [label="Enter block"]; + subgraph cluster_41 { + color=blue + 125 [label="Enter function anonymousFunction"]; + subgraph cluster_42 { + color=blue + 126 [label="Enter block"]; + 127 [label="Jump: ^@run Unit"]; + 128 [label="Stub" style="filled" fillcolor=gray]; + 129 [label="Exit block" style="filled" fillcolor=gray]; + } + 130 [label="Exit function anonymousFunction"]; + } + 131 [label="Function call: R|/run|( = run@fun (): R|kotlin/Unit| { ^@run Unit } )"]; - 132 [shape=box label="Exit block"]; - 133 [shape=box label="Exit function test_6" style="filled"]; + 132 [label="Exit block"]; + } + 133 [label="Exit function test_6" style="filled" fillcolor=red]; + } 123 -> {124}; 124 -> {125}; @@ -297,6 +415,5 @@ subgraph cluster_test_6 { 130 -> {131}; 131 -> {132}; 132 -> {133}; -} } diff --git a/compiler/fir/resolve/testData/resolve/cfg/lambdas.dot b/compiler/fir/resolve/testData/resolve/cfg/lambdas.dot index 721ee8e6abd..a6fc5f5b642 100644 --- a/compiler/fir/resolve/testData/resolve/cfg/lambdas.dot +++ b/compiler/fir/resolve/testData/resolve/cfg/lambdas.dot @@ -1,48 +1,80 @@ digraph lambdas_kt { -graph [splines=ortho, nodesep=3] + graph [splines=ortho nodesep=3] + node [shape=box penwidth=2] + edge [penwidth=2] -subgraph cluster_run { - 0 [shape=box label="Enter function run" style="filled"]; - 1 [shape=box label="Enter block"]; - 2 [shape=box label="Function call: R|/block|.R|FakeOverride|()"]; - 3 [shape=box label="Exit block"]; - 4 [shape=box label="Exit function run" style="filled"]; + subgraph cluster_0 { + color=red + 0 [label="Enter function run" style="filled" fillcolor=red]; + subgraph cluster_1 { + color=blue + 1 [label="Enter block"]; + 2 [label="Function call: R|/block|.R|FakeOverride|()"]; + 3 [label="Exit block"]; + } + 4 [label="Exit function run" style="filled" fillcolor=red]; + } 0 -> {1}; 1 -> {2}; 2 -> {3}; 3 -> {4}; -} -subgraph cluster_test_1 { - 5 [shape=box label="Enter function test_1" style="filled"]; - 6 [shape=box label="Enter block"]; - 7 [shape=box label="Enter when"]; - 8 [shape=box label="Enter when branch condition "]; - 9 [shape=box label="Access variable R|/x|"]; - 10 [shape=box label="Type operator: x is Int"]; - 11 [shape=box label="Exit when branch condition"]; - 12 [shape=box label="Enter block"]; - 13 [shape=box label="Enter function anonymousFunction"]; - 14 [shape=box label="Enter block"]; - 15 [shape=box label="Access variable R|/x|"]; - 16 [shape=box label="Function call: R|/x|.R|kotlin/Int.inc|()"]; - 17 [shape=box label="Exit block"]; - 18 [shape=box label="Exit function anonymousFunction"]; - 19 [shape=box label="Function call: R|/run|( = run@fun (): R|kotlin/Unit| { + subgraph cluster_2 { + color=red + 5 [label="Enter function test_1" style="filled" fillcolor=red]; + subgraph cluster_3 { + color=blue + 6 [label="Enter block"]; + subgraph cluster_4 { + color=blue + 7 [label="Enter when"]; + subgraph cluster_5 { + color=blue + 8 [label="Enter when branch condition "]; + 9 [label="Access variable R|/x|"]; + 10 [label="Type operator: x is Int"]; + 11 [label="Exit when branch condition"]; + } + subgraph cluster_6 { + color=blue + 12 [label="Enter block"]; + subgraph cluster_7 { + color=blue + 13 [label="Enter function anonymousFunction"]; + subgraph cluster_8 { + color=blue + 14 [label="Enter block"]; + 15 [label="Access variable R|/x|"]; + 16 [label="Function call: R|/x|.R|kotlin/Int.inc|()"]; + 17 [label="Exit block"]; + } + 18 [label="Exit function anonymousFunction"]; + } + 19 [label="Function call: R|/run|( = run@fun (): R|kotlin/Unit| { R|/x|.R|kotlin/Int.inc|() } )"]; - 20 [shape=box label="Exit block"]; - 21 [shape=box label="Exit when branch result"]; - 22 [shape=box label="Enter when branch condition else"]; - 23 [shape=box label="Exit when branch condition"]; - 24 [shape=box label="Enter block"]; - 25 [shape=box label="Exit block"]; - 26 [shape=box label="Exit when branch result"]; - 27 [shape=box label="Exit when"]; - 28 [shape=box label="Exit block"]; - 29 [shape=box label="Exit function test_1" style="filled"]; + 20 [label="Exit block"]; + } + 21 [label="Exit when branch result"]; + subgraph cluster_9 { + color=blue + 22 [label="Enter when branch condition else"]; + 23 [label="Exit when branch condition"]; + } + subgraph cluster_10 { + color=blue + 24 [label="Enter block"]; + 25 [label="Exit block"]; + } + 26 [label="Exit when branch result"]; + 27 [label="Exit when"]; + } + 28 [label="Exit block"]; + } + 29 [label="Exit function test_1" style="filled" fillcolor=red]; + } 5 -> {6}; 6 -> {7}; @@ -68,43 +100,66 @@ subgraph cluster_test_1 { 26 -> {27}; 27 -> {28}; 28 -> {29}; -} -subgraph cluster__anonymous_ { - 30 [shape=box label="Enter function anonymousFunction" style="filled"]; - 31 [shape=box label="Enter block"]; - 32 [shape=box label="Access variable R|/x|"]; - 33 [shape=box label="Function call: R|/x|.#()"]; - 34 [shape=box label="Exit block"]; - 35 [shape=box label="Exit function anonymousFunction" style="filled"]; + subgraph cluster_11 { + color=red + 30 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; + subgraph cluster_12 { + color=blue + 31 [label="Enter block"]; + 32 [label="Access variable R|/x|"]; + 33 [label="Function call: R|/x|.#()"]; + 34 [label="Exit block"]; + } + 35 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; + } 30 -> {31}; 31 -> {32}; 32 -> {33}; 33 -> {34}; 34 -> {35}; -} -subgraph cluster_test_2 { - 36 [shape=box label="Enter function test_2" style="filled"]; - 37 [shape=box label="Enter block"]; - 38 [shape=box label="Enter when"]; - 39 [shape=box label="Enter when branch condition "]; - 40 [shape=box label="Access variable R|/x|"]; - 41 [shape=box label="Type operator: x is Int"]; - 42 [shape=box label="Exit when branch condition"]; - 43 [shape=box label="Enter block"]; - 44 [shape=box label="Variable declaration: lval lambda: R|kotlin/Function0|"]; - 45 [shape=box label="Exit block"]; - 46 [shape=box label="Exit when branch result"]; - 47 [shape=box label="Enter when branch condition else"]; - 48 [shape=box label="Exit when branch condition"]; - 49 [shape=box label="Enter block"]; - 50 [shape=box label="Exit block"]; - 51 [shape=box label="Exit when branch result"]; - 52 [shape=box label="Exit when"]; - 53 [shape=box label="Exit block"]; - 54 [shape=box label="Exit function test_2" style="filled"]; + subgraph cluster_13 { + color=red + 36 [label="Enter function test_2" style="filled" fillcolor=red]; + subgraph cluster_14 { + color=blue + 37 [label="Enter block"]; + subgraph cluster_15 { + color=blue + 38 [label="Enter when"]; + subgraph cluster_16 { + color=blue + 39 [label="Enter when branch condition "]; + 40 [label="Access variable R|/x|"]; + 41 [label="Type operator: x is Int"]; + 42 [label="Exit when branch condition"]; + } + subgraph cluster_17 { + color=blue + 43 [label="Enter block"]; + 44 [label="Variable declaration: lval lambda: R|kotlin/Function0|"]; + 45 [label="Exit block"]; + } + 46 [label="Exit when branch result"]; + subgraph cluster_18 { + color=blue + 47 [label="Enter when branch condition else"]; + 48 [label="Exit when branch condition"]; + } + subgraph cluster_19 { + color=blue + 49 [label="Enter block"]; + 50 [label="Exit block"]; + } + 51 [label="Exit when branch result"]; + 52 [label="Exit when"]; + } + 53 [label="Exit block"]; + } + 54 [label="Exit function test_2" style="filled" fillcolor=red]; + } 36 -> {37}; 37 -> {38}; @@ -124,6 +179,5 @@ subgraph cluster_test_2 { 51 -> {52}; 52 -> {53}; 53 -> {54}; -} } diff --git a/compiler/fir/resolve/testData/resolve/cfg/loops.dot b/compiler/fir/resolve/testData/resolve/cfg/loops.dot index 950118a6198..c71ec874429 100644 --- a/compiler/fir/resolve/testData/resolve/cfg/loops.dot +++ b/compiler/fir/resolve/testData/resolve/cfg/loops.dot @@ -1,25 +1,44 @@ digraph loops_kt { -graph [splines=ortho, nodesep=3] + graph [splines=ortho nodesep=3] + node [shape=box penwidth=2] + edge [penwidth=2] -subgraph cluster_testWhile { - 0 [shape=box label="Enter function testWhile" style="filled"]; - 1 [shape=box label="Enter block"]; - 2 [shape=box label="Enter while loop"]; - 3 [shape=box label="Enter loop condition"]; - 4 [shape=box label="Access variable R|/b|"]; - 5 [shape=box label="Exit loop condition"]; - 6 [shape=box label="Enter loop block"]; - 7 [shape=box label="Enter block"]; - 8 [shape=box label="Access variable R|/x|"]; - 9 [shape=box label="Type operator: x is String"]; - 10 [shape=box label="Variable declaration: lval y: R|kotlin/Boolean|"]; - 11 [shape=box label="Exit block"]; - 12 [shape=box label="Exit loop block"]; - 13 [shape=box label="Exit whileloop"]; - 14 [shape=box label="Access variable R|/x|"]; - 15 [shape=box label="Type operator: x is String"]; - 16 [shape=box label="Exit block"]; - 17 [shape=box label="Exit function testWhile" style="filled"]; + subgraph cluster_0 { + color=red + 0 [label="Enter function testWhile" style="filled" fillcolor=red]; + subgraph cluster_1 { + color=blue + 1 [label="Enter block"]; + subgraph cluster_2 { + color=blue + 2 [label="Enter while loop"]; + subgraph cluster_3 { + color=blue + 3 [label="Enter loop condition"]; + 4 [label="Access variable R|/b|"]; + 5 [label="Exit loop condition"]; + } + subgraph cluster_4 { + color=blue + 6 [label="Enter loop block"]; + subgraph cluster_5 { + color=blue + 7 [label="Enter block"]; + 8 [label="Access variable R|/x|"]; + 9 [label="Type operator: x is String"]; + 10 [label="Variable declaration: lval y: R|kotlin/Boolean|"]; + 11 [label="Exit block"]; + } + 12 [label="Exit loop block"]; + } + 13 [label="Exit whileloop"]; + } + 14 [label="Access variable R|/x|"]; + 15 [label="Type operator: x is String"]; + 16 [label="Exit block"]; + } + 17 [label="Exit function testWhile" style="filled" fillcolor=red]; + } 0 -> {1}; 1 -> {2}; @@ -38,27 +57,43 @@ subgraph cluster_testWhile { 14 -> {15}; 15 -> {16}; 16 -> {17}; -} -subgraph cluster_testDoWhile { - 18 [shape=box label="Enter function testDoWhile" style="filled"]; - 19 [shape=box label="Enter block"]; - 20 [shape=box label="Enter do-while loop"]; - 21 [shape=box label="Enter loop block"]; - 22 [shape=box label="Enter block"]; - 23 [shape=box label="Access variable R|/x|"]; - 24 [shape=box label="Type operator: x is String"]; - 25 [shape=box label="Variable declaration: lval y: R|kotlin/Boolean|"]; - 26 [shape=box label="Exit block"]; - 27 [shape=box label="Exit loop block"]; - 28 [shape=box label="Enter loop condition"]; - 29 [shape=box label="Access variable R|/b|"]; - 30 [shape=box label="Exit loop condition"]; - 31 [shape=box label="Exit do-whileloop"]; - 32 [shape=box label="Access variable R|/x|"]; - 33 [shape=box label="Type operator: x is String"]; - 34 [shape=box label="Exit block"]; - 35 [shape=box label="Exit function testDoWhile" style="filled"]; + subgraph cluster_6 { + color=red + 18 [label="Enter function testDoWhile" style="filled" fillcolor=red]; + subgraph cluster_7 { + color=blue + 19 [label="Enter block"]; + subgraph cluster_8 { + color=blue + 20 [label="Enter do-while loop"]; + subgraph cluster_9 { + color=blue + 21 [label="Enter loop block"]; + subgraph cluster_10 { + color=blue + 22 [label="Enter block"]; + 23 [label="Access variable R|/x|"]; + 24 [label="Type operator: x is String"]; + 25 [label="Variable declaration: lval y: R|kotlin/Boolean|"]; + 26 [label="Exit block"]; + } + 27 [label="Exit loop block"]; + } + subgraph cluster_11 { + color=blue + 28 [label="Enter loop condition"]; + 29 [label="Access variable R|/b|"]; + 30 [label="Exit loop condition"]; + } + 31 [label="Exit do-whileloop"]; + } + 32 [label="Access variable R|/x|"]; + 33 [label="Type operator: x is String"]; + 34 [label="Exit block"]; + } + 35 [label="Exit function testDoWhile" style="filled" fillcolor=red]; + } 18 -> {19}; 19 -> {20}; @@ -77,38 +112,54 @@ subgraph cluster_testDoWhile { 32 -> {33}; 33 -> {34}; 34 -> {35}; -} -subgraph cluster_testFor { - 36 [shape=box label="Enter function testFor" style="filled"]; - 37 [shape=box label="Enter block"]; - 38 [shape=box label="Const: Int(0)"]; - 39 [shape=box label="Const: Int(5)"]; - 40 [shape=box label="Function call: Int(0).R|kotlin/Int.rangeTo|(Int(5))"]; - 41 [shape=box label="Variable declaration: lval : R|kotlin/ranges/IntRange|"]; - 42 [shape=box label="Access variable R|/|"]; - 43 [shape=box label="Function call: R|/|.R|kotlin/ranges/IntProgression.iterator|()"]; - 44 [shape=box label="Variable declaration: lval : R|kotlin/collections/IntIterator|"]; - 45 [shape=box label="Enter while loop"]; - 46 [shape=box label="Enter loop condition"]; - 47 [shape=box label="Access variable R|/|"]; - 48 [shape=box label="Function call: R|/|.R|FakeOverride|()"]; - 49 [shape=box label="Exit loop condition"]; - 50 [shape=box label="Enter loop block"]; - 51 [shape=box label="Enter block"]; - 52 [shape=box label="Access variable R|/|"]; - 53 [shape=box label="Function call: R|/|.R|kotlin/collections/IntIterator.next|()"]; - 54 [shape=box label="Variable declaration: lval i: R|kotlin/Int|"]; - 55 [shape=box label="Access variable R|/x|"]; - 56 [shape=box label="Type operator: x is String"]; - 57 [shape=box label="Variable declaration: lval y: R|kotlin/Boolean|"]; - 58 [shape=box label="Exit block"]; - 59 [shape=box label="Exit loop block"]; - 60 [shape=box label="Exit whileloop"]; - 61 [shape=box label="Access variable R|/x|"]; - 62 [shape=box label="Type operator: x is String"]; - 63 [shape=box label="Exit block"]; - 64 [shape=box label="Exit function testFor" style="filled"]; + subgraph cluster_12 { + color=red + 36 [label="Enter function testFor" style="filled" fillcolor=red]; + subgraph cluster_13 { + color=blue + 37 [label="Enter block"]; + 38 [label="Const: Int(0)"]; + 39 [label="Const: Int(5)"]; + 40 [label="Function call: Int(0).R|kotlin/Int.rangeTo|(Int(5))"]; + 41 [label="Variable declaration: lval : R|kotlin/ranges/IntRange|"]; + 42 [label="Access variable R|/|"]; + 43 [label="Function call: R|/|.R|kotlin/ranges/IntProgression.iterator|()"]; + 44 [label="Variable declaration: lval : R|kotlin/collections/IntIterator|"]; + subgraph cluster_14 { + color=blue + 45 [label="Enter while loop"]; + subgraph cluster_15 { + color=blue + 46 [label="Enter loop condition"]; + 47 [label="Access variable R|/|"]; + 48 [label="Function call: R|/|.R|FakeOverride|()"]; + 49 [label="Exit loop condition"]; + } + subgraph cluster_16 { + color=blue + 50 [label="Enter loop block"]; + subgraph cluster_17 { + color=blue + 51 [label="Enter block"]; + 52 [label="Access variable R|/|"]; + 53 [label="Function call: R|/|.R|kotlin/collections/IntIterator.next|()"]; + 54 [label="Variable declaration: lval i: R|kotlin/Int|"]; + 55 [label="Access variable R|/x|"]; + 56 [label="Type operator: x is String"]; + 57 [label="Variable declaration: lval y: R|kotlin/Boolean|"]; + 58 [label="Exit block"]; + } + 59 [label="Exit loop block"]; + } + 60 [label="Exit whileloop"]; + } + 61 [label="Access variable R|/x|"]; + 62 [label="Type operator: x is String"]; + 63 [label="Exit block"]; + } + 64 [label="Exit function testFor" style="filled" fillcolor=red]; + } 36 -> {37}; 37 -> {38}; @@ -138,25 +189,41 @@ subgraph cluster_testFor { 61 -> {62}; 62 -> {63}; 63 -> {64}; -} -subgraph cluster_testWhileTrue { - 65 [shape=box label="Enter function testWhileTrue" style="filled"]; - 66 [shape=box label="Enter block"]; - 67 [shape=box label="Enter while loop"]; - 68 [shape=box label="Enter loop condition"]; - 69 [shape=box label="Const: Boolean(true)"]; - 70 [shape=box label="Exit loop condition"]; - 71 [shape=box label="Enter loop block"]; - 72 [shape=box label="Enter block"]; - 73 [shape=box label="Const: Int(1)"]; - 74 [shape=box label="Exit block"]; - 75 [shape=box label="Exit loop block"]; - 76 [shape=box label="Stub[DEAD]"]; - 77 [shape=box label="Exit whileloop[DEAD]"]; - 78 [shape=box label="Const: Int(1)[DEAD]"]; - 79 [shape=box label="Exit block[DEAD]"]; - 80 [shape=box label="Exit function testWhileTrue[DEAD]" style="filled"]; + subgraph cluster_18 { + color=red + 65 [label="Enter function testWhileTrue" style="filled" fillcolor=red]; + subgraph cluster_19 { + color=blue + 66 [label="Enter block"]; + subgraph cluster_20 { + color=blue + 67 [label="Enter while loop"]; + subgraph cluster_21 { + color=blue + 68 [label="Enter loop condition"]; + 69 [label="Const: Boolean(true)"]; + 70 [label="Exit loop condition"]; + } + subgraph cluster_22 { + color=blue + 71 [label="Enter loop block"]; + subgraph cluster_23 { + color=blue + 72 [label="Enter block"]; + 73 [label="Const: Int(1)"]; + 74 [label="Exit block"]; + } + 75 [label="Exit loop block"]; + } + 76 [label="Stub" style="filled" fillcolor=gray]; + 77 [label="Exit whileloop" style="filled" fillcolor=gray]; + } + 78 [label="Const: Int(1)" style="filled" fillcolor=gray]; + 79 [label="Exit block" style="filled" fillcolor=gray]; + } + 80 [label="Exit function testWhileTrue" style="filled" fillcolor=red style="filled" fillcolor=gray]; + } 65 -> {66}; 66 -> {67}; @@ -174,39 +241,70 @@ subgraph cluster_testWhileTrue { 77 -> {78} [style=dotted]; 78 -> {79} [style=dotted]; 79 -> {80} [style=dotted]; -} -subgraph cluster_testWhileTrueWithBreak { - 81 [shape=box label="Enter function testWhileTrueWithBreak" style="filled"]; - 82 [shape=box label="Enter block"]; - 83 [shape=box label="Enter while loop"]; - 84 [shape=box label="Enter loop condition"]; - 85 [shape=box label="Const: Boolean(true)"]; - 86 [shape=box label="Exit loop condition"]; - 87 [shape=box label="Enter loop block"]; - 88 [shape=box label="Enter block"]; - 89 [shape=box label="Enter when"]; - 90 [shape=box label="Enter when branch condition "]; - 91 [shape=box label="Access variable R|/b|"]; - 92 [shape=box label="Exit when branch condition"]; - 93 [shape=box label="Enter block"]; - 94 [shape=box label="Jump: break@@@[Boolean(true)] "]; - 95 [shape=box label="Stub[DEAD]"]; - 96 [shape=box label="Exit block[DEAD]"]; - 97 [shape=box label="Exit when branch result[DEAD]"]; - 98 [shape=box label="Enter when branch condition else"]; - 99 [shape=box label="Exit when branch condition"]; - 100 [shape=box label="Enter block"]; - 101 [shape=box label="Exit block"]; - 102 [shape=box label="Exit when branch result"]; - 103 [shape=box label="Exit when"]; - 104 [shape=box label="Exit block"]; - 105 [shape=box label="Exit loop block"]; - 106 [shape=box label="Stub[DEAD]"]; - 107 [shape=box label="Exit whileloop"]; - 108 [shape=box label="Const: Int(1)"]; - 109 [shape=box label="Exit block"]; - 110 [shape=box label="Exit function testWhileTrueWithBreak" style="filled"]; + subgraph cluster_24 { + color=red + 81 [label="Enter function testWhileTrueWithBreak" style="filled" fillcolor=red]; + subgraph cluster_25 { + color=blue + 82 [label="Enter block"]; + subgraph cluster_26 { + color=blue + 83 [label="Enter while loop"]; + subgraph cluster_27 { + color=blue + 84 [label="Enter loop condition"]; + 85 [label="Const: Boolean(true)"]; + 86 [label="Exit loop condition"]; + } + subgraph cluster_28 { + color=blue + 87 [label="Enter loop block"]; + subgraph cluster_29 { + color=blue + 88 [label="Enter block"]; + subgraph cluster_30 { + color=blue + 89 [label="Enter when"]; + subgraph cluster_31 { + color=blue + 90 [label="Enter when branch condition "]; + 91 [label="Access variable R|/b|"]; + 92 [label="Exit when branch condition"]; + } + subgraph cluster_32 { + color=blue + 93 [label="Enter block"]; + 94 [label="Jump: break@@@[Boolean(true)] "]; + 95 [label="Stub" style="filled" fillcolor=gray]; + 96 [label="Exit block" style="filled" fillcolor=gray]; + } + 97 [label="Exit when branch result" style="filled" fillcolor=gray]; + subgraph cluster_33 { + color=blue + 98 [label="Enter when branch condition else"]; + 99 [label="Exit when branch condition"]; + } + subgraph cluster_34 { + color=blue + 100 [label="Enter block"]; + 101 [label="Exit block"]; + } + 102 [label="Exit when branch result"]; + 103 [label="Exit when"]; + } + 104 [label="Exit block"]; + } + 105 [label="Exit loop block"]; + } + 106 [label="Stub" style="filled" fillcolor=gray]; + 107 [label="Exit whileloop"]; + } + 108 [label="Const: Int(1)"]; + 109 [label="Exit block"]; + } + 110 [label="Exit function testWhileTrueWithBreak" style="filled" fillcolor=red]; + } 81 -> {82}; 82 -> {83}; @@ -239,25 +337,41 @@ subgraph cluster_testWhileTrueWithBreak { 107 -> {108}; 108 -> {109}; 109 -> {110}; -} -subgraph cluster_testWhileFalse { - 111 [shape=box label="Enter function testWhileFalse" style="filled"]; - 112 [shape=box label="Enter block"]; - 113 [shape=box label="Enter while loop"]; - 114 [shape=box label="Enter loop condition"]; - 115 [shape=box label="Const: Boolean(false)"]; - 116 [shape=box label="Exit loop condition"]; - 117 [shape=box label="Stub[DEAD]"]; - 118 [shape=box label="Enter loop block[DEAD]"]; - 119 [shape=box label="Enter block[DEAD]"]; - 120 [shape=box label="Const: Int(1)[DEAD]"]; - 121 [shape=box label="Exit block[DEAD]"]; - 122 [shape=box label="Exit loop block[DEAD]"]; - 123 [shape=box label="Exit whileloop"]; - 124 [shape=box label="Const: Int(1)"]; - 125 [shape=box label="Exit block"]; - 126 [shape=box label="Exit function testWhileFalse" style="filled"]; + subgraph cluster_35 { + color=red + 111 [label="Enter function testWhileFalse" style="filled" fillcolor=red]; + subgraph cluster_36 { + color=blue + 112 [label="Enter block"]; + subgraph cluster_37 { + color=blue + 113 [label="Enter while loop"]; + subgraph cluster_38 { + color=blue + 114 [label="Enter loop condition"]; + 115 [label="Const: Boolean(false)"]; + 116 [label="Exit loop condition"]; + } + 117 [label="Stub" style="filled" fillcolor=gray]; + subgraph cluster_39 { + color=blue + 118 [label="Enter loop block" style="filled" fillcolor=gray]; + subgraph cluster_40 { + color=blue + 119 [label="Enter block" style="filled" fillcolor=gray]; + 120 [label="Const: Int(1)" style="filled" fillcolor=gray]; + 121 [label="Exit block" style="filled" fillcolor=gray]; + } + 122 [label="Exit loop block" style="filled" fillcolor=gray]; + } + 123 [label="Exit whileloop"]; + } + 124 [label="Const: Int(1)"]; + 125 [label="Exit block"]; + } + 126 [label="Exit function testWhileFalse" style="filled" fillcolor=red]; + } 111 -> {112}; 112 -> {113}; @@ -275,25 +389,41 @@ subgraph cluster_testWhileFalse { 123 -> {124}; 124 -> {125}; 125 -> {126}; -} -subgraph cluster_testDoWhileTrue { - 127 [shape=box label="Enter function testDoWhileTrue" style="filled"]; - 128 [shape=box label="Enter block"]; - 129 [shape=box label="Enter do-while loop"]; - 130 [shape=box label="Enter loop block"]; - 131 [shape=box label="Enter block"]; - 132 [shape=box label="Const: Int(1)"]; - 133 [shape=box label="Exit block"]; - 134 [shape=box label="Exit loop block"]; - 135 [shape=box label="Enter loop condition"]; - 136 [shape=box label="Const: Boolean(true)"]; - 137 [shape=box label="Exit loop condition"]; - 138 [shape=box label="Stub[DEAD]"]; - 139 [shape=box label="Exit do-whileloop[DEAD]"]; - 140 [shape=box label="Const: Int(1)[DEAD]"]; - 141 [shape=box label="Exit block[DEAD]"]; - 142 [shape=box label="Exit function testDoWhileTrue[DEAD]" style="filled"]; + subgraph cluster_41 { + color=red + 127 [label="Enter function testDoWhileTrue" style="filled" fillcolor=red]; + subgraph cluster_42 { + color=blue + 128 [label="Enter block"]; + subgraph cluster_43 { + color=blue + 129 [label="Enter do-while loop"]; + subgraph cluster_44 { + color=blue + 130 [label="Enter loop block"]; + subgraph cluster_45 { + color=blue + 131 [label="Enter block"]; + 132 [label="Const: Int(1)"]; + 133 [label="Exit block"]; + } + 134 [label="Exit loop block"]; + } + subgraph cluster_46 { + color=blue + 135 [label="Enter loop condition"]; + 136 [label="Const: Boolean(true)"]; + 137 [label="Exit loop condition"]; + } + 138 [label="Stub" style="filled" fillcolor=gray]; + 139 [label="Exit do-whileloop" style="filled" fillcolor=gray]; + } + 140 [label="Const: Int(1)" style="filled" fillcolor=gray]; + 141 [label="Exit block" style="filled" fillcolor=gray]; + } + 142 [label="Exit function testDoWhileTrue" style="filled" fillcolor=red style="filled" fillcolor=gray]; + } 127 -> {128}; 128 -> {129}; @@ -311,39 +441,70 @@ subgraph cluster_testDoWhileTrue { 139 -> {140} [style=dotted]; 140 -> {141} [style=dotted]; 141 -> {142} [style=dotted]; -} -subgraph cluster_testDoWhileTrueWithBreak { - 143 [shape=box label="Enter function testDoWhileTrueWithBreak" style="filled"]; - 144 [shape=box label="Enter block"]; - 145 [shape=box label="Enter do-while loop"]; - 146 [shape=box label="Enter loop block"]; - 147 [shape=box label="Enter block"]; - 148 [shape=box label="Enter when"]; - 149 [shape=box label="Enter when branch condition "]; - 150 [shape=box label="Access variable R|/b|"]; - 151 [shape=box label="Exit when branch condition"]; - 152 [shape=box label="Enter block"]; - 153 [shape=box label="Jump: break@@@[Boolean(true)] "]; - 154 [shape=box label="Stub[DEAD]"]; - 155 [shape=box label="Exit block[DEAD]"]; - 156 [shape=box label="Exit when branch result[DEAD]"]; - 157 [shape=box label="Enter when branch condition else"]; - 158 [shape=box label="Exit when branch condition"]; - 159 [shape=box label="Enter block"]; - 160 [shape=box label="Exit block"]; - 161 [shape=box label="Exit when branch result"]; - 162 [shape=box label="Exit when"]; - 163 [shape=box label="Exit block"]; - 164 [shape=box label="Exit loop block"]; - 165 [shape=box label="Enter loop condition"]; - 166 [shape=box label="Const: Boolean(true)"]; - 167 [shape=box label="Exit loop condition"]; - 168 [shape=box label="Stub[DEAD]"]; - 169 [shape=box label="Exit do-whileloop"]; - 170 [shape=box label="Const: Int(1)"]; - 171 [shape=box label="Exit block"]; - 172 [shape=box label="Exit function testDoWhileTrueWithBreak" style="filled"]; + subgraph cluster_47 { + color=red + 143 [label="Enter function testDoWhileTrueWithBreak" style="filled" fillcolor=red]; + subgraph cluster_48 { + color=blue + 144 [label="Enter block"]; + subgraph cluster_49 { + color=blue + 145 [label="Enter do-while loop"]; + subgraph cluster_50 { + color=blue + 146 [label="Enter loop block"]; + subgraph cluster_51 { + color=blue + 147 [label="Enter block"]; + subgraph cluster_52 { + color=blue + 148 [label="Enter when"]; + subgraph cluster_53 { + color=blue + 149 [label="Enter when branch condition "]; + 150 [label="Access variable R|/b|"]; + 151 [label="Exit when branch condition"]; + } + subgraph cluster_54 { + color=blue + 152 [label="Enter block"]; + 153 [label="Jump: break@@@[Boolean(true)] "]; + 154 [label="Stub" style="filled" fillcolor=gray]; + 155 [label="Exit block" style="filled" fillcolor=gray]; + } + 156 [label="Exit when branch result" style="filled" fillcolor=gray]; + subgraph cluster_55 { + color=blue + 157 [label="Enter when branch condition else"]; + 158 [label="Exit when branch condition"]; + } + subgraph cluster_56 { + color=blue + 159 [label="Enter block"]; + 160 [label="Exit block"]; + } + 161 [label="Exit when branch result"]; + 162 [label="Exit when"]; + } + 163 [label="Exit block"]; + } + 164 [label="Exit loop block"]; + } + subgraph cluster_57 { + color=blue + 165 [label="Enter loop condition"]; + 166 [label="Const: Boolean(true)"]; + 167 [label="Exit loop condition"]; + } + 168 [label="Stub" style="filled" fillcolor=gray]; + 169 [label="Exit do-whileloop"]; + } + 170 [label="Const: Int(1)"]; + 171 [label="Exit block"]; + } + 172 [label="Exit function testDoWhileTrueWithBreak" style="filled" fillcolor=red]; + } 143 -> {144}; 144 -> {145}; @@ -376,25 +537,41 @@ subgraph cluster_testDoWhileTrueWithBreak { 169 -> {170}; 170 -> {171}; 171 -> {172}; -} -subgraph cluster_testDoWhileFalse { - 173 [shape=box label="Enter function testDoWhileFalse" style="filled"]; - 174 [shape=box label="Enter block"]; - 175 [shape=box label="Enter do-while loop"]; - 176 [shape=box label="Enter loop block"]; - 177 [shape=box label="Enter block"]; - 178 [shape=box label="Const: Int(1)"]; - 179 [shape=box label="Exit block"]; - 180 [shape=box label="Exit loop block"]; - 181 [shape=box label="Enter loop condition"]; - 182 [shape=box label="Const: Boolean(false)"]; - 183 [shape=box label="Exit loop condition"]; - 184 [shape=box label="Exit do-whileloop"]; - 185 [shape=box label="Const: Int(1)"]; - 186 [shape=box label="Exit block"]; - 187 [shape=box label="Exit function testDoWhileFalse" style="filled"]; - 188 [shape=box label="Stub[DEAD]"]; + subgraph cluster_58 { + color=red + 173 [label="Enter function testDoWhileFalse" style="filled" fillcolor=red]; + subgraph cluster_59 { + color=blue + 174 [label="Enter block"]; + subgraph cluster_60 { + color=blue + 175 [label="Enter do-while loop"]; + subgraph cluster_61 { + color=blue + 176 [label="Enter loop block"]; + subgraph cluster_62 { + color=blue + 177 [label="Enter block"]; + 178 [label="Const: Int(1)"]; + 179 [label="Exit block"]; + } + 180 [label="Exit loop block"]; + } + subgraph cluster_63 { + color=blue + 181 [label="Enter loop condition"]; + 182 [label="Const: Boolean(false)"]; + 183 [label="Exit loop condition"]; + } + 184 [label="Exit do-whileloop"]; + } + 185 [label="Const: Int(1)"]; + 186 [label="Exit block"]; + } + 187 [label="Exit function testDoWhileFalse" style="filled" fillcolor=red]; + } + 188 [label="Stub" style="filled" fillcolor=gray]; 173 -> {174}; 174 -> {175}; @@ -412,6 +589,5 @@ subgraph cluster_testDoWhileFalse { 185 -> {186}; 186 -> {187}; 188 -> {176} [style=dotted]; -} } diff --git a/compiler/fir/resolve/testData/resolve/cfg/propertiesAndInitBlocks.dot b/compiler/fir/resolve/testData/resolve/cfg/propertiesAndInitBlocks.dot index 128a87a7c37..ffd4341a1ec 100644 --- a/compiler/fir/resolve/testData/resolve/cfg/propertiesAndInitBlocks.dot +++ b/compiler/fir/resolve/testData/resolve/cfg/propertiesAndInitBlocks.dot @@ -1,36 +1,48 @@ digraph propertiesAndInitBlocks_kt { -graph [splines=ortho, nodesep=3] + graph [splines=ortho nodesep=3] + node [shape=box penwidth=2] + edge [penwidth=2] -subgraph cluster_run { - 0 [shape=box label="Enter function run" style="filled"]; - 1 [shape=box label="Enter block"]; - 2 [shape=box label="Function call: R|/block|.R|FakeOverride|()"]; - 3 [shape=box label="Exit block"]; - 4 [shape=box label="Exit function run" style="filled"]; + subgraph cluster_0 { + color=red + 0 [label="Enter function run" style="filled" fillcolor=red]; + subgraph cluster_1 { + color=blue + 1 [label="Enter block"]; + 2 [label="Function call: R|/block|.R|FakeOverride|()"]; + 3 [label="Exit block"]; + } + 4 [label="Exit function run" style="filled" fillcolor=red]; + } 0 -> {1}; 1 -> {2}; 2 -> {3}; 3 -> {4}; -} -subgraph cluster_val_x1 { - 5 [shape=box label="Enter property" style="filled"]; - 6 [shape=box label="Const: Int(1)"]; - 7 [shape=box label="Exit property" style="filled"]; + subgraph cluster_2 { + color=red + 5 [label="Enter property" style="filled" fillcolor=red]; + 6 [label="Const: Int(1)"]; + 7 [label="Exit property" style="filled" fillcolor=red]; + } 5 -> {6}; 6 -> {7}; -} -subgraph cluster__getter_ { - 8 [shape=box label="Enter function getter" style="filled"]; - 9 [shape=box label="Enter block"]; - 10 [shape=box label="Const: Int(1)"]; - 11 [shape=box label="Jump: ^ Int(1)"]; - 12 [shape=box label="Stub[DEAD]"]; - 13 [shape=box label="Exit block[DEAD]"]; - 14 [shape=box label="Exit function getter" style="filled"]; + subgraph cluster_3 { + color=red + 8 [label="Enter function getter" style="filled" fillcolor=red]; + subgraph cluster_4 { + color=blue + 9 [label="Enter block"]; + 10 [label="Const: Int(1)"]; + 11 [label="Jump: ^ Int(1)"]; + 12 [label="Stub" style="filled" fillcolor=gray]; + 13 [label="Exit block" style="filled" fillcolor=gray]; + } + 14 [label="Exit function getter" style="filled" fillcolor=red]; + } 8 -> {9}; 9 -> {10}; @@ -39,44 +51,53 @@ subgraph cluster__getter_ { 11 -> {12} [style=dotted]; 12 -> {13} [style=dotted]; 13 -> {14} [style=dotted]; -} -subgraph cluster__setter_ { - 15 [shape=box label="Enter function setter" style="filled"]; - 16 [shape=box label="Enter block"]; - 17 [shape=box label="Const: Int(1)"]; - 18 [shape=box label="Assignmenet: F|/x2|"]; - 19 [shape=box label="Exit block"]; - 20 [shape=box label="Exit function setter" style="filled"]; + subgraph cluster_5 { + color=red + 15 [label="Enter function setter" style="filled" fillcolor=red]; + subgraph cluster_6 { + color=blue + 16 [label="Enter block"]; + 17 [label="Const: Int(1)"]; + 18 [label="Assignmenet: F|/x2|"]; + 19 [label="Exit block"]; + } + 20 [label="Exit function setter" style="filled" fillcolor=red]; + } 15 -> {16}; 16 -> {17}; 17 -> {18}; 18 -> {19}; 19 -> {20}; -} -subgraph cluster_val_x2 { - 21 [shape=box label="Enter property" style="filled"]; - 22 [shape=box label="Const: Int(1)"]; - 23 [shape=box label="Exit property" style="filled"]; + subgraph cluster_7 { + color=red + 21 [label="Enter property" style="filled" fillcolor=red]; + 22 [label="Const: Int(1)"]; + 23 [label="Exit property" style="filled" fillcolor=red]; + } 21 -> {22}; 22 -> {23}; -} -subgraph cluster_foo { - 24 [shape=box label="Enter function foo" style="filled"]; - 25 [shape=box label="Enter block"]; - 26 [shape=box label="Const: Int(1)"]; - 27 [shape=box label="Const: Int(1)"]; - 28 [shape=box label="Function call: Int(1).R|kotlin/Int.plus|(Int(1))"]; - 29 [shape=box label="Variable declaration: lval c: R|kotlin/Int|"]; - 30 [shape=box label="Function call: #()"]; - 31 [shape=box label="Throw: throw #()"]; - 32 [shape=box label="Stub[DEAD]"]; - 33 [shape=box label="Exit block[DEAD]"]; - 34 [shape=box label="Exit function foo" style="filled"]; + subgraph cluster_8 { + color=red + 24 [label="Enter function foo" style="filled" fillcolor=red]; + subgraph cluster_9 { + color=blue + 25 [label="Enter block"]; + 26 [label="Const: Int(1)"]; + 27 [label="Const: Int(1)"]; + 28 [label="Function call: Int(1).R|kotlin/Int.plus|(Int(1))"]; + 29 [label="Variable declaration: lval c: R|kotlin/Int|"]; + 30 [label="Function call: #()"]; + 31 [label="Throw: throw #()"]; + 32 [label="Stub" style="filled" fillcolor=gray]; + 33 [label="Exit block" style="filled" fillcolor=gray]; + } + 34 [label="Exit function foo" style="filled" fillcolor=red]; + } 24 -> {25}; 25 -> {26}; @@ -89,27 +110,38 @@ subgraph cluster_foo { 31 -> {32} [style=dotted]; 32 -> {33} [style=dotted]; 33 -> {34} [style=dotted]; -} -subgraph cluster__init_ { - 35 [shape=box label="Enter function " style="filled"]; - 36 [shape=box label="Exit function " style="filled"]; + subgraph cluster_10 { + color=red + 35 [label="Enter function " style="filled" fillcolor=red]; + 36 [label="Exit function " style="filled" fillcolor=red]; + } 35 -> {36}; -} -subgraph cluster__getter_ { - 37 [shape=box label="Enter init block"]; - 38 [shape=box label="Enter block"]; - 39 [shape=box label="Function call: #()"]; - 40 [shape=box label="Throw: throw #()"]; - 41 [shape=box label="Stub[DEAD]"]; - 42 [shape=box label="Exit block[DEAD]"]; - 43 [shape=box label="Exit init block"]; - 44 [shape=box label="Enter function getter" style="filled"]; - 45 [shape=box label="Enter block"]; - 46 [shape=box label="Exit block"]; - 47 [shape=box label="Exit function getter" style="filled"]; + subgraph cluster_11 { + color=red + 37 [label="Enter init block"]; + subgraph cluster_12 { + color=blue + 38 [label="Enter block"]; + 39 [label="Function call: #()"]; + 40 [label="Throw: throw #()"]; + 41 [label="Stub" style="filled" fillcolor=gray]; + 42 [label="Exit block" style="filled" fillcolor=gray]; + } + 43 [label="Exit init block"]; + } + subgraph cluster_13 { + color=blue + 44 [label="Enter function getter" style="filled" fillcolor=red]; + subgraph cluster_14 { + color=blue + 45 [label="Enter block"]; + 46 [label="Exit block"]; + } + 47 [label="Exit function getter" style="filled" fillcolor=red]; + } 37 -> {38}; 38 -> {39}; @@ -121,33 +153,46 @@ subgraph cluster__getter_ { 44 -> {45}; 45 -> {46}; 46 -> {47}; -} -subgraph cluster__init_ { - 48 [shape=box label="Enter function " style="filled"]; - 49 [shape=box label="Exit function " style="filled"]; + subgraph cluster_15 { + color=red + 48 [label="Enter function " style="filled" fillcolor=red]; + 49 [label="Exit function " style="filled" fillcolor=red]; + } 48 -> {49}; -} -subgraph cluster_val_x3 { - 50 [shape=box label="Enter init block"]; - 51 [shape=box label="Enter block"]; - 52 [shape=box label="Function call: #()"]; - 53 [shape=box label="Throw: throw #()"]; - 54 [shape=box label="Stub[DEAD]"]; - 55 [shape=box label="Const: Int(1)[DEAD]"]; - 56 [shape=box label="Exit block[DEAD]"]; - 57 [shape=box label="Exit init block"]; - 58 [shape=box label="Enter property" style="filled"]; - 59 [shape=box label="Enter function anonymousFunction"]; - 60 [shape=box label="Enter block"]; - 61 [shape=box label="Function call: #()"]; - 62 [shape=box label="Throw: throw #()"]; - 63 [shape=box label="Stub[DEAD]"]; - 64 [shape=box label="Exit block[DEAD]"]; - 65 [shape=box label="Exit function anonymousFunction[DEAD]"]; - 66 [shape=box label="Function call: R|/run|( = run@fun (): R|kotlin/Unit| { + subgraph cluster_16 { + color=red + 50 [label="Enter init block"]; + subgraph cluster_17 { + color=blue + 51 [label="Enter block"]; + 52 [label="Function call: #()"]; + 53 [label="Throw: throw #()"]; + 54 [label="Stub" style="filled" fillcolor=gray]; + 55 [label="Const: Int(1)" style="filled" fillcolor=gray]; + 56 [label="Exit block" style="filled" fillcolor=gray]; + } + 57 [label="Exit init block"]; + } + subgraph cluster_18 { + color=blue + 58 [label="Enter property" style="filled" fillcolor=red]; + subgraph cluster_19 { + color=blue + 59 [label="Enter function anonymousFunction"]; + subgraph cluster_20 { + color=blue + 60 [label="Enter block"]; + 61 [label="Function call: #()"]; + 62 [label="Throw: throw #()"]; + 63 [label="Stub" style="filled" fillcolor=gray]; + 64 [label="Exit block" style="filled" fillcolor=gray]; + } + 65 [label="Exit function anonymousFunction" style="filled" fillcolor=gray]; + } + 66 [label="Function call: R|/run|( = run@fun (): R|kotlin/Unit| { local final fun foo(): R|kotlin/Unit| { lval c: R|kotlin/Int| = Int(1).R|kotlin/Int.plus|(Int(1)) throw #() @@ -167,8 +212,9 @@ subgraph cluster_val_x3 { throw #() } -)[DEAD]"]; - 67 [shape=box label="Exit property" style="filled"]; +)" style="filled" fillcolor=gray]; + 67 [label="Exit property" style="filled" fillcolor=red]; + } 50 -> {51}; 51 -> {52}; @@ -188,28 +234,50 @@ subgraph cluster_val_x3 { 64 -> {65} [style=dotted]; 65 -> {66} [style=dotted]; 66 -> {67} [style=dotted]; -} -subgraph cluster_val_x4 { - 68 [shape=box label="Enter property" style="filled"]; - 69 [shape=box label="Try expression enter"]; - 70 [shape=box label="Try main block enter"]; - 71 [shape=box label="Enter block"]; - 72 [shape=box label="Const: Int(1)"]; - 73 [shape=box label="Exit block"]; - 74 [shape=box label="Try main block exit"]; - 75 [shape=box label="Enter finally"]; - 76 [shape=box label="Enter block"]; - 77 [shape=box label="Const: Int(0)"]; - 78 [shape=box label="Exit block"]; - 79 [shape=box label="Exit finally"]; - 80 [shape=box label="Catch enter"]; - 81 [shape=box label="Enter block"]; - 82 [shape=box label="Const: Int(2)"]; - 83 [shape=box label="Exit block"]; - 84 [shape=box label="Catch exit"]; - 85 [shape=box label="Try expression exit"]; - 86 [shape=box label="Exit property" style="filled"]; + subgraph cluster_21 { + color=red + 68 [label="Enter property" style="filled" fillcolor=red]; + subgraph cluster_22 { + color=blue + 69 [label="Try expression enter"]; + subgraph cluster_23 { + color=blue + 70 [label="Try main block enter"]; + subgraph cluster_24 { + color=blue + 71 [label="Enter block"]; + 72 [label="Const: Int(1)"]; + 73 [label="Exit block"]; + } + 74 [label="Try main block exit"]; + } + subgraph cluster_25 { + color=blue + 75 [label="Enter finally"]; + subgraph cluster_26 { + color=blue + 76 [label="Enter block"]; + 77 [label="Const: Int(0)"]; + 78 [label="Exit block"]; + } + 79 [label="Exit finally"]; + } + subgraph cluster_27 { + color=blue + 80 [label="Catch enter"]; + subgraph cluster_28 { + color=blue + 81 [label="Enter block"]; + 82 [label="Const: Int(2)"]; + 83 [label="Exit block"]; + } + 84 [label="Catch exit"]; + } + 85 [label="Try expression exit"]; + } + 86 [label="Exit property" style="filled" fillcolor=red]; + } 68 -> {69}; 69 -> {70}; @@ -229,6 +297,5 @@ subgraph cluster_val_x4 { 83 -> {84}; 84 -> {85}; 85 -> {86}; -} } diff --git a/compiler/fir/resolve/testData/resolve/cfg/simple.dot b/compiler/fir/resolve/testData/resolve/cfg/simple.dot index 7669cb0297c..fd10b1fbbff 100644 --- a/compiler/fir/resolve/testData/resolve/cfg/simple.dot +++ b/compiler/fir/resolve/testData/resolve/cfg/simple.dot @@ -1,29 +1,40 @@ digraph simple_kt { -graph [splines=ortho, nodesep=3] + graph [splines=ortho nodesep=3] + node [shape=box penwidth=2] + edge [penwidth=2] -subgraph cluster_foo { - 0 [shape=box label="Enter function foo" style="filled"]; - 1 [shape=box label="Enter block"]; - 2 [shape=box label="Exit block"]; - 3 [shape=box label="Exit function foo" style="filled"]; + subgraph cluster_0 { + color=red + 0 [label="Enter function foo" style="filled" fillcolor=red]; + subgraph cluster_1 { + color=blue + 1 [label="Enter block"]; + 2 [label="Exit block"]; + } + 3 [label="Exit function foo" style="filled" fillcolor=red]; + } 0 -> {1}; 1 -> {2}; 2 -> {3}; -} -subgraph cluster_test { - 4 [shape=box label="Enter function test" style="filled"]; - 5 [shape=box label="Enter block"]; - 6 [shape=box label="Const: Int(1)"]; - 7 [shape=box label="Variable declaration: lval x: R|kotlin/Int|"]; - 8 [shape=box label="Access variable R|/x|"]; - 9 [shape=box label="Const: Int(1)"]; - 10 [shape=box label="Function call: R|/x|.R|kotlin/Int.plus|(Int(1))"]; - 11 [shape=box label="Variable declaration: lval y: R|kotlin/Int|"]; - 12 [shape=box label="Function call: R|/foo|()"]; - 13 [shape=box label="Exit block"]; - 14 [shape=box label="Exit function test" style="filled"]; + subgraph cluster_2 { + color=red + 4 [label="Enter function test" style="filled" fillcolor=red]; + subgraph cluster_3 { + color=blue + 5 [label="Enter block"]; + 6 [label="Const: Int(1)"]; + 7 [label="Variable declaration: lval x: R|kotlin/Int|"]; + 8 [label="Access variable R|/x|"]; + 9 [label="Const: Int(1)"]; + 10 [label="Function call: R|/x|.R|kotlin/Int.plus|(Int(1))"]; + 11 [label="Variable declaration: lval y: R|kotlin/Int|"]; + 12 [label="Function call: R|/foo|()"]; + 13 [label="Exit block"]; + } + 14 [label="Exit function test" style="filled" fillcolor=red]; + } 4 -> {5}; 5 -> {6}; @@ -35,6 +46,5 @@ subgraph cluster_test { 11 -> {12}; 12 -> {13}; 13 -> {14}; -} } diff --git a/compiler/fir/resolve/testData/resolve/cfg/tryCatch.dot b/compiler/fir/resolve/testData/resolve/cfg/tryCatch.dot index c43c8c3c1ce..6592b42dc46 100644 --- a/compiler/fir/resolve/testData/resolve/cfg/tryCatch.dot +++ b/compiler/fir/resolve/testData/resolve/cfg/tryCatch.dot @@ -1,31 +1,59 @@ digraph tryCatch_kt { -graph [splines=ortho, nodesep=3] + graph [splines=ortho nodesep=3] + node [shape=box penwidth=2] + edge [penwidth=2] -subgraph cluster_test_1 { - 0 [shape=box label="Enter function test_1" style="filled"]; - 1 [shape=box label="Enter block"]; - 2 [shape=box label="Try expression enter"]; - 3 [shape=box label="Try main block enter"]; - 4 [shape=box label="Enter block"]; - 5 [shape=box label="Const: Int(1)"]; - 6 [shape=box label="Variable declaration: lval x: R|kotlin/Int|"]; - 7 [shape=box label="Exit block"]; - 8 [shape=box label="Try main block exit"]; - 9 [shape=box label="Catch enter"]; - 10 [shape=box label="Enter block"]; - 11 [shape=box label="Const: Int(3)"]; - 12 [shape=box label="Variable declaration: lval z: R|kotlin/Int|"]; - 13 [shape=box label="Exit block"]; - 14 [shape=box label="Catch exit"]; - 15 [shape=box label="Catch enter"]; - 16 [shape=box label="Enter block"]; - 17 [shape=box label="Const: Int(2)"]; - 18 [shape=box label="Variable declaration: lval y: R|kotlin/Int|"]; - 19 [shape=box label="Exit block"]; - 20 [shape=box label="Catch exit"]; - 21 [shape=box label="Try expression exit"]; - 22 [shape=box label="Exit block"]; - 23 [shape=box label="Exit function test_1" style="filled"]; + subgraph cluster_0 { + color=red + 0 [label="Enter function test_1" style="filled" fillcolor=red]; + subgraph cluster_1 { + color=blue + 1 [label="Enter block"]; + subgraph cluster_2 { + color=blue + 2 [label="Try expression enter"]; + subgraph cluster_3 { + color=blue + 3 [label="Try main block enter"]; + subgraph cluster_4 { + color=blue + 4 [label="Enter block"]; + 5 [label="Const: Int(1)"]; + 6 [label="Variable declaration: lval x: R|kotlin/Int|"]; + 7 [label="Exit block"]; + } + 8 [label="Try main block exit"]; + } + subgraph cluster_5 { + color=blue + 9 [label="Catch enter"]; + subgraph cluster_6 { + color=blue + 10 [label="Enter block"]; + 11 [label="Const: Int(3)"]; + 12 [label="Variable declaration: lval z: R|kotlin/Int|"]; + 13 [label="Exit block"]; + } + 14 [label="Catch exit"]; + } + subgraph cluster_7 { + color=blue + 15 [label="Catch enter"]; + subgraph cluster_8 { + color=blue + 16 [label="Enter block"]; + 17 [label="Const: Int(2)"]; + 18 [label="Variable declaration: lval y: R|kotlin/Int|"]; + 19 [label="Exit block"]; + } + 20 [label="Catch exit"]; + } + 21 [label="Try expression exit"]; + } + 22 [label="Exit block"]; + } + 23 [label="Exit function test_1" style="filled" fillcolor=red]; + } 0 -> {1}; 1 -> {2}; @@ -50,26 +78,45 @@ subgraph cluster_test_1 { 20 -> {21}; 21 -> {22}; 22 -> {23}; -} -subgraph cluster_test_2 { - 24 [shape=box label="Enter function test_2" style="filled"]; - 25 [shape=box label="Enter block"]; - 26 [shape=box label="Try expression enter"]; - 27 [shape=box label="Try main block enter"]; - 28 [shape=box label="Enter block"]; - 29 [shape=box label="Const: Int(1)"]; - 30 [shape=box label="Exit block"]; - 31 [shape=box label="Try main block exit"]; - 32 [shape=box label="Catch enter"]; - 33 [shape=box label="Enter block"]; - 34 [shape=box label="Const: Int(2)"]; - 35 [shape=box label="Exit block"]; - 36 [shape=box label="Catch exit"]; - 37 [shape=box label="Try expression exit"]; - 38 [shape=box label="Variable declaration: lval x: R|kotlin/Int|"]; - 39 [shape=box label="Exit block"]; - 40 [shape=box label="Exit function test_2" style="filled"]; + subgraph cluster_9 { + color=red + 24 [label="Enter function test_2" style="filled" fillcolor=red]; + subgraph cluster_10 { + color=blue + 25 [label="Enter block"]; + subgraph cluster_11 { + color=blue + 26 [label="Try expression enter"]; + subgraph cluster_12 { + color=blue + 27 [label="Try main block enter"]; + subgraph cluster_13 { + color=blue + 28 [label="Enter block"]; + 29 [label="Const: Int(1)"]; + 30 [label="Exit block"]; + } + 31 [label="Try main block exit"]; + } + subgraph cluster_14 { + color=blue + 32 [label="Catch enter"]; + subgraph cluster_15 { + color=blue + 33 [label="Enter block"]; + 34 [label="Const: Int(2)"]; + 35 [label="Exit block"]; + } + 36 [label="Catch exit"]; + } + 37 [label="Try expression exit"]; + } + 38 [label="Variable declaration: lval x: R|kotlin/Int|"]; + 39 [label="Exit block"]; + } + 40 [label="Exit function test_2" style="filled" fillcolor=red]; + } 24 -> {25}; 25 -> {26}; @@ -87,78 +134,145 @@ subgraph cluster_test_2 { 37 -> {38}; 38 -> {39}; 39 -> {40}; -} -subgraph cluster_test_3 { - 41 [shape=box label="Enter function test_3" style="filled"]; - 42 [shape=box label="Enter block"]; - 43 [shape=box label="Enter while loop"]; - 44 [shape=box label="Enter loop condition"]; - 45 [shape=box label="Const: Boolean(true)"]; - 46 [shape=box label="Exit loop condition"]; - 47 [shape=box label="Enter loop block"]; - 48 [shape=box label="Enter block"]; - 49 [shape=box label="Try expression enter"]; - 50 [shape=box label="Try main block enter"]; - 51 [shape=box label="Enter block"]; - 52 [shape=box label="Enter when"]; - 53 [shape=box label="Enter when branch condition "]; - 54 [shape=box label="Access variable R|/b|"]; - 55 [shape=box label="Exit when branch condition"]; - 56 [shape=box label="Enter block"]; - 57 [shape=box label="Jump: ^test_3 Unit"]; - 58 [shape=box label="Stub[DEAD]"]; - 59 [shape=box label="Exit block[DEAD]"]; - 60 [shape=box label="Exit when branch result[DEAD]"]; - 61 [shape=box label="Enter when branch condition else"]; - 62 [shape=box label="Exit when branch condition"]; - 63 [shape=box label="Enter block"]; - 64 [shape=box label="Exit block"]; - 65 [shape=box label="Exit when branch result"]; - 66 [shape=box label="Exit when"]; - 67 [shape=box label="Const: Int(1)"]; - 68 [shape=box label="Variable declaration: lval x: R|kotlin/Int|"]; - 69 [shape=box label="Enter when"]; - 70 [shape=box label="Enter when branch condition "]; - 71 [shape=box label="Access variable R|/b|"]; - 72 [shape=box label="Function call: R|/b|.R|kotlin/Boolean.not|()"]; - 73 [shape=box label="Exit when branch condition"]; - 74 [shape=box label="Enter block"]; - 75 [shape=box label="Jump: break@@@[Boolean(true)] "]; - 76 [shape=box label="Stub[DEAD]"]; - 77 [shape=box label="Exit block[DEAD]"]; - 78 [shape=box label="Exit when branch result[DEAD]"]; - 79 [shape=box label="Enter when branch condition else"]; - 80 [shape=box label="Exit when branch condition"]; - 81 [shape=box label="Enter block"]; - 82 [shape=box label="Exit block"]; - 83 [shape=box label="Exit when branch result"]; - 84 [shape=box label="Exit when"]; - 85 [shape=box label="Exit block"]; - 86 [shape=box label="Try main block exit"]; - 87 [shape=box label="Catch enter"]; - 88 [shape=box label="Enter block"]; - 89 [shape=box label="Jump: break@@@[Boolean(true)] "]; - 90 [shape=box label="Stub[DEAD]"]; - 91 [shape=box label="Exit block[DEAD]"]; - 92 [shape=box label="Catch exit[DEAD]"]; - 93 [shape=box label="Catch enter"]; - 94 [shape=box label="Enter block"]; - 95 [shape=box label="Jump: continue@@@[Boolean(true)] "]; - 96 [shape=box label="Stub[DEAD]"]; - 97 [shape=box label="Exit block[DEAD]"]; - 98 [shape=box label="Catch exit[DEAD]"]; - 99 [shape=box label="Try expression exit"]; - 100 [shape=box label="Const: Int(2)"]; - 101 [shape=box label="Variable declaration: lval y: R|kotlin/Int|"]; - 102 [shape=box label="Exit block"]; - 103 [shape=box label="Exit loop block"]; - 104 [shape=box label="Stub[DEAD]"]; - 105 [shape=box label="Exit whileloop"]; - 106 [shape=box label="Const: Int(3)"]; - 107 [shape=box label="Variable declaration: lval z: R|kotlin/Int|"]; - 108 [shape=box label="Exit block"]; - 109 [shape=box label="Exit function test_3" style="filled"]; + subgraph cluster_16 { + color=red + 41 [label="Enter function test_3" style="filled" fillcolor=red]; + subgraph cluster_17 { + color=blue + 42 [label="Enter block"]; + subgraph cluster_18 { + color=blue + 43 [label="Enter while loop"]; + subgraph cluster_19 { + color=blue + 44 [label="Enter loop condition"]; + 45 [label="Const: Boolean(true)"]; + 46 [label="Exit loop condition"]; + } + subgraph cluster_20 { + color=blue + 47 [label="Enter loop block"]; + subgraph cluster_21 { + color=blue + 48 [label="Enter block"]; + subgraph cluster_22 { + color=blue + 49 [label="Try expression enter"]; + subgraph cluster_23 { + color=blue + 50 [label="Try main block enter"]; + subgraph cluster_24 { + color=blue + 51 [label="Enter block"]; + subgraph cluster_25 { + color=blue + 52 [label="Enter when"]; + subgraph cluster_26 { + color=blue + 53 [label="Enter when branch condition "]; + 54 [label="Access variable R|/b|"]; + 55 [label="Exit when branch condition"]; + } + subgraph cluster_27 { + color=blue + 56 [label="Enter block"]; + 57 [label="Jump: ^test_3 Unit"]; + 58 [label="Stub" style="filled" fillcolor=gray]; + 59 [label="Exit block" style="filled" fillcolor=gray]; + } + 60 [label="Exit when branch result" style="filled" fillcolor=gray]; + subgraph cluster_28 { + color=blue + 61 [label="Enter when branch condition else"]; + 62 [label="Exit when branch condition"]; + } + subgraph cluster_29 { + color=blue + 63 [label="Enter block"]; + 64 [label="Exit block"]; + } + 65 [label="Exit when branch result"]; + 66 [label="Exit when"]; + } + 67 [label="Const: Int(1)"]; + 68 [label="Variable declaration: lval x: R|kotlin/Int|"]; + subgraph cluster_30 { + color=blue + 69 [label="Enter when"]; + subgraph cluster_31 { + color=blue + 70 [label="Enter when branch condition "]; + 71 [label="Access variable R|/b|"]; + 72 [label="Function call: R|/b|.R|kotlin/Boolean.not|()"]; + 73 [label="Exit when branch condition"]; + } + subgraph cluster_32 { + color=blue + 74 [label="Enter block"]; + 75 [label="Jump: break@@@[Boolean(true)] "]; + 76 [label="Stub" style="filled" fillcolor=gray]; + 77 [label="Exit block" style="filled" fillcolor=gray]; + } + 78 [label="Exit when branch result" style="filled" fillcolor=gray]; + subgraph cluster_33 { + color=blue + 79 [label="Enter when branch condition else"]; + 80 [label="Exit when branch condition"]; + } + subgraph cluster_34 { + color=blue + 81 [label="Enter block"]; + 82 [label="Exit block"]; + } + 83 [label="Exit when branch result"]; + 84 [label="Exit when"]; + } + 85 [label="Exit block"]; + } + 86 [label="Try main block exit"]; + } + subgraph cluster_35 { + color=blue + 87 [label="Catch enter"]; + subgraph cluster_36 { + color=blue + 88 [label="Enter block"]; + 89 [label="Jump: break@@@[Boolean(true)] "]; + 90 [label="Stub" style="filled" fillcolor=gray]; + 91 [label="Exit block" style="filled" fillcolor=gray]; + } + 92 [label="Catch exit" style="filled" fillcolor=gray]; + } + subgraph cluster_37 { + color=blue + 93 [label="Catch enter"]; + subgraph cluster_38 { + color=blue + 94 [label="Enter block"]; + 95 [label="Jump: continue@@@[Boolean(true)] "]; + 96 [label="Stub" style="filled" fillcolor=gray]; + 97 [label="Exit block" style="filled" fillcolor=gray]; + } + 98 [label="Catch exit" style="filled" fillcolor=gray]; + } + 99 [label="Try expression exit"]; + } + 100 [label="Const: Int(2)"]; + 101 [label="Variable declaration: lval y: R|kotlin/Int|"]; + 102 [label="Exit block"]; + } + 103 [label="Exit loop block"]; + } + 104 [label="Stub" style="filled" fillcolor=gray]; + 105 [label="Exit whileloop"]; + } + 106 [label="Const: Int(3)"]; + 107 [label="Variable declaration: lval z: R|kotlin/Int|"]; + 108 [label="Exit block"]; + } + 109 [label="Exit function test_3" style="filled" fillcolor=red]; + } 41 -> {42}; 42 -> {43}; @@ -233,6 +347,5 @@ subgraph cluster_test_3 { 106 -> {107}; 107 -> {108}; 108 -> {109}; -} } diff --git a/compiler/fir/resolve/testData/resolve/cfg/when.dot b/compiler/fir/resolve/testData/resolve/cfg/when.dot index 2ae0e1b3039..d3e2b929919 100644 --- a/compiler/fir/resolve/testData/resolve/cfg/when.dot +++ b/compiler/fir/resolve/testData/resolve/cfg/when.dot @@ -1,52 +1,86 @@ digraph when_kt { -graph [splines=ortho, nodesep=3] + graph [splines=ortho nodesep=3] + node [shape=box penwidth=2] + edge [penwidth=2] -subgraph cluster_test_1 { - 0 [shape=box label="Enter function test_1" style="filled"]; - 1 [shape=box label="Enter block"]; - 2 [shape=box label="Enter when"]; - 3 [shape=box label="Enter when branch condition "]; - 4 [shape=box label="Access variable R|/x|"]; - 5 [shape=box label="Const: Int(1)"]; - 6 [shape=box label="Operator =="]; - 7 [shape=box label="Exit when branch condition"]; - 8 [shape=box label="Enter block"]; - 9 [shape=box label="Const: Int(10)"]; - 10 [shape=box label="Exit block"]; - 11 [shape=box label="Exit when branch result"]; - 12 [shape=box label="Enter when branch condition "]; - 13 [shape=box label="Access variable R|/x|"]; - 14 [shape=box label="Const: Int(2)"]; - 15 [shape=box label="Function call: R|/x|.R|kotlin/Int.rem|(Int(2))"]; - 16 [shape=box label="Const: Int(0)"]; - 17 [shape=box label="Operator =="]; - 18 [shape=box label="Exit when branch condition"]; - 19 [shape=box label="Enter block"]; - 20 [shape=box label="Const: Int(20)"]; - 21 [shape=box label="Exit block"]; - 22 [shape=box label="Exit when branch result"]; - 23 [shape=box label="Enter when branch condition "]; - 24 [shape=box label="Const: Int(1)"]; - 25 [shape=box label="Const: Int(1)"]; - 26 [shape=box label="Function call: Int(1).R|kotlin/Int.minus|(Int(1))"]; - 27 [shape=box label="Const: Int(0)"]; - 28 [shape=box label="Operator =="]; - 29 [shape=box label="Exit when branch condition"]; - 30 [shape=box label="Enter block"]; - 31 [shape=box label="Jump: ^test_1 Unit"]; - 32 [shape=box label="Stub[DEAD]"]; - 33 [shape=box label="Exit block[DEAD]"]; - 34 [shape=box label="Exit when branch result[DEAD]"]; - 35 [shape=box label="Enter when branch condition else"]; - 36 [shape=box label="Exit when branch condition"]; - 37 [shape=box label="Enter block"]; - 38 [shape=box label="Const: Int(5)"]; - 39 [shape=box label="Exit block"]; - 40 [shape=box label="Exit when branch result"]; - 41 [shape=box label="Exit when"]; - 42 [shape=box label="Variable declaration: lval y: R|kotlin/Int|"]; - 43 [shape=box label="Exit block"]; - 44 [shape=box label="Exit function test_1" style="filled"]; + subgraph cluster_0 { + color=red + 0 [label="Enter function test_1" style="filled" fillcolor=red]; + subgraph cluster_1 { + color=blue + 1 [label="Enter block"]; + subgraph cluster_2 { + color=blue + 2 [label="Enter when"]; + subgraph cluster_3 { + color=blue + 3 [label="Enter when branch condition "]; + 4 [label="Access variable R|/x|"]; + 5 [label="Const: Int(1)"]; + 6 [label="Operator =="]; + 7 [label="Exit when branch condition"]; + } + subgraph cluster_4 { + color=blue + 8 [label="Enter block"]; + 9 [label="Const: Int(10)"]; + 10 [label="Exit block"]; + } + 11 [label="Exit when branch result"]; + subgraph cluster_5 { + color=blue + 12 [label="Enter when branch condition "]; + 13 [label="Access variable R|/x|"]; + 14 [label="Const: Int(2)"]; + 15 [label="Function call: R|/x|.R|kotlin/Int.rem|(Int(2))"]; + 16 [label="Const: Int(0)"]; + 17 [label="Operator =="]; + 18 [label="Exit when branch condition"]; + } + subgraph cluster_6 { + color=blue + 19 [label="Enter block"]; + 20 [label="Const: Int(20)"]; + 21 [label="Exit block"]; + } + 22 [label="Exit when branch result"]; + subgraph cluster_7 { + color=blue + 23 [label="Enter when branch condition "]; + 24 [label="Const: Int(1)"]; + 25 [label="Const: Int(1)"]; + 26 [label="Function call: Int(1).R|kotlin/Int.minus|(Int(1))"]; + 27 [label="Const: Int(0)"]; + 28 [label="Operator =="]; + 29 [label="Exit when branch condition"]; + } + subgraph cluster_8 { + color=blue + 30 [label="Enter block"]; + 31 [label="Jump: ^test_1 Unit"]; + 32 [label="Stub" style="filled" fillcolor=gray]; + 33 [label="Exit block" style="filled" fillcolor=gray]; + } + 34 [label="Exit when branch result" style="filled" fillcolor=gray]; + subgraph cluster_9 { + color=blue + 35 [label="Enter when branch condition else"]; + 36 [label="Exit when branch condition"]; + } + subgraph cluster_10 { + color=blue + 37 [label="Enter block"]; + 38 [label="Const: Int(5)"]; + 39 [label="Exit block"]; + } + 40 [label="Exit when branch result"]; + 41 [label="Exit when"]; + } + 42 [label="Variable declaration: lval y: R|kotlin/Int|"]; + 43 [label="Exit block"]; + } + 44 [label="Exit function test_1" style="filled" fillcolor=red]; + } 0 -> {1}; 1 -> {2}; @@ -93,34 +127,56 @@ subgraph cluster_test_1 { 41 -> {42}; 42 -> {43}; 43 -> {44}; -} -subgraph cluster_test_2 { - 45 [shape=box label="Enter function test_2" style="filled"]; - 46 [shape=box label="Enter block"]; - 47 [shape=box label="Enter when"]; - 48 [shape=box label="Enter when branch condition "]; - 49 [shape=box label="Enter &&"]; - 50 [shape=box label="Access variable R|/x|"]; - 51 [shape=box label="Type operator: x is A"]; - 52 [shape=box label="Exit left part of &&"]; - 53 [shape=box label="Access variable R|/x|"]; - 54 [shape=box label="Type operator: x is B"]; - 55 [shape=box label="Exit &&"]; - 56 [shape=box label="Exit when branch condition"]; - 57 [shape=box label="Enter block"]; - 58 [shape=box label="Access variable R|/x|"]; - 59 [shape=box label="Type operator: x is A"]; - 60 [shape=box label="Exit block"]; - 61 [shape=box label="Exit when branch result"]; - 62 [shape=box label="Enter when branch condition else"]; - 63 [shape=box label="Exit when branch condition"]; - 64 [shape=box label="Enter block"]; - 65 [shape=box label="Exit block"]; - 66 [shape=box label="Exit when branch result"]; - 67 [shape=box label="Exit when"]; - 68 [shape=box label="Exit block"]; - 69 [shape=box label="Exit function test_2" style="filled"]; + subgraph cluster_11 { + color=red + 45 [label="Enter function test_2" style="filled" fillcolor=red]; + subgraph cluster_12 { + color=blue + 46 [label="Enter block"]; + subgraph cluster_13 { + color=blue + 47 [label="Enter when"]; + subgraph cluster_14 { + color=blue + 48 [label="Enter when branch condition "]; + subgraph cluster_15 { + color=blue + 49 [label="Enter &&"]; + 50 [label="Access variable R|/x|"]; + 51 [label="Type operator: x is A"]; + 52 [label="Exit left part of &&"]; + 53 [label="Access variable R|/x|"]; + 54 [label="Type operator: x is B"]; + 55 [label="Exit &&"]; + } + 56 [label="Exit when branch condition"]; + } + subgraph cluster_16 { + color=blue + 57 [label="Enter block"]; + 58 [label="Access variable R|/x|"]; + 59 [label="Type operator: x is A"]; + 60 [label="Exit block"]; + } + 61 [label="Exit when branch result"]; + subgraph cluster_17 { + color=blue + 62 [label="Enter when branch condition else"]; + 63 [label="Exit when branch condition"]; + } + subgraph cluster_18 { + color=blue + 64 [label="Enter block"]; + 65 [label="Exit block"]; + } + 66 [label="Exit when branch result"]; + 67 [label="Exit when"]; + } + 68 [label="Exit block"]; + } + 69 [label="Exit function test_2" style="filled" fillcolor=red]; + } 45 -> {46}; 46 -> {47}; @@ -146,6 +202,5 @@ subgraph cluster_test_2 { 66 -> {67}; 67 -> {68}; 68 -> {69}; -} } diff --git a/compiler/fir/resolve/testData/resolve/smartcasts/booleanOperators.dot b/compiler/fir/resolve/testData/resolve/smartcasts/booleanOperators.dot index 76be6d59dc6..e181b71f44f 100644 --- a/compiler/fir/resolve/testData/resolve/smartcasts/booleanOperators.dot +++ b/compiler/fir/resolve/testData/resolve/smartcasts/booleanOperators.dot @@ -1,64 +1,93 @@ digraph booleanOperators_kt { -graph [splines=ortho, nodesep=3] + graph [splines=ortho nodesep=3] + node [shape=box penwidth=2] + edge [penwidth=2] -subgraph cluster_foo { - 0 [shape=box label="Enter function foo" style="filled"]; - 1 [shape=box label="Exit function foo" style="filled"]; + subgraph cluster_0 { + color=red + 0 [label="Enter function foo" style="filled" fillcolor=red]; + 1 [label="Exit function foo" style="filled" fillcolor=red]; + } 0 -> {1}; -} -subgraph cluster_bool { - 2 [shape=box label="Enter function bool" style="filled"]; - 3 [shape=box label="Exit function bool" style="filled"]; + subgraph cluster_1 { + color=red + 2 [label="Enter function bool" style="filled" fillcolor=red]; + 3 [label="Exit function bool" style="filled" fillcolor=red]; + } 2 -> {3}; -} -subgraph cluster_bar { - 4 [shape=box label="Enter function bar" style="filled"]; - 5 [shape=box label="Exit function bar" style="filled"]; + subgraph cluster_2 { + color=red + 4 [label="Enter function bar" style="filled" fillcolor=red]; + 5 [label="Exit function bar" style="filled" fillcolor=red]; + } 4 -> {5}; -} -subgraph cluster_baz { - 6 [shape=box label="Enter function baz" style="filled"]; - 7 [shape=box label="Exit function baz" style="filled"]; + subgraph cluster_3 { + color=red + 6 [label="Enter function baz" style="filled" fillcolor=red]; + 7 [label="Exit function baz" style="filled" fillcolor=red]; + } 6 -> {7}; -} -subgraph cluster_test_1 { - 8 [shape=box label="Enter function test_1" style="filled"]; - 9 [shape=box label="Enter block"]; - 10 [shape=box label="Enter when"]; - 11 [shape=box label="Enter when branch condition "]; - 12 [shape=box label="Enter &&"]; - 13 [shape=box label="Access variable R|/x|"]; - 14 [shape=box label="Type operator: x is B"]; - 15 [shape=box label="Exit left part of &&"]; - 16 [shape=box label="Access variable R|/x|"]; - 17 [shape=box label="Type operator: x is C"]; - 18 [shape=box label="Exit &&"]; - 19 [shape=box label="Exit when branch condition"]; - 20 [shape=box label="Enter block"]; - 21 [shape=box label="Access variable R|/x|"]; - 22 [shape=box label="Function call: R|/x|.R|/A.foo|()"]; - 23 [shape=box label="Access variable R|/x|"]; - 24 [shape=box label="Function call: R|/x|.R|/B.bar|()"]; - 25 [shape=box label="Access variable R|/x|"]; - 26 [shape=box label="Function call: R|/x|.R|/C.baz|()"]; - 27 [shape=box label="Exit block"]; - 28 [shape=box label="Exit when branch result"]; - 29 [shape=box label="Enter when branch condition else"]; - 30 [shape=box label="Exit when branch condition"]; - 31 [shape=box label="Enter block"]; - 32 [shape=box label="Exit block"]; - 33 [shape=box label="Exit when branch result"]; - 34 [shape=box label="Exit when"]; - 35 [shape=box label="Exit block"]; - 36 [shape=box label="Exit function test_1" style="filled"]; + subgraph cluster_4 { + color=red + 8 [label="Enter function test_1" style="filled" fillcolor=red]; + subgraph cluster_5 { + color=blue + 9 [label="Enter block"]; + subgraph cluster_6 { + color=blue + 10 [label="Enter when"]; + subgraph cluster_7 { + color=blue + 11 [label="Enter when branch condition "]; + subgraph cluster_8 { + color=blue + 12 [label="Enter &&"]; + 13 [label="Access variable R|/x|"]; + 14 [label="Type operator: x is B"]; + 15 [label="Exit left part of &&"]; + 16 [label="Access variable R|/x|"]; + 17 [label="Type operator: x is C"]; + 18 [label="Exit &&"]; + } + 19 [label="Exit when branch condition"]; + } + subgraph cluster_9 { + color=blue + 20 [label="Enter block"]; + 21 [label="Access variable R|/x|"]; + 22 [label="Function call: R|/x|.R|/A.foo|()"]; + 23 [label="Access variable R|/x|"]; + 24 [label="Function call: R|/x|.R|/B.bar|()"]; + 25 [label="Access variable R|/x|"]; + 26 [label="Function call: R|/x|.R|/C.baz|()"]; + 27 [label="Exit block"]; + } + 28 [label="Exit when branch result"]; + subgraph cluster_10 { + color=blue + 29 [label="Enter when branch condition else"]; + 30 [label="Exit when branch condition"]; + } + subgraph cluster_11 { + color=blue + 31 [label="Enter block"]; + 32 [label="Exit block"]; + } + 33 [label="Exit when branch result"]; + 34 [label="Exit when"]; + } + 35 [label="Exit block"]; + } + 36 [label="Exit function test_1" style="filled" fillcolor=red]; + } 8 -> {9}; 9 -> {10}; @@ -88,38 +117,60 @@ subgraph cluster_test_1 { 33 -> {34}; 34 -> {35}; 35 -> {36}; -} -subgraph cluster_test_2 { - 37 [shape=box label="Enter function test_2" style="filled"]; - 38 [shape=box label="Enter block"]; - 39 [shape=box label="Enter when"]; - 40 [shape=box label="Enter when branch condition "]; - 41 [shape=box label="Enter ||"]; - 42 [shape=box label="Access variable R|/x|"]; - 43 [shape=box label="Type operator: x is B"]; - 44 [shape=box label="Exit left part of ||"]; - 45 [shape=box label="Access variable R|/x|"]; - 46 [shape=box label="Type operator: x is C"]; - 47 [shape=box label="Exit ||"]; - 48 [shape=box label="Exit when branch condition"]; - 49 [shape=box label="Enter block"]; - 50 [shape=box label="Access variable R|/x|"]; - 51 [shape=box label="Function call: R|/x|.R|/A.foo|()"]; - 52 [shape=box label="Access variable R|/x|"]; - 53 [shape=box label="Function call: R|/x|.#()"]; - 54 [shape=box label="Access variable R|/x|"]; - 55 [shape=box label="Function call: R|/x|.#()"]; - 56 [shape=box label="Exit block"]; - 57 [shape=box label="Exit when branch result"]; - 58 [shape=box label="Enter when branch condition else"]; - 59 [shape=box label="Exit when branch condition"]; - 60 [shape=box label="Enter block"]; - 61 [shape=box label="Exit block"]; - 62 [shape=box label="Exit when branch result"]; - 63 [shape=box label="Exit when"]; - 64 [shape=box label="Exit block"]; - 65 [shape=box label="Exit function test_2" style="filled"]; + subgraph cluster_12 { + color=red + 37 [label="Enter function test_2" style="filled" fillcolor=red]; + subgraph cluster_13 { + color=blue + 38 [label="Enter block"]; + subgraph cluster_14 { + color=blue + 39 [label="Enter when"]; + subgraph cluster_15 { + color=blue + 40 [label="Enter when branch condition "]; + subgraph cluster_16 { + color=blue + 41 [label="Enter ||"]; + 42 [label="Access variable R|/x|"]; + 43 [label="Type operator: x is B"]; + 44 [label="Exit left part of ||"]; + 45 [label="Access variable R|/x|"]; + 46 [label="Type operator: x is C"]; + 47 [label="Exit ||"]; + } + 48 [label="Exit when branch condition"]; + } + subgraph cluster_17 { + color=blue + 49 [label="Enter block"]; + 50 [label="Access variable R|/x|"]; + 51 [label="Function call: R|/x|.R|/A.foo|()"]; + 52 [label="Access variable R|/x|"]; + 53 [label="Function call: R|/x|.#()"]; + 54 [label="Access variable R|/x|"]; + 55 [label="Function call: R|/x|.#()"]; + 56 [label="Exit block"]; + } + 57 [label="Exit when branch result"]; + subgraph cluster_18 { + color=blue + 58 [label="Enter when branch condition else"]; + 59 [label="Exit when branch condition"]; + } + subgraph cluster_19 { + color=blue + 60 [label="Enter block"]; + 61 [label="Exit block"]; + } + 62 [label="Exit when branch result"]; + 63 [label="Exit when"]; + } + 64 [label="Exit block"]; + } + 65 [label="Exit function test_2" style="filled" fillcolor=red]; + } 37 -> {38}; 38 -> {39}; @@ -149,30 +200,49 @@ subgraph cluster_test_2 { 62 -> {63}; 63 -> {64}; 64 -> {65}; -} -subgraph cluster_test_3 { - 66 [shape=box label="Enter function test_3" style="filled"]; - 67 [shape=box label="Enter block"]; - 68 [shape=box label="Enter when"]; - 69 [shape=box label="Enter when branch condition "]; - 70 [shape=box label="Access variable R|/x|"]; - 71 [shape=box label="Type operator: x !is A"]; - 72 [shape=box label="Function call: (R|/x| !is R|A|).R|kotlin/Boolean.not|()"]; - 73 [shape=box label="Exit when branch condition"]; - 74 [shape=box label="Enter block"]; - 75 [shape=box label="Access variable R|/x|"]; - 76 [shape=box label="Function call: R|/x|.R|/A.foo|()"]; - 77 [shape=box label="Exit block"]; - 78 [shape=box label="Exit when branch result"]; - 79 [shape=box label="Enter when branch condition else"]; - 80 [shape=box label="Exit when branch condition"]; - 81 [shape=box label="Enter block"]; - 82 [shape=box label="Exit block"]; - 83 [shape=box label="Exit when branch result"]; - 84 [shape=box label="Exit when"]; - 85 [shape=box label="Exit block"]; - 86 [shape=box label="Exit function test_3" style="filled"]; + subgraph cluster_20 { + color=red + 66 [label="Enter function test_3" style="filled" fillcolor=red]; + subgraph cluster_21 { + color=blue + 67 [label="Enter block"]; + subgraph cluster_22 { + color=blue + 68 [label="Enter when"]; + subgraph cluster_23 { + color=blue + 69 [label="Enter when branch condition "]; + 70 [label="Access variable R|/x|"]; + 71 [label="Type operator: x !is A"]; + 72 [label="Function call: (R|/x| !is R|A|).R|kotlin/Boolean.not|()"]; + 73 [label="Exit when branch condition"]; + } + subgraph cluster_24 { + color=blue + 74 [label="Enter block"]; + 75 [label="Access variable R|/x|"]; + 76 [label="Function call: R|/x|.R|/A.foo|()"]; + 77 [label="Exit block"]; + } + 78 [label="Exit when branch result"]; + subgraph cluster_25 { + color=blue + 79 [label="Enter when branch condition else"]; + 80 [label="Exit when branch condition"]; + } + subgraph cluster_26 { + color=blue + 81 [label="Enter block"]; + 82 [label="Exit block"]; + } + 83 [label="Exit when branch result"]; + 84 [label="Exit when"]; + } + 85 [label="Exit block"]; + } + 86 [label="Exit function test_3" style="filled" fillcolor=red]; + } 66 -> {67}; 67 -> {68}; @@ -194,38 +264,60 @@ subgraph cluster_test_3 { 83 -> {84}; 84 -> {85}; 85 -> {86}; -} -subgraph cluster_test_4 { - 87 [shape=box label="Enter function test_4" style="filled"]; - 88 [shape=box label="Enter block"]; - 89 [shape=box label="Enter when"]; - 90 [shape=box label="Enter when branch condition "]; - 91 [shape=box label="Enter ||"]; - 92 [shape=box label="Access variable R|/x|"]; - 93 [shape=box label="Type operator: x !is String"]; - 94 [shape=box label="Exit left part of ||"]; - 95 [shape=box label="Access variable R|/x|"]; - 96 [shape=box label="Access variable R|kotlin/String.length|"]; - 97 [shape=box label="Const: Int(0)"]; - 98 [shape=box label="Operator =="]; - 99 [shape=box label="Exit ||"]; - 100 [shape=box label="Exit when branch condition"]; - 101 [shape=box label="Enter block"]; - 102 [shape=box label="Access variable R|/x|"]; - 103 [shape=box label="Access variable #"]; - 104 [shape=box label="Exit block"]; - 105 [shape=box label="Exit when branch result"]; - 106 [shape=box label="Enter when branch condition else"]; - 107 [shape=box label="Exit when branch condition"]; - 108 [shape=box label="Enter block"]; - 109 [shape=box label="Exit block"]; - 110 [shape=box label="Exit when branch result"]; - 111 [shape=box label="Exit when"]; - 112 [shape=box label="Access variable R|/x|"]; - 113 [shape=box label="Access variable #"]; - 114 [shape=box label="Exit block"]; - 115 [shape=box label="Exit function test_4" style="filled"]; + subgraph cluster_27 { + color=red + 87 [label="Enter function test_4" style="filled" fillcolor=red]; + subgraph cluster_28 { + color=blue + 88 [label="Enter block"]; + subgraph cluster_29 { + color=blue + 89 [label="Enter when"]; + subgraph cluster_30 { + color=blue + 90 [label="Enter when branch condition "]; + subgraph cluster_31 { + color=blue + 91 [label="Enter ||"]; + 92 [label="Access variable R|/x|"]; + 93 [label="Type operator: x !is String"]; + 94 [label="Exit left part of ||"]; + 95 [label="Access variable R|/x|"]; + 96 [label="Access variable R|kotlin/String.length|"]; + 97 [label="Const: Int(0)"]; + 98 [label="Operator =="]; + 99 [label="Exit ||"]; + } + 100 [label="Exit when branch condition"]; + } + subgraph cluster_32 { + color=blue + 101 [label="Enter block"]; + 102 [label="Access variable R|/x|"]; + 103 [label="Access variable #"]; + 104 [label="Exit block"]; + } + 105 [label="Exit when branch result"]; + subgraph cluster_33 { + color=blue + 106 [label="Enter when branch condition else"]; + 107 [label="Exit when branch condition"]; + } + subgraph cluster_34 { + color=blue + 108 [label="Enter block"]; + 109 [label="Exit block"]; + } + 110 [label="Exit when branch result"]; + 111 [label="Exit when"]; + } + 112 [label="Access variable R|/x|"]; + 113 [label="Access variable #"]; + 114 [label="Exit block"]; + } + 115 [label="Exit function test_4" style="filled" fillcolor=red]; + } 87 -> {88}; 88 -> {89}; @@ -255,34 +347,56 @@ subgraph cluster_test_4 { 112 -> {113}; 113 -> {114}; 114 -> {115}; -} -subgraph cluster_test_5 { - 116 [shape=box label="Enter function test_5" style="filled"]; - 117 [shape=box label="Enter block"]; - 118 [shape=box label="Enter when"]; - 119 [shape=box label="Enter when branch condition "]; - 120 [shape=box label="Enter ||"]; - 121 [shape=box label="Access variable R|/x|"]; - 122 [shape=box label="Const: Null(null)"]; - 123 [shape=box label="Operator !="]; - 124 [shape=box label="Exit left part of ||"]; - 125 [shape=box label="Const: Boolean(false)"]; - 126 [shape=box label="Exit ||"]; - 127 [shape=box label="Exit when branch condition"]; - 128 [shape=box label="Enter block"]; - 129 [shape=box label="Access variable R|/x|"]; - 130 [shape=box label="Function call: R|/x|.#()"]; - 131 [shape=box label="Exit block"]; - 132 [shape=box label="Exit when branch result"]; - 133 [shape=box label="Enter when branch condition else"]; - 134 [shape=box label="Exit when branch condition"]; - 135 [shape=box label="Enter block"]; - 136 [shape=box label="Exit block"]; - 137 [shape=box label="Exit when branch result"]; - 138 [shape=box label="Exit when"]; - 139 [shape=box label="Exit block"]; - 140 [shape=box label="Exit function test_5" style="filled"]; + subgraph cluster_35 { + color=red + 116 [label="Enter function test_5" style="filled" fillcolor=red]; + subgraph cluster_36 { + color=blue + 117 [label="Enter block"]; + subgraph cluster_37 { + color=blue + 118 [label="Enter when"]; + subgraph cluster_38 { + color=blue + 119 [label="Enter when branch condition "]; + subgraph cluster_39 { + color=blue + 120 [label="Enter ||"]; + 121 [label="Access variable R|/x|"]; + 122 [label="Const: Null(null)"]; + 123 [label="Operator !="]; + 124 [label="Exit left part of ||"]; + 125 [label="Const: Boolean(false)"]; + 126 [label="Exit ||"]; + } + 127 [label="Exit when branch condition"]; + } + subgraph cluster_40 { + color=blue + 128 [label="Enter block"]; + 129 [label="Access variable R|/x|"]; + 130 [label="Function call: R|/x|.#()"]; + 131 [label="Exit block"]; + } + 132 [label="Exit when branch result"]; + subgraph cluster_41 { + color=blue + 133 [label="Enter when branch condition else"]; + 134 [label="Exit when branch condition"]; + } + subgraph cluster_42 { + color=blue + 135 [label="Enter block"]; + 136 [label="Exit block"]; + } + 137 [label="Exit when branch result"]; + 138 [label="Exit when"]; + } + 139 [label="Exit block"]; + } + 140 [label="Exit function test_5" style="filled" fillcolor=red]; + } 116 -> {117}; 117 -> {118}; @@ -308,35 +422,57 @@ subgraph cluster_test_5 { 137 -> {138}; 138 -> {139}; 139 -> {140}; -} -subgraph cluster_test_6 { - 141 [shape=box label="Enter function test_6" style="filled"]; - 142 [shape=box label="Enter block"]; - 143 [shape=box label="Enter when"]; - 144 [shape=box label="Enter when branch condition "]; - 145 [shape=box label="Enter ||"]; - 146 [shape=box label="Const: Boolean(false)"]; - 147 [shape=box label="Exit left part of ||"]; - 148 [shape=box label="Access variable R|/x|"]; - 149 [shape=box label="Const: Null(null)"]; - 150 [shape=box label="Operator !="]; - 151 [shape=box label="Stub[DEAD]"]; - 152 [shape=box label="Exit ||"]; - 153 [shape=box label="Exit when branch condition"]; - 154 [shape=box label="Enter block"]; - 155 [shape=box label="Access variable R|/x|"]; - 156 [shape=box label="Function call: R|/x|.#()"]; - 157 [shape=box label="Exit block"]; - 158 [shape=box label="Exit when branch result"]; - 159 [shape=box label="Enter when branch condition else"]; - 160 [shape=box label="Exit when branch condition"]; - 161 [shape=box label="Enter block"]; - 162 [shape=box label="Exit block"]; - 163 [shape=box label="Exit when branch result"]; - 164 [shape=box label="Exit when"]; - 165 [shape=box label="Exit block"]; - 166 [shape=box label="Exit function test_6" style="filled"]; + subgraph cluster_43 { + color=red + 141 [label="Enter function test_6" style="filled" fillcolor=red]; + subgraph cluster_44 { + color=blue + 142 [label="Enter block"]; + subgraph cluster_45 { + color=blue + 143 [label="Enter when"]; + subgraph cluster_46 { + color=blue + 144 [label="Enter when branch condition "]; + subgraph cluster_47 { + color=blue + 145 [label="Enter ||"]; + 146 [label="Const: Boolean(false)"]; + 147 [label="Exit left part of ||"]; + 148 [label="Access variable R|/x|"]; + 149 [label="Const: Null(null)"]; + 150 [label="Operator !="]; + 151 [label="Stub" style="filled" fillcolor=gray]; + 152 [label="Exit ||"]; + } + 153 [label="Exit when branch condition"]; + } + subgraph cluster_48 { + color=blue + 154 [label="Enter block"]; + 155 [label="Access variable R|/x|"]; + 156 [label="Function call: R|/x|.#()"]; + 157 [label="Exit block"]; + } + 158 [label="Exit when branch result"]; + subgraph cluster_49 { + color=blue + 159 [label="Enter when branch condition else"]; + 160 [label="Exit when branch condition"]; + } + subgraph cluster_50 { + color=blue + 161 [label="Enter block"]; + 162 [label="Exit block"]; + } + 163 [label="Exit when branch result"]; + 164 [label="Exit when"]; + } + 165 [label="Exit block"]; + } + 166 [label="Exit function test_6" style="filled" fillcolor=red]; + } 141 -> {142}; 142 -> {143}; @@ -364,34 +500,56 @@ subgraph cluster_test_6 { 163 -> {164}; 164 -> {165}; 165 -> {166}; -} -subgraph cluster_test_7 { - 167 [shape=box label="Enter function test_7" style="filled"]; - 168 [shape=box label="Enter block"]; - 169 [shape=box label="Enter when"]; - 170 [shape=box label="Enter when branch condition "]; - 171 [shape=box label="Enter &&"]; - 172 [shape=box label="Access variable R|/x|"]; - 173 [shape=box label="Type operator: x is A"]; - 174 [shape=box label="Exit left part of &&"]; - 175 [shape=box label="Access variable R|/x|"]; - 176 [shape=box label="Function call: R|/x|.R|/A.bool|()"]; - 177 [shape=box label="Exit &&"]; - 178 [shape=box label="Exit when branch condition"]; - 179 [shape=box label="Enter block"]; - 180 [shape=box label="Access variable R|/x|"]; - 181 [shape=box label="Function call: R|/x|.R|/A.foo|()"]; - 182 [shape=box label="Exit block"]; - 183 [shape=box label="Exit when branch result"]; - 184 [shape=box label="Enter when branch condition else"]; - 185 [shape=box label="Exit when branch condition"]; - 186 [shape=box label="Enter block"]; - 187 [shape=box label="Exit block"]; - 188 [shape=box label="Exit when branch result"]; - 189 [shape=box label="Exit when"]; - 190 [shape=box label="Exit block"]; - 191 [shape=box label="Exit function test_7" style="filled"]; + subgraph cluster_51 { + color=red + 167 [label="Enter function test_7" style="filled" fillcolor=red]; + subgraph cluster_52 { + color=blue + 168 [label="Enter block"]; + subgraph cluster_53 { + color=blue + 169 [label="Enter when"]; + subgraph cluster_54 { + color=blue + 170 [label="Enter when branch condition "]; + subgraph cluster_55 { + color=blue + 171 [label="Enter &&"]; + 172 [label="Access variable R|/x|"]; + 173 [label="Type operator: x is A"]; + 174 [label="Exit left part of &&"]; + 175 [label="Access variable R|/x|"]; + 176 [label="Function call: R|/x|.R|/A.bool|()"]; + 177 [label="Exit &&"]; + } + 178 [label="Exit when branch condition"]; + } + subgraph cluster_56 { + color=blue + 179 [label="Enter block"]; + 180 [label="Access variable R|/x|"]; + 181 [label="Function call: R|/x|.R|/A.foo|()"]; + 182 [label="Exit block"]; + } + 183 [label="Exit when branch result"]; + subgraph cluster_57 { + color=blue + 184 [label="Enter when branch condition else"]; + 185 [label="Exit when branch condition"]; + } + subgraph cluster_58 { + color=blue + 186 [label="Enter block"]; + 187 [label="Exit block"]; + } + 188 [label="Exit when branch result"]; + 189 [label="Exit when"]; + } + 190 [label="Exit block"]; + } + 191 [label="Exit function test_7" style="filled" fillcolor=red]; + } 167 -> {168}; 168 -> {169}; @@ -417,6 +575,5 @@ subgraph cluster_test_7 { 188 -> {189}; 189 -> {190}; 190 -> {191}; -} } diff --git a/compiler/fir/resolve/testData/resolve/smartcasts/boundSmartcasts.dot b/compiler/fir/resolve/testData/resolve/smartcasts/boundSmartcasts.dot index b95dfb05e9e..75cd0dc6340 100644 --- a/compiler/fir/resolve/testData/resolve/smartcasts/boundSmartcasts.dot +++ b/compiler/fir/resolve/testData/resolve/smartcasts/boundSmartcasts.dot @@ -1,45 +1,69 @@ digraph boundSmartcasts_kt { -graph [splines=ortho, nodesep=3] + graph [splines=ortho nodesep=3] + node [shape=box penwidth=2] + edge [penwidth=2] -subgraph cluster_foo { - 0 [shape=box label="Enter function foo" style="filled"]; - 1 [shape=box label="Exit function foo" style="filled"]; + subgraph cluster_0 { + color=red + 0 [label="Enter function foo" style="filled" fillcolor=red]; + 1 [label="Exit function foo" style="filled" fillcolor=red]; + } 0 -> {1}; -} -subgraph cluster_bar { - 2 [shape=box label="Enter function bar" style="filled"]; - 3 [shape=box label="Exit function bar" style="filled"]; + subgraph cluster_1 { + color=red + 2 [label="Enter function bar" style="filled" fillcolor=red]; + 3 [label="Exit function bar" style="filled" fillcolor=red]; + } 2 -> {3}; -} -subgraph cluster_test_1 { - 4 [shape=box label="Enter function test_1" style="filled"]; - 5 [shape=box label="Enter block"]; - 6 [shape=box label="Access variable R|/x|"]; - 7 [shape=box label="Variable declaration: lval y: R|kotlin/Any|"]; - 8 [shape=box label="Enter when"]; - 9 [shape=box label="Enter when branch condition "]; - 10 [shape=box label="Access variable R|/x|"]; - 11 [shape=box label="Type operator: x is A"]; - 12 [shape=box label="Exit when branch condition"]; - 13 [shape=box label="Enter block"]; - 14 [shape=box label="Access variable R|/x|"]; - 15 [shape=box label="Function call: R|/x|.R|/A.foo|()"]; - 16 [shape=box label="Access variable R|/y|"]; - 17 [shape=box label="Function call: R|/y|.R|/A.foo|()"]; - 18 [shape=box label="Exit block"]; - 19 [shape=box label="Exit when branch result"]; - 20 [shape=box label="Enter when branch condition else"]; - 21 [shape=box label="Exit when branch condition"]; - 22 [shape=box label="Enter block"]; - 23 [shape=box label="Exit block"]; - 24 [shape=box label="Exit when branch result"]; - 25 [shape=box label="Exit when"]; - 26 [shape=box label="Exit block"]; - 27 [shape=box label="Exit function test_1" style="filled"]; + subgraph cluster_2 { + color=red + 4 [label="Enter function test_1" style="filled" fillcolor=red]; + subgraph cluster_3 { + color=blue + 5 [label="Enter block"]; + 6 [label="Access variable R|/x|"]; + 7 [label="Variable declaration: lval y: R|kotlin/Any|"]; + subgraph cluster_4 { + color=blue + 8 [label="Enter when"]; + subgraph cluster_5 { + color=blue + 9 [label="Enter when branch condition "]; + 10 [label="Access variable R|/x|"]; + 11 [label="Type operator: x is A"]; + 12 [label="Exit when branch condition"]; + } + subgraph cluster_6 { + color=blue + 13 [label="Enter block"]; + 14 [label="Access variable R|/x|"]; + 15 [label="Function call: R|/x|.R|/A.foo|()"]; + 16 [label="Access variable R|/y|"]; + 17 [label="Function call: R|/y|.R|/A.foo|()"]; + 18 [label="Exit block"]; + } + 19 [label="Exit when branch result"]; + subgraph cluster_7 { + color=blue + 20 [label="Enter when branch condition else"]; + 21 [label="Exit when branch condition"]; + } + subgraph cluster_8 { + color=blue + 22 [label="Enter block"]; + 23 [label="Exit block"]; + } + 24 [label="Exit when branch result"]; + 25 [label="Exit when"]; + } + 26 [label="Exit block"]; + } + 27 [label="Exit function test_1" style="filled" fillcolor=red]; + } 4 -> {5}; 5 -> {6}; @@ -64,33 +88,52 @@ subgraph cluster_test_1 { 24 -> {25}; 25 -> {26}; 26 -> {27}; -} -subgraph cluster_test_2 { - 28 [shape=box label="Enter function test_2" style="filled"]; - 29 [shape=box label="Enter block"]; - 30 [shape=box label="Access variable R|/x|"]; - 31 [shape=box label="Variable declaration: lval y: R|kotlin/Any|"]; - 32 [shape=box label="Enter when"]; - 33 [shape=box label="Enter when branch condition "]; - 34 [shape=box label="Access variable R|/y|"]; - 35 [shape=box label="Type operator: y is A"]; - 36 [shape=box label="Exit when branch condition"]; - 37 [shape=box label="Enter block"]; - 38 [shape=box label="Access variable R|/x|"]; - 39 [shape=box label="Function call: R|/x|.R|/A.foo|()"]; - 40 [shape=box label="Access variable R|/y|"]; - 41 [shape=box label="Function call: R|/y|.R|/A.foo|()"]; - 42 [shape=box label="Exit block"]; - 43 [shape=box label="Exit when branch result"]; - 44 [shape=box label="Enter when branch condition else"]; - 45 [shape=box label="Exit when branch condition"]; - 46 [shape=box label="Enter block"]; - 47 [shape=box label="Exit block"]; - 48 [shape=box label="Exit when branch result"]; - 49 [shape=box label="Exit when"]; - 50 [shape=box label="Exit block"]; - 51 [shape=box label="Exit function test_2" style="filled"]; + subgraph cluster_9 { + color=red + 28 [label="Enter function test_2" style="filled" fillcolor=red]; + subgraph cluster_10 { + color=blue + 29 [label="Enter block"]; + 30 [label="Access variable R|/x|"]; + 31 [label="Variable declaration: lval y: R|kotlin/Any|"]; + subgraph cluster_11 { + color=blue + 32 [label="Enter when"]; + subgraph cluster_12 { + color=blue + 33 [label="Enter when branch condition "]; + 34 [label="Access variable R|/y|"]; + 35 [label="Type operator: y is A"]; + 36 [label="Exit when branch condition"]; + } + subgraph cluster_13 { + color=blue + 37 [label="Enter block"]; + 38 [label="Access variable R|/x|"]; + 39 [label="Function call: R|/x|.R|/A.foo|()"]; + 40 [label="Access variable R|/y|"]; + 41 [label="Function call: R|/y|.R|/A.foo|()"]; + 42 [label="Exit block"]; + } + 43 [label="Exit when branch result"]; + subgraph cluster_14 { + color=blue + 44 [label="Enter when branch condition else"]; + 45 [label="Exit when branch condition"]; + } + subgraph cluster_15 { + color=blue + 46 [label="Enter block"]; + 47 [label="Exit block"]; + } + 48 [label="Exit when branch result"]; + 49 [label="Exit when"]; + } + 50 [label="Exit block"]; + } + 51 [label="Exit function test_2" style="filled" fillcolor=red]; + } 28 -> {29}; 29 -> {30}; @@ -115,49 +158,83 @@ subgraph cluster_test_2 { 48 -> {49}; 49 -> {50}; 50 -> {51}; -} -subgraph cluster_test_3 { - 52 [shape=box label="Enter function test_3" style="filled"]; - 53 [shape=box label="Enter block"]; - 54 [shape=box label="Access variable R|/x|"]; - 55 [shape=box label="Variable declaration: lvar z: R|kotlin/Any|"]; - 56 [shape=box label="Enter when"]; - 57 [shape=box label="Enter when branch condition "]; - 58 [shape=box label="Access variable R|/x|"]; - 59 [shape=box label="Type operator: x is A"]; - 60 [shape=box label="Exit when branch condition"]; - 61 [shape=box label="Enter block"]; - 62 [shape=box label="Access variable R|/z|"]; - 63 [shape=box label="Function call: R|/z|.R|/A.foo|()"]; - 64 [shape=box label="Exit block"]; - 65 [shape=box label="Exit when branch result"]; - 66 [shape=box label="Enter when branch condition else"]; - 67 [shape=box label="Exit when branch condition"]; - 68 [shape=box label="Enter block"]; - 69 [shape=box label="Exit block"]; - 70 [shape=box label="Exit when branch result"]; - 71 [shape=box label="Exit when"]; - 72 [shape=box label="Access variable R|/y|"]; - 73 [shape=box label="Assignmenet: R|/z|"]; - 74 [shape=box label="Enter when"]; - 75 [shape=box label="Enter when branch condition "]; - 76 [shape=box label="Access variable R|/y|"]; - 77 [shape=box label="Type operator: y is B"]; - 78 [shape=box label="Exit when branch condition"]; - 79 [shape=box label="Enter block"]; - 80 [shape=box label="Access variable R|/z|"]; - 81 [shape=box label="Function call: R|/z|.R|/B.bar|()"]; - 82 [shape=box label="Exit block"]; - 83 [shape=box label="Exit when branch result"]; - 84 [shape=box label="Enter when branch condition else"]; - 85 [shape=box label="Exit when branch condition"]; - 86 [shape=box label="Enter block"]; - 87 [shape=box label="Exit block"]; - 88 [shape=box label="Exit when branch result"]; - 89 [shape=box label="Exit when"]; - 90 [shape=box label="Exit block"]; - 91 [shape=box label="Exit function test_3" style="filled"]; + subgraph cluster_16 { + color=red + 52 [label="Enter function test_3" style="filled" fillcolor=red]; + subgraph cluster_17 { + color=blue + 53 [label="Enter block"]; + 54 [label="Access variable R|/x|"]; + 55 [label="Variable declaration: lvar z: R|kotlin/Any|"]; + subgraph cluster_18 { + color=blue + 56 [label="Enter when"]; + subgraph cluster_19 { + color=blue + 57 [label="Enter when branch condition "]; + 58 [label="Access variable R|/x|"]; + 59 [label="Type operator: x is A"]; + 60 [label="Exit when branch condition"]; + } + subgraph cluster_20 { + color=blue + 61 [label="Enter block"]; + 62 [label="Access variable R|/z|"]; + 63 [label="Function call: R|/z|.R|/A.foo|()"]; + 64 [label="Exit block"]; + } + 65 [label="Exit when branch result"]; + subgraph cluster_21 { + color=blue + 66 [label="Enter when branch condition else"]; + 67 [label="Exit when branch condition"]; + } + subgraph cluster_22 { + color=blue + 68 [label="Enter block"]; + 69 [label="Exit block"]; + } + 70 [label="Exit when branch result"]; + 71 [label="Exit when"]; + } + 72 [label="Access variable R|/y|"]; + 73 [label="Assignmenet: R|/z|"]; + subgraph cluster_23 { + color=blue + 74 [label="Enter when"]; + subgraph cluster_24 { + color=blue + 75 [label="Enter when branch condition "]; + 76 [label="Access variable R|/y|"]; + 77 [label="Type operator: y is B"]; + 78 [label="Exit when branch condition"]; + } + subgraph cluster_25 { + color=blue + 79 [label="Enter block"]; + 80 [label="Access variable R|/z|"]; + 81 [label="Function call: R|/z|.R|/B.bar|()"]; + 82 [label="Exit block"]; + } + 83 [label="Exit when branch result"]; + subgraph cluster_26 { + color=blue + 84 [label="Enter when branch condition else"]; + 85 [label="Exit when branch condition"]; + } + subgraph cluster_27 { + color=blue + 86 [label="Enter block"]; + 87 [label="Exit block"]; + } + 88 [label="Exit when branch result"]; + 89 [label="Exit when"]; + } + 90 [label="Exit block"]; + } + 91 [label="Exit function test_3" style="filled" fillcolor=red]; + } 52 -> {53}; 53 -> {54}; @@ -198,41 +275,60 @@ subgraph cluster_test_3 { 88 -> {89}; 89 -> {90}; 90 -> {91}; -} -subgraph cluster_test_4 { - 92 [shape=box label="Enter function test_4" style="filled"]; - 93 [shape=box label="Enter block"]; - 94 [shape=box label="Const: Int(1)"]; - 95 [shape=box label="Variable declaration: lvar x: R|kotlin/Any|"]; - 96 [shape=box label="Access variable R|/x|"]; - 97 [shape=box label="Type operator: x as Int"]; - 98 [shape=box label="Access variable R|/x|"]; - 99 [shape=box label="Function call: R|/x|.R|kotlin/Int.inc|()"]; - 100 [shape=box label="Access variable R|/y|"]; - 101 [shape=box label="Assignmenet: R|/x|"]; - 102 [shape=box label="Access variable R|/x|"]; - 103 [shape=box label="Function call: R|/x|.#()"]; - 104 [shape=box label="Enter when"]; - 105 [shape=box label="Enter when branch condition "]; - 106 [shape=box label="Access variable R|/y|"]; - 107 [shape=box label="Type operator: y is A"]; - 108 [shape=box label="Exit when branch condition"]; - 109 [shape=box label="Enter block"]; - 110 [shape=box label="Access variable R|/x|"]; - 111 [shape=box label="Function call: R|/x|.R|/A.foo|()"]; - 112 [shape=box label="Access variable R|/y|"]; - 113 [shape=box label="Function call: R|/y|.R|/A.foo|()"]; - 114 [shape=box label="Exit block"]; - 115 [shape=box label="Exit when branch result"]; - 116 [shape=box label="Enter when branch condition else"]; - 117 [shape=box label="Exit when branch condition"]; - 118 [shape=box label="Enter block"]; - 119 [shape=box label="Exit block"]; - 120 [shape=box label="Exit when branch result"]; - 121 [shape=box label="Exit when"]; - 122 [shape=box label="Exit block"]; - 123 [shape=box label="Exit function test_4" style="filled"]; + subgraph cluster_28 { + color=red + 92 [label="Enter function test_4" style="filled" fillcolor=red]; + subgraph cluster_29 { + color=blue + 93 [label="Enter block"]; + 94 [label="Const: Int(1)"]; + 95 [label="Variable declaration: lvar x: R|kotlin/Any|"]; + 96 [label="Access variable R|/x|"]; + 97 [label="Type operator: x as Int"]; + 98 [label="Access variable R|/x|"]; + 99 [label="Function call: R|/x|.R|kotlin/Int.inc|()"]; + 100 [label="Access variable R|/y|"]; + 101 [label="Assignmenet: R|/x|"]; + 102 [label="Access variable R|/x|"]; + 103 [label="Function call: R|/x|.#()"]; + subgraph cluster_30 { + color=blue + 104 [label="Enter when"]; + subgraph cluster_31 { + color=blue + 105 [label="Enter when branch condition "]; + 106 [label="Access variable R|/y|"]; + 107 [label="Type operator: y is A"]; + 108 [label="Exit when branch condition"]; + } + subgraph cluster_32 { + color=blue + 109 [label="Enter block"]; + 110 [label="Access variable R|/x|"]; + 111 [label="Function call: R|/x|.R|/A.foo|()"]; + 112 [label="Access variable R|/y|"]; + 113 [label="Function call: R|/y|.R|/A.foo|()"]; + 114 [label="Exit block"]; + } + 115 [label="Exit when branch result"]; + subgraph cluster_33 { + color=blue + 116 [label="Enter when branch condition else"]; + 117 [label="Exit when branch condition"]; + } + subgraph cluster_34 { + color=blue + 118 [label="Enter block"]; + 119 [label="Exit block"]; + } + 120 [label="Exit when branch result"]; + 121 [label="Exit when"]; + } + 122 [label="Exit block"]; + } + 123 [label="Exit function test_4" style="filled" fillcolor=red]; + } 92 -> {93}; 93 -> {94}; @@ -265,6 +361,5 @@ subgraph cluster_test_4 { 120 -> {121}; 121 -> {122}; 122 -> {123}; -} } diff --git a/compiler/fir/resolve/testData/resolve/smartcasts/casts.dot b/compiler/fir/resolve/testData/resolve/smartcasts/casts.dot index e7c37292711..16f458c7ef2 100644 --- a/compiler/fir/resolve/testData/resolve/smartcasts/casts.dot +++ b/compiler/fir/resolve/testData/resolve/smartcasts/casts.dot @@ -1,15 +1,22 @@ digraph casts_kt { -graph [splines=ortho, nodesep=3] + graph [splines=ortho nodesep=3] + node [shape=box penwidth=2] + edge [penwidth=2] -subgraph cluster_test_1 { - 0 [shape=box label="Enter function test_1" style="filled"]; - 1 [shape=box label="Enter block"]; - 2 [shape=box label="Access variable R|/x|"]; - 3 [shape=box label="Type operator: x as String"]; - 4 [shape=box label="Access variable R|/x|"]; - 5 [shape=box label="Access variable R|kotlin/String.length|"]; - 6 [shape=box label="Exit block"]; - 7 [shape=box label="Exit function test_1" style="filled"]; + subgraph cluster_0 { + color=red + 0 [label="Enter function test_1" style="filled" fillcolor=red]; + subgraph cluster_1 { + color=blue + 1 [label="Enter block"]; + 2 [label="Access variable R|/x|"]; + 3 [label="Type operator: x as String"]; + 4 [label="Access variable R|/x|"]; + 5 [label="Access variable R|kotlin/String.length|"]; + 6 [label="Exit block"]; + } + 7 [label="Exit function test_1" style="filled" fillcolor=red]; + } 0 -> {1}; 1 -> {2}; @@ -18,31 +25,50 @@ subgraph cluster_test_1 { 4 -> {5}; 5 -> {6}; 6 -> {7}; -} -subgraph cluster_test_2 { - 8 [shape=box label="Enter function test_2" style="filled"]; - 9 [shape=box label="Enter block"]; - 10 [shape=box label="Enter when"]; - 11 [shape=box label="Enter when branch condition "]; - 12 [shape=box label="Access variable R|/x|"]; - 13 [shape=box label="Type operator: x as Boolean"]; - 14 [shape=box label="Exit when branch condition"]; - 15 [shape=box label="Enter block"]; - 16 [shape=box label="Access variable R|/x|"]; - 17 [shape=box label="Function call: R|/x|.R|kotlin/Boolean.not|()"]; - 18 [shape=box label="Exit block"]; - 19 [shape=box label="Exit when branch result"]; - 20 [shape=box label="Enter when branch condition else"]; - 21 [shape=box label="Exit when branch condition"]; - 22 [shape=box label="Enter block"]; - 23 [shape=box label="Exit block"]; - 24 [shape=box label="Exit when branch result"]; - 25 [shape=box label="Exit when"]; - 26 [shape=box label="Access variable R|/x|"]; - 27 [shape=box label="Function call: R|/x|.R|kotlin/Boolean.not|()"]; - 28 [shape=box label="Exit block"]; - 29 [shape=box label="Exit function test_2" style="filled"]; + subgraph cluster_2 { + color=red + 8 [label="Enter function test_2" style="filled" fillcolor=red]; + subgraph cluster_3 { + color=blue + 9 [label="Enter block"]; + subgraph cluster_4 { + color=blue + 10 [label="Enter when"]; + subgraph cluster_5 { + color=blue + 11 [label="Enter when branch condition "]; + 12 [label="Access variable R|/x|"]; + 13 [label="Type operator: x as Boolean"]; + 14 [label="Exit when branch condition"]; + } + subgraph cluster_6 { + color=blue + 15 [label="Enter block"]; + 16 [label="Access variable R|/x|"]; + 17 [label="Function call: R|/x|.R|kotlin/Boolean.not|()"]; + 18 [label="Exit block"]; + } + 19 [label="Exit when branch result"]; + subgraph cluster_7 { + color=blue + 20 [label="Enter when branch condition else"]; + 21 [label="Exit when branch condition"]; + } + subgraph cluster_8 { + color=blue + 22 [label="Enter block"]; + 23 [label="Exit block"]; + } + 24 [label="Exit when branch result"]; + 25 [label="Exit when"]; + } + 26 [label="Access variable R|/x|"]; + 27 [label="Function call: R|/x|.R|kotlin/Boolean.not|()"]; + 28 [label="Exit block"]; + } + 29 [label="Exit function test_2" style="filled" fillcolor=red]; + } 8 -> {9}; 9 -> {10}; @@ -65,81 +91,139 @@ subgraph cluster_test_2 { 26 -> {27}; 27 -> {28}; 28 -> {29}; -} -subgraph cluster_test_3 { - 30 [shape=box label="Enter function test_3" style="filled"]; - 31 [shape=box label="Enter block"]; - 32 [shape=box label="Enter when"]; - 33 [shape=box label="Enter when branch condition "]; - 34 [shape=box label="Enter &&"]; - 35 [shape=box label="Access variable R|/b|"]; - 36 [shape=box label="Exit left part of &&"]; - 37 [shape=box label="Access variable R|/x|"]; - 38 [shape=box label="Type operator: x as Boolean"]; - 39 [shape=box label="Exit &&"]; - 40 [shape=box label="Exit when branch condition"]; - 41 [shape=box label="Enter block"]; - 42 [shape=box label="Access variable R|/x|"]; - 43 [shape=box label="Function call: R|/x|.R|kotlin/Boolean.not|()"]; - 44 [shape=box label="Exit block"]; - 45 [shape=box label="Exit when branch result"]; - 46 [shape=box label="Enter when branch condition else"]; - 47 [shape=box label="Exit when branch condition"]; - 48 [shape=box label="Enter block"]; - 49 [shape=box label="Exit block"]; - 50 [shape=box label="Exit when branch result"]; - 51 [shape=box label="Exit when"]; - 52 [shape=box label="Access variable R|/x|"]; - 53 [shape=box label="Function call: R|/x|.#()"]; - 54 [shape=box label="Enter when"]; - 55 [shape=box label="Enter when branch condition "]; - 56 [shape=box label="Enter &&"]; - 57 [shape=box label="Access variable R|/b|"]; - 58 [shape=box label="Exit left part of &&"]; - 59 [shape=box label="Access variable R|/x|"]; - 60 [shape=box label="Type operator: x as Boolean"]; - 61 [shape=box label="Const: Boolean(true)"]; - 62 [shape=box label="Operator =="]; - 63 [shape=box label="Exit &&"]; - 64 [shape=box label="Exit when branch condition"]; - 65 [shape=box label="Enter block"]; - 66 [shape=box label="Access variable R|/x|"]; - 67 [shape=box label="Function call: R|/x|.R|kotlin/Boolean.not|()"]; - 68 [shape=box label="Exit block"]; - 69 [shape=box label="Exit when branch result"]; - 70 [shape=box label="Enter when branch condition else"]; - 71 [shape=box label="Exit when branch condition"]; - 72 [shape=box label="Enter block"]; - 73 [shape=box label="Exit block"]; - 74 [shape=box label="Exit when branch result"]; - 75 [shape=box label="Exit when"]; - 76 [shape=box label="Access variable R|/x|"]; - 77 [shape=box label="Function call: R|/x|.#()"]; - 78 [shape=box label="Enter when"]; - 79 [shape=box label="Enter when branch condition "]; - 80 [shape=box label="Enter ||"]; - 81 [shape=box label="Access variable R|/b|"]; - 82 [shape=box label="Exit left part of ||"]; - 83 [shape=box label="Access variable R|/x|"]; - 84 [shape=box label="Type operator: x as Boolean"]; - 85 [shape=box label="Exit ||"]; - 86 [shape=box label="Exit when branch condition"]; - 87 [shape=box label="Enter block"]; - 88 [shape=box label="Access variable R|/x|"]; - 89 [shape=box label="Function call: R|/x|.#()"]; - 90 [shape=box label="Exit block"]; - 91 [shape=box label="Exit when branch result"]; - 92 [shape=box label="Enter when branch condition else"]; - 93 [shape=box label="Exit when branch condition"]; - 94 [shape=box label="Enter block"]; - 95 [shape=box label="Exit block"]; - 96 [shape=box label="Exit when branch result"]; - 97 [shape=box label="Exit when"]; - 98 [shape=box label="Access variable R|/x|"]; - 99 [shape=box label="Function call: R|/x|.#()"]; - 100 [shape=box label="Exit block"]; - 101 [shape=box label="Exit function test_3" style="filled"]; + subgraph cluster_9 { + color=red + 30 [label="Enter function test_3" style="filled" fillcolor=red]; + subgraph cluster_10 { + color=blue + 31 [label="Enter block"]; + subgraph cluster_11 { + color=blue + 32 [label="Enter when"]; + subgraph cluster_12 { + color=blue + 33 [label="Enter when branch condition "]; + subgraph cluster_13 { + color=blue + 34 [label="Enter &&"]; + 35 [label="Access variable R|/b|"]; + 36 [label="Exit left part of &&"]; + 37 [label="Access variable R|/x|"]; + 38 [label="Type operator: x as Boolean"]; + 39 [label="Exit &&"]; + } + 40 [label="Exit when branch condition"]; + } + subgraph cluster_14 { + color=blue + 41 [label="Enter block"]; + 42 [label="Access variable R|/x|"]; + 43 [label="Function call: R|/x|.R|kotlin/Boolean.not|()"]; + 44 [label="Exit block"]; + } + 45 [label="Exit when branch result"]; + subgraph cluster_15 { + color=blue + 46 [label="Enter when branch condition else"]; + 47 [label="Exit when branch condition"]; + } + subgraph cluster_16 { + color=blue + 48 [label="Enter block"]; + 49 [label="Exit block"]; + } + 50 [label="Exit when branch result"]; + 51 [label="Exit when"]; + } + 52 [label="Access variable R|/x|"]; + 53 [label="Function call: R|/x|.#()"]; + subgraph cluster_17 { + color=blue + 54 [label="Enter when"]; + subgraph cluster_18 { + color=blue + 55 [label="Enter when branch condition "]; + subgraph cluster_19 { + color=blue + 56 [label="Enter &&"]; + 57 [label="Access variable R|/b|"]; + 58 [label="Exit left part of &&"]; + 59 [label="Access variable R|/x|"]; + 60 [label="Type operator: x as Boolean"]; + 61 [label="Const: Boolean(true)"]; + 62 [label="Operator =="]; + 63 [label="Exit &&"]; + } + 64 [label="Exit when branch condition"]; + } + subgraph cluster_20 { + color=blue + 65 [label="Enter block"]; + 66 [label="Access variable R|/x|"]; + 67 [label="Function call: R|/x|.R|kotlin/Boolean.not|()"]; + 68 [label="Exit block"]; + } + 69 [label="Exit when branch result"]; + subgraph cluster_21 { + color=blue + 70 [label="Enter when branch condition else"]; + 71 [label="Exit when branch condition"]; + } + subgraph cluster_22 { + color=blue + 72 [label="Enter block"]; + 73 [label="Exit block"]; + } + 74 [label="Exit when branch result"]; + 75 [label="Exit when"]; + } + 76 [label="Access variable R|/x|"]; + 77 [label="Function call: R|/x|.#()"]; + subgraph cluster_23 { + color=blue + 78 [label="Enter when"]; + subgraph cluster_24 { + color=blue + 79 [label="Enter when branch condition "]; + subgraph cluster_25 { + color=blue + 80 [label="Enter ||"]; + 81 [label="Access variable R|/b|"]; + 82 [label="Exit left part of ||"]; + 83 [label="Access variable R|/x|"]; + 84 [label="Type operator: x as Boolean"]; + 85 [label="Exit ||"]; + } + 86 [label="Exit when branch condition"]; + } + subgraph cluster_26 { + color=blue + 87 [label="Enter block"]; + 88 [label="Access variable R|/x|"]; + 89 [label="Function call: R|/x|.#()"]; + 90 [label="Exit block"]; + } + 91 [label="Exit when branch result"]; + subgraph cluster_27 { + color=blue + 92 [label="Enter when branch condition else"]; + 93 [label="Exit when branch condition"]; + } + subgraph cluster_28 { + color=blue + 94 [label="Enter block"]; + 95 [label="Exit block"]; + } + 96 [label="Exit when branch result"]; + 97 [label="Exit when"]; + } + 98 [label="Access variable R|/x|"]; + 99 [label="Function call: R|/x|.#()"]; + 100 [label="Exit block"]; + } + 101 [label="Exit function test_3" style="filled" fillcolor=red]; + } 30 -> {31}; 31 -> {32}; @@ -212,57 +296,91 @@ subgraph cluster_test_3 { 98 -> {99}; 99 -> {100}; 100 -> {101}; -} -subgraph cluster_test_4 { - 102 [shape=box label="Enter function test_4" style="filled"]; - 103 [shape=box label="Enter block"]; - 104 [shape=box label="Enter when"]; - 105 [shape=box label="Enter when branch condition "]; - 106 [shape=box label="Access variable R|/b|"]; - 107 [shape=box label="Type operator: b as? Boolean"]; - 108 [shape=box label="Const: Null(null)"]; - 109 [shape=box label="Operator !="]; - 110 [shape=box label="Exit when branch condition"]; - 111 [shape=box label="Enter block"]; - 112 [shape=box label="Access variable R|/b|"]; - 113 [shape=box label="Function call: R|/b|.R|kotlin/Boolean.not|()"]; - 114 [shape=box label="Exit block"]; - 115 [shape=box label="Exit when branch result"]; - 116 [shape=box label="Enter when branch condition else"]; - 117 [shape=box label="Exit when branch condition"]; - 118 [shape=box label="Enter block"]; - 119 [shape=box label="Access variable R|/b|"]; - 120 [shape=box label="Function call: R|/b|.#()"]; - 121 [shape=box label="Exit block"]; - 122 [shape=box label="Exit when branch result"]; - 123 [shape=box label="Exit when"]; - 124 [shape=box label="Access variable R|/b|"]; - 125 [shape=box label="Function call: R|/b|.#()"]; - 126 [shape=box label="Enter when"]; - 127 [shape=box label="Enter when branch condition "]; - 128 [shape=box label="Access variable R|/b|"]; - 129 [shape=box label="Type operator: b as? Boolean"]; - 130 [shape=box label="Const: Null(null)"]; - 131 [shape=box label="Operator =="]; - 132 [shape=box label="Exit when branch condition"]; - 133 [shape=box label="Enter block"]; - 134 [shape=box label="Access variable R|/b|"]; - 135 [shape=box label="Function call: R|/b|.#()"]; - 136 [shape=box label="Exit block"]; - 137 [shape=box label="Exit when branch result"]; - 138 [shape=box label="Enter when branch condition else"]; - 139 [shape=box label="Exit when branch condition"]; - 140 [shape=box label="Enter block"]; - 141 [shape=box label="Access variable R|/b|"]; - 142 [shape=box label="Function call: R|/b|.R|kotlin/Boolean.not|()"]; - 143 [shape=box label="Exit block"]; - 144 [shape=box label="Exit when branch result"]; - 145 [shape=box label="Exit when"]; - 146 [shape=box label="Access variable R|/b|"]; - 147 [shape=box label="Function call: R|/b|.#()"]; - 148 [shape=box label="Exit block"]; - 149 [shape=box label="Exit function test_4" style="filled"]; + subgraph cluster_29 { + color=red + 102 [label="Enter function test_4" style="filled" fillcolor=red]; + subgraph cluster_30 { + color=blue + 103 [label="Enter block"]; + subgraph cluster_31 { + color=blue + 104 [label="Enter when"]; + subgraph cluster_32 { + color=blue + 105 [label="Enter when branch condition "]; + 106 [label="Access variable R|/b|"]; + 107 [label="Type operator: b as? Boolean"]; + 108 [label="Const: Null(null)"]; + 109 [label="Operator !="]; + 110 [label="Exit when branch condition"]; + } + subgraph cluster_33 { + color=blue + 111 [label="Enter block"]; + 112 [label="Access variable R|/b|"]; + 113 [label="Function call: R|/b|.R|kotlin/Boolean.not|()"]; + 114 [label="Exit block"]; + } + 115 [label="Exit when branch result"]; + subgraph cluster_34 { + color=blue + 116 [label="Enter when branch condition else"]; + 117 [label="Exit when branch condition"]; + } + subgraph cluster_35 { + color=blue + 118 [label="Enter block"]; + 119 [label="Access variable R|/b|"]; + 120 [label="Function call: R|/b|.#()"]; + 121 [label="Exit block"]; + } + 122 [label="Exit when branch result"]; + 123 [label="Exit when"]; + } + 124 [label="Access variable R|/b|"]; + 125 [label="Function call: R|/b|.#()"]; + subgraph cluster_36 { + color=blue + 126 [label="Enter when"]; + subgraph cluster_37 { + color=blue + 127 [label="Enter when branch condition "]; + 128 [label="Access variable R|/b|"]; + 129 [label="Type operator: b as? Boolean"]; + 130 [label="Const: Null(null)"]; + 131 [label="Operator =="]; + 132 [label="Exit when branch condition"]; + } + subgraph cluster_38 { + color=blue + 133 [label="Enter block"]; + 134 [label="Access variable R|/b|"]; + 135 [label="Function call: R|/b|.#()"]; + 136 [label="Exit block"]; + } + 137 [label="Exit when branch result"]; + subgraph cluster_39 { + color=blue + 138 [label="Enter when branch condition else"]; + 139 [label="Exit when branch condition"]; + } + subgraph cluster_40 { + color=blue + 140 [label="Enter block"]; + 141 [label="Access variable R|/b|"]; + 142 [label="Function call: R|/b|.R|kotlin/Boolean.not|()"]; + 143 [label="Exit block"]; + } + 144 [label="Exit when branch result"]; + 145 [label="Exit when"]; + } + 146 [label="Access variable R|/b|"]; + 147 [label="Function call: R|/b|.#()"]; + 148 [label="Exit block"]; + } + 149 [label="Exit function test_4" style="filled" fillcolor=red]; + } 102 -> {103}; 103 -> {104}; @@ -311,6 +429,5 @@ subgraph cluster_test_4 { 146 -> {147}; 147 -> {148}; 148 -> {149}; -} } diff --git a/compiler/fir/resolve/testData/resolve/smartcasts/elvis.dot b/compiler/fir/resolve/testData/resolve/smartcasts/elvis.dot index 4774965e069..bca0d298c6b 100644 --- a/compiler/fir/resolve/testData/resolve/smartcasts/elvis.dot +++ b/compiler/fir/resolve/testData/resolve/smartcasts/elvis.dot @@ -1,59 +1,98 @@ digraph elvis_kt { -graph [splines=ortho, nodesep=3] + graph [splines=ortho nodesep=3] + node [shape=box penwidth=2] + edge [penwidth=2] -subgraph cluster_foo { - 0 [shape=box label="Enter function foo" style="filled"]; - 1 [shape=box label="Exit function foo" style="filled"]; + subgraph cluster_0 { + color=red + 0 [label="Enter function foo" style="filled" fillcolor=red]; + 1 [label="Exit function foo" style="filled" fillcolor=red]; + } 0 -> {1}; -} -subgraph cluster_val_b { - 2 [shape=box label="Enter property" style="filled"]; - 3 [shape=box label="Exit property" style="filled"]; + subgraph cluster_1 { + color=red + 2 [label="Enter property" style="filled" fillcolor=red]; + 3 [label="Exit property" style="filled" fillcolor=red]; + } 2 -> {3}; -} -subgraph cluster_test_1 { - 4 [shape=box label="Enter function test_1" style="filled"]; - 5 [shape=box label="Enter block"]; - 6 [shape=box label="Enter when"]; - 7 [shape=box label="Enter when branch condition "]; - 8 [shape=box label="Enter when"]; - 9 [shape=box label="Access variable R|/x|"]; - 10 [shape=box label="Access variable R|/A.b|"]; - 11 [shape=box label="Variable declaration: lval : R|kotlin/Boolean?|"]; - 12 [shape=box label="Enter when branch condition "]; - 13 [shape=box label="Const: Null(null)"]; - 14 [shape=box label="Operator =="]; - 15 [shape=box label="Exit when branch condition"]; - 16 [shape=box label="Enter block"]; - 17 [shape=box label="Jump: ^test_1 Unit"]; - 18 [shape=box label="Stub[DEAD]"]; - 19 [shape=box label="Exit block[DEAD]"]; - 20 [shape=box label="Exit when branch result[DEAD]"]; - 21 [shape=box label="Enter when branch condition else"]; - 22 [shape=box label="Exit when branch condition"]; - 23 [shape=box label="Enter block"]; - 24 [shape=box label="Access variable R|/|"]; - 25 [shape=box label="Exit block"]; - 26 [shape=box label="Exit when branch result"]; - 27 [shape=box label="Exit when"]; - 28 [shape=box label="Exit when branch condition"]; - 29 [shape=box label="Enter block"]; - 30 [shape=box label="Access variable R|/x|"]; - 31 [shape=box label="Function call: R|/x|.R|/A.foo|()"]; - 32 [shape=box label="Exit block"]; - 33 [shape=box label="Exit when branch result"]; - 34 [shape=box label="Enter when branch condition else"]; - 35 [shape=box label="Exit when branch condition"]; - 36 [shape=box label="Enter block"]; - 37 [shape=box label="Exit block"]; - 38 [shape=box label="Exit when branch result"]; - 39 [shape=box label="Exit when"]; - 40 [shape=box label="Exit block"]; - 41 [shape=box label="Exit function test_1" style="filled"]; + subgraph cluster_2 { + color=red + 4 [label="Enter function test_1" style="filled" fillcolor=red]; + subgraph cluster_3 { + color=blue + 5 [label="Enter block"]; + subgraph cluster_4 { + color=blue + 6 [label="Enter when"]; + subgraph cluster_5 { + color=blue + 7 [label="Enter when branch condition "]; + subgraph cluster_6 { + color=blue + 8 [label="Enter when"]; + 9 [label="Access variable R|/x|"]; + 10 [label="Access variable R|/A.b|"]; + 11 [label="Variable declaration: lval : R|kotlin/Boolean?|"]; + subgraph cluster_7 { + color=blue + 12 [label="Enter when branch condition "]; + 13 [label="Const: Null(null)"]; + 14 [label="Operator =="]; + 15 [label="Exit when branch condition"]; + } + subgraph cluster_8 { + color=blue + 16 [label="Enter block"]; + 17 [label="Jump: ^test_1 Unit"]; + 18 [label="Stub" style="filled" fillcolor=gray]; + 19 [label="Exit block" style="filled" fillcolor=gray]; + } + 20 [label="Exit when branch result" style="filled" fillcolor=gray]; + subgraph cluster_9 { + color=blue + 21 [label="Enter when branch condition else"]; + 22 [label="Exit when branch condition"]; + } + subgraph cluster_10 { + color=blue + 23 [label="Enter block"]; + 24 [label="Access variable R|/|"]; + 25 [label="Exit block"]; + } + 26 [label="Exit when branch result"]; + 27 [label="Exit when"]; + } + 28 [label="Exit when branch condition"]; + } + subgraph cluster_11 { + color=blue + 29 [label="Enter block"]; + 30 [label="Access variable R|/x|"]; + 31 [label="Function call: R|/x|.R|/A.foo|()"]; + 32 [label="Exit block"]; + } + 33 [label="Exit when branch result"]; + subgraph cluster_12 { + color=blue + 34 [label="Enter when branch condition else"]; + 35 [label="Exit when branch condition"]; + } + subgraph cluster_13 { + color=blue + 36 [label="Enter block"]; + 37 [label="Exit block"]; + } + 38 [label="Exit when branch result"]; + 39 [label="Exit when"]; + } + 40 [label="Exit block"]; + } + 41 [label="Exit function test_1" style="filled" fillcolor=red]; + } 4 -> {5}; 5 -> {6}; @@ -93,6 +132,5 @@ subgraph cluster_test_1 { 38 -> {39}; 39 -> {40}; 40 -> {41}; -} } diff --git a/compiler/fir/resolve/testData/resolve/smartcasts/endlessLoops.dot b/compiler/fir/resolve/testData/resolve/smartcasts/endlessLoops.dot index 5e3aeed17dc..4b65f552b0f 100644 --- a/compiler/fir/resolve/testData/resolve/smartcasts/endlessLoops.dot +++ b/compiler/fir/resolve/testData/resolve/smartcasts/endlessLoops.dot @@ -1,47 +1,82 @@ digraph endlessLoops_kt { -graph [splines=ortho, nodesep=3] + graph [splines=ortho nodesep=3] + node [shape=box penwidth=2] + edge [penwidth=2] -subgraph cluster_foo { - 0 [shape=box label="Enter function foo" style="filled"]; - 1 [shape=box label="Exit function foo" style="filled"]; + subgraph cluster_0 { + color=red + 0 [label="Enter function foo" style="filled" fillcolor=red]; + 1 [label="Exit function foo" style="filled" fillcolor=red]; + } 0 -> {1}; -} -subgraph cluster_test_1 { - 2 [shape=box label="Enter function test_1" style="filled"]; - 3 [shape=box label="Enter block"]; - 4 [shape=box label="Enter while loop"]; - 5 [shape=box label="Enter loop condition"]; - 6 [shape=box label="Const: Boolean(true)"]; - 7 [shape=box label="Exit loop condition"]; - 8 [shape=box label="Enter loop block"]; - 9 [shape=box label="Enter block"]; - 10 [shape=box label="Access variable R|/x|"]; - 11 [shape=box label="Type operator: x as A"]; - 12 [shape=box label="Enter when"]; - 13 [shape=box label="Enter when branch condition "]; - 14 [shape=box label="Access variable R|/b|"]; - 15 [shape=box label="Exit when branch condition"]; - 16 [shape=box label="Enter block"]; - 17 [shape=box label="Jump: break@@@[Boolean(true)] "]; - 18 [shape=box label="Stub[DEAD]"]; - 19 [shape=box label="Exit block[DEAD]"]; - 20 [shape=box label="Exit when branch result[DEAD]"]; - 21 [shape=box label="Enter when branch condition else"]; - 22 [shape=box label="Exit when branch condition"]; - 23 [shape=box label="Enter block"]; - 24 [shape=box label="Exit block"]; - 25 [shape=box label="Exit when branch result"]; - 26 [shape=box label="Exit when"]; - 27 [shape=box label="Exit block"]; - 28 [shape=box label="Exit loop block"]; - 29 [shape=box label="Stub[DEAD]"]; - 30 [shape=box label="Exit whileloop"]; - 31 [shape=box label="Access variable R|/x|"]; - 32 [shape=box label="Function call: R|/x|.R|/A.foo|()"]; - 33 [shape=box label="Exit block"]; - 34 [shape=box label="Exit function test_1" style="filled"]; + subgraph cluster_1 { + color=red + 2 [label="Enter function test_1" style="filled" fillcolor=red]; + subgraph cluster_2 { + color=blue + 3 [label="Enter block"]; + subgraph cluster_3 { + color=blue + 4 [label="Enter while loop"]; + subgraph cluster_4 { + color=blue + 5 [label="Enter loop condition"]; + 6 [label="Const: Boolean(true)"]; + 7 [label="Exit loop condition"]; + } + subgraph cluster_5 { + color=blue + 8 [label="Enter loop block"]; + subgraph cluster_6 { + color=blue + 9 [label="Enter block"]; + 10 [label="Access variable R|/x|"]; + 11 [label="Type operator: x as A"]; + subgraph cluster_7 { + color=blue + 12 [label="Enter when"]; + subgraph cluster_8 { + color=blue + 13 [label="Enter when branch condition "]; + 14 [label="Access variable R|/b|"]; + 15 [label="Exit when branch condition"]; + } + subgraph cluster_9 { + color=blue + 16 [label="Enter block"]; + 17 [label="Jump: break@@@[Boolean(true)] "]; + 18 [label="Stub" style="filled" fillcolor=gray]; + 19 [label="Exit block" style="filled" fillcolor=gray]; + } + 20 [label="Exit when branch result" style="filled" fillcolor=gray]; + subgraph cluster_10 { + color=blue + 21 [label="Enter when branch condition else"]; + 22 [label="Exit when branch condition"]; + } + subgraph cluster_11 { + color=blue + 23 [label="Enter block"]; + 24 [label="Exit block"]; + } + 25 [label="Exit when branch result"]; + 26 [label="Exit when"]; + } + 27 [label="Exit block"]; + } + 28 [label="Exit loop block"]; + } + 29 [label="Stub" style="filled" fillcolor=gray]; + 30 [label="Exit whileloop"]; + } + 31 [label="Access variable R|/x|"]; + 32 [label="Function call: R|/x|.R|/A.foo|()"]; + 33 [label="Exit block"]; + } + 34 [label="Exit function test_1" style="filled" fillcolor=red]; + } 2 -> {3}; 3 -> {4}; @@ -77,42 +112,73 @@ subgraph cluster_test_1 { 31 -> {32}; 32 -> {33}; 33 -> {34}; -} -subgraph cluster_test_2 { - 35 [shape=box label="Enter function test_2" style="filled"]; - 36 [shape=box label="Enter block"]; - 37 [shape=box label="Enter while loop"]; - 38 [shape=box label="Enter loop condition"]; - 39 [shape=box label="Const: Boolean(true)"]; - 40 [shape=box label="Exit loop condition"]; - 41 [shape=box label="Enter loop block"]; - 42 [shape=box label="Enter block"]; - 43 [shape=box label="Enter when"]; - 44 [shape=box label="Enter when branch condition "]; - 45 [shape=box label="Access variable R|/b|"]; - 46 [shape=box label="Exit when branch condition"]; - 47 [shape=box label="Enter block"]; - 48 [shape=box label="Access variable R|/x|"]; - 49 [shape=box label="Type operator: x as A"]; - 50 [shape=box label="Jump: break@@@[Boolean(true)] "]; - 51 [shape=box label="Stub[DEAD]"]; - 52 [shape=box label="Exit block[DEAD]"]; - 53 [shape=box label="Exit when branch result[DEAD]"]; - 54 [shape=box label="Enter when branch condition else"]; - 55 [shape=box label="Exit when branch condition"]; - 56 [shape=box label="Enter block"]; - 57 [shape=box label="Exit block"]; - 58 [shape=box label="Exit when branch result"]; - 59 [shape=box label="Exit when"]; - 60 [shape=box label="Exit block"]; - 61 [shape=box label="Exit loop block"]; - 62 [shape=box label="Stub[DEAD]"]; - 63 [shape=box label="Exit whileloop"]; - 64 [shape=box label="Access variable R|/x|"]; - 65 [shape=box label="Function call: R|/x|.R|/A.foo|()"]; - 66 [shape=box label="Exit block"]; - 67 [shape=box label="Exit function test_2" style="filled"]; + subgraph cluster_12 { + color=red + 35 [label="Enter function test_2" style="filled" fillcolor=red]; + subgraph cluster_13 { + color=blue + 36 [label="Enter block"]; + subgraph cluster_14 { + color=blue + 37 [label="Enter while loop"]; + subgraph cluster_15 { + color=blue + 38 [label="Enter loop condition"]; + 39 [label="Const: Boolean(true)"]; + 40 [label="Exit loop condition"]; + } + subgraph cluster_16 { + color=blue + 41 [label="Enter loop block"]; + subgraph cluster_17 { + color=blue + 42 [label="Enter block"]; + subgraph cluster_18 { + color=blue + 43 [label="Enter when"]; + subgraph cluster_19 { + color=blue + 44 [label="Enter when branch condition "]; + 45 [label="Access variable R|/b|"]; + 46 [label="Exit when branch condition"]; + } + subgraph cluster_20 { + color=blue + 47 [label="Enter block"]; + 48 [label="Access variable R|/x|"]; + 49 [label="Type operator: x as A"]; + 50 [label="Jump: break@@@[Boolean(true)] "]; + 51 [label="Stub" style="filled" fillcolor=gray]; + 52 [label="Exit block" style="filled" fillcolor=gray]; + } + 53 [label="Exit when branch result" style="filled" fillcolor=gray]; + subgraph cluster_21 { + color=blue + 54 [label="Enter when branch condition else"]; + 55 [label="Exit when branch condition"]; + } + subgraph cluster_22 { + color=blue + 56 [label="Enter block"]; + 57 [label="Exit block"]; + } + 58 [label="Exit when branch result"]; + 59 [label="Exit when"]; + } + 60 [label="Exit block"]; + } + 61 [label="Exit loop block"]; + } + 62 [label="Stub" style="filled" fillcolor=gray]; + 63 [label="Exit whileloop"]; + } + 64 [label="Access variable R|/x|"]; + 65 [label="Function call: R|/x|.R|/A.foo|()"]; + 66 [label="Exit block"]; + } + 67 [label="Exit function test_2" style="filled" fillcolor=red]; + } 35 -> {36}; 36 -> {37}; @@ -148,57 +214,103 @@ subgraph cluster_test_2 { 64 -> {65}; 65 -> {66}; 66 -> {67}; -} -subgraph cluster_test_3 { - 68 [shape=box label="Enter function test_3" style="filled"]; - 69 [shape=box label="Enter block"]; - 70 [shape=box label="Enter while loop"]; - 71 [shape=box label="Enter loop condition"]; - 72 [shape=box label="Const: Boolean(true)"]; - 73 [shape=box label="Exit loop condition"]; - 74 [shape=box label="Enter loop block"]; - 75 [shape=box label="Enter block"]; - 76 [shape=box label="Access variable R|/x|"]; - 77 [shape=box label="Type operator: x as A"]; - 78 [shape=box label="Enter when"]; - 79 [shape=box label="Enter when branch condition "]; - 80 [shape=box label="Access variable R|/b|"]; - 81 [shape=box label="Exit when branch condition"]; - 82 [shape=box label="Enter block"]; - 83 [shape=box label="Jump: break@@@[Boolean(true)] "]; - 84 [shape=box label="Stub[DEAD]"]; - 85 [shape=box label="Exit block[DEAD]"]; - 86 [shape=box label="Exit when branch result[DEAD]"]; - 87 [shape=box label="Enter when branch condition else"]; - 88 [shape=box label="Exit when branch condition"]; - 89 [shape=box label="Enter block"]; - 90 [shape=box label="Exit block"]; - 91 [shape=box label="Exit when branch result"]; - 92 [shape=box label="Exit when"]; - 93 [shape=box label="Enter when"]; - 94 [shape=box label="Enter when branch condition "]; - 95 [shape=box label="Access variable R|/b|"]; - 96 [shape=box label="Exit when branch condition"]; - 97 [shape=box label="Enter block"]; - 98 [shape=box label="Jump: break@@@[Boolean(true)] "]; - 99 [shape=box label="Stub[DEAD]"]; - 100 [shape=box label="Exit block[DEAD]"]; - 101 [shape=box label="Exit when branch result[DEAD]"]; - 102 [shape=box label="Enter when branch condition else"]; - 103 [shape=box label="Exit when branch condition"]; - 104 [shape=box label="Enter block"]; - 105 [shape=box label="Exit block"]; - 106 [shape=box label="Exit when branch result"]; - 107 [shape=box label="Exit when"]; - 108 [shape=box label="Exit block"]; - 109 [shape=box label="Exit loop block"]; - 110 [shape=box label="Stub[DEAD]"]; - 111 [shape=box label="Exit whileloop"]; - 112 [shape=box label="Access variable R|/x|"]; - 113 [shape=box label="Function call: R|/x|.R|/A.foo|()"]; - 114 [shape=box label="Exit block"]; - 115 [shape=box label="Exit function test_3" style="filled"]; + subgraph cluster_23 { + color=red + 68 [label="Enter function test_3" style="filled" fillcolor=red]; + subgraph cluster_24 { + color=blue + 69 [label="Enter block"]; + subgraph cluster_25 { + color=blue + 70 [label="Enter while loop"]; + subgraph cluster_26 { + color=blue + 71 [label="Enter loop condition"]; + 72 [label="Const: Boolean(true)"]; + 73 [label="Exit loop condition"]; + } + subgraph cluster_27 { + color=blue + 74 [label="Enter loop block"]; + subgraph cluster_28 { + color=blue + 75 [label="Enter block"]; + 76 [label="Access variable R|/x|"]; + 77 [label="Type operator: x as A"]; + subgraph cluster_29 { + color=blue + 78 [label="Enter when"]; + subgraph cluster_30 { + color=blue + 79 [label="Enter when branch condition "]; + 80 [label="Access variable R|/b|"]; + 81 [label="Exit when branch condition"]; + } + subgraph cluster_31 { + color=blue + 82 [label="Enter block"]; + 83 [label="Jump: break@@@[Boolean(true)] "]; + 84 [label="Stub" style="filled" fillcolor=gray]; + 85 [label="Exit block" style="filled" fillcolor=gray]; + } + 86 [label="Exit when branch result" style="filled" fillcolor=gray]; + subgraph cluster_32 { + color=blue + 87 [label="Enter when branch condition else"]; + 88 [label="Exit when branch condition"]; + } + subgraph cluster_33 { + color=blue + 89 [label="Enter block"]; + 90 [label="Exit block"]; + } + 91 [label="Exit when branch result"]; + 92 [label="Exit when"]; + } + subgraph cluster_34 { + color=blue + 93 [label="Enter when"]; + subgraph cluster_35 { + color=blue + 94 [label="Enter when branch condition "]; + 95 [label="Access variable R|/b|"]; + 96 [label="Exit when branch condition"]; + } + subgraph cluster_36 { + color=blue + 97 [label="Enter block"]; + 98 [label="Jump: break@@@[Boolean(true)] "]; + 99 [label="Stub" style="filled" fillcolor=gray]; + 100 [label="Exit block" style="filled" fillcolor=gray]; + } + 101 [label="Exit when branch result" style="filled" fillcolor=gray]; + subgraph cluster_37 { + color=blue + 102 [label="Enter when branch condition else"]; + 103 [label="Exit when branch condition"]; + } + subgraph cluster_38 { + color=blue + 104 [label="Enter block"]; + 105 [label="Exit block"]; + } + 106 [label="Exit when branch result"]; + 107 [label="Exit when"]; + } + 108 [label="Exit block"]; + } + 109 [label="Exit loop block"]; + } + 110 [label="Stub" style="filled" fillcolor=gray]; + 111 [label="Exit whileloop"]; + } + 112 [label="Access variable R|/x|"]; + 113 [label="Function call: R|/x|.R|/A.foo|()"]; + 114 [label="Exit block"]; + } + 115 [label="Exit function test_3" style="filled" fillcolor=red]; + } 68 -> {69}; 69 -> {70}; @@ -250,44 +362,75 @@ subgraph cluster_test_3 { 112 -> {113}; 113 -> {114}; 114 -> {115}; -} -subgraph cluster_test_4 { - 116 [shape=box label="Enter function test_4" style="filled"]; - 117 [shape=box label="Enter block"]; - 118 [shape=box label="Enter while loop"]; - 119 [shape=box label="Enter loop condition"]; - 120 [shape=box label="Const: Boolean(true)"]; - 121 [shape=box label="Exit loop condition"]; - 122 [shape=box label="Enter loop block"]; - 123 [shape=box label="Enter block"]; - 124 [shape=box label="Enter when"]; - 125 [shape=box label="Enter when branch condition "]; - 126 [shape=box label="Access variable R|/b|"]; - 127 [shape=box label="Exit when branch condition"]; - 128 [shape=box label="Enter block"]; - 129 [shape=box label="Access variable R|/x|"]; - 130 [shape=box label="Type operator: x as A"]; - 131 [shape=box label="Jump: break@@@[Boolean(true)] "]; - 132 [shape=box label="Stub[DEAD]"]; - 133 [shape=box label="Exit block[DEAD]"]; - 134 [shape=box label="Exit when branch result[DEAD]"]; - 135 [shape=box label="Enter when branch condition else"]; - 136 [shape=box label="Exit when branch condition"]; - 137 [shape=box label="Enter block"]; - 138 [shape=box label="Exit block"]; - 139 [shape=box label="Exit when branch result"]; - 140 [shape=box label="Exit when"]; - 141 [shape=box label="Jump: break@@@[Boolean(true)] "]; - 142 [shape=box label="Stub[DEAD]"]; - 143 [shape=box label="Exit block[DEAD]"]; - 144 [shape=box label="Exit loop block[DEAD]"]; - 145 [shape=box label="Stub[DEAD]"]; - 146 [shape=box label="Exit whileloop"]; - 147 [shape=box label="Access variable R|/x|"]; - 148 [shape=box label="Function call: R|/x|.#()"]; - 149 [shape=box label="Exit block"]; - 150 [shape=box label="Exit function test_4" style="filled"]; + subgraph cluster_39 { + color=red + 116 [label="Enter function test_4" style="filled" fillcolor=red]; + subgraph cluster_40 { + color=blue + 117 [label="Enter block"]; + subgraph cluster_41 { + color=blue + 118 [label="Enter while loop"]; + subgraph cluster_42 { + color=blue + 119 [label="Enter loop condition"]; + 120 [label="Const: Boolean(true)"]; + 121 [label="Exit loop condition"]; + } + subgraph cluster_43 { + color=blue + 122 [label="Enter loop block"]; + subgraph cluster_44 { + color=blue + 123 [label="Enter block"]; + subgraph cluster_45 { + color=blue + 124 [label="Enter when"]; + subgraph cluster_46 { + color=blue + 125 [label="Enter when branch condition "]; + 126 [label="Access variable R|/b|"]; + 127 [label="Exit when branch condition"]; + } + subgraph cluster_47 { + color=blue + 128 [label="Enter block"]; + 129 [label="Access variable R|/x|"]; + 130 [label="Type operator: x as A"]; + 131 [label="Jump: break@@@[Boolean(true)] "]; + 132 [label="Stub" style="filled" fillcolor=gray]; + 133 [label="Exit block" style="filled" fillcolor=gray]; + } + 134 [label="Exit when branch result" style="filled" fillcolor=gray]; + subgraph cluster_48 { + color=blue + 135 [label="Enter when branch condition else"]; + 136 [label="Exit when branch condition"]; + } + subgraph cluster_49 { + color=blue + 137 [label="Enter block"]; + 138 [label="Exit block"]; + } + 139 [label="Exit when branch result"]; + 140 [label="Exit when"]; + } + 141 [label="Jump: break@@@[Boolean(true)] "]; + 142 [label="Stub" style="filled" fillcolor=gray]; + 143 [label="Exit block" style="filled" fillcolor=gray]; + } + 144 [label="Exit loop block" style="filled" fillcolor=gray]; + } + 145 [label="Stub" style="filled" fillcolor=gray]; + 146 [label="Exit whileloop"]; + } + 147 [label="Access variable R|/x|"]; + 148 [label="Function call: R|/x|.#()"]; + 149 [label="Exit block"]; + } + 150 [label="Exit function test_4" style="filled" fillcolor=red]; + } 116 -> {117}; 117 -> {118}; @@ -326,42 +469,73 @@ subgraph cluster_test_4 { 147 -> {148}; 148 -> {149}; 149 -> {150}; -} -subgraph cluster_test_5 { - 151 [shape=box label="Enter function test_5" style="filled"]; - 152 [shape=box label="Enter block"]; - 153 [shape=box label="Enter do-while loop"]; - 154 [shape=box label="Enter loop block"]; - 155 [shape=box label="Enter block"]; - 156 [shape=box label="Enter when"]; - 157 [shape=box label="Enter when branch condition "]; - 158 [shape=box label="Access variable R|/b|"]; - 159 [shape=box label="Exit when branch condition"]; - 160 [shape=box label="Enter block"]; - 161 [shape=box label="Access variable R|/x|"]; - 162 [shape=box label="Type operator: x as A"]; - 163 [shape=box label="Jump: break@@@[Boolean(true)] "]; - 164 [shape=box label="Stub[DEAD]"]; - 165 [shape=box label="Exit block[DEAD]"]; - 166 [shape=box label="Exit when branch result[DEAD]"]; - 167 [shape=box label="Enter when branch condition else"]; - 168 [shape=box label="Exit when branch condition"]; - 169 [shape=box label="Enter block"]; - 170 [shape=box label="Exit block"]; - 171 [shape=box label="Exit when branch result"]; - 172 [shape=box label="Exit when"]; - 173 [shape=box label="Exit block"]; - 174 [shape=box label="Exit loop block"]; - 175 [shape=box label="Enter loop condition"]; - 176 [shape=box label="Const: Boolean(true)"]; - 177 [shape=box label="Exit loop condition"]; - 178 [shape=box label="Stub[DEAD]"]; - 179 [shape=box label="Exit do-whileloop"]; - 180 [shape=box label="Access variable R|/x|"]; - 181 [shape=box label="Function call: R|/x|.R|/A.foo|()"]; - 182 [shape=box label="Exit block"]; - 183 [shape=box label="Exit function test_5" style="filled"]; + subgraph cluster_50 { + color=red + 151 [label="Enter function test_5" style="filled" fillcolor=red]; + subgraph cluster_51 { + color=blue + 152 [label="Enter block"]; + subgraph cluster_52 { + color=blue + 153 [label="Enter do-while loop"]; + subgraph cluster_53 { + color=blue + 154 [label="Enter loop block"]; + subgraph cluster_54 { + color=blue + 155 [label="Enter block"]; + subgraph cluster_55 { + color=blue + 156 [label="Enter when"]; + subgraph cluster_56 { + color=blue + 157 [label="Enter when branch condition "]; + 158 [label="Access variable R|/b|"]; + 159 [label="Exit when branch condition"]; + } + subgraph cluster_57 { + color=blue + 160 [label="Enter block"]; + 161 [label="Access variable R|/x|"]; + 162 [label="Type operator: x as A"]; + 163 [label="Jump: break@@@[Boolean(true)] "]; + 164 [label="Stub" style="filled" fillcolor=gray]; + 165 [label="Exit block" style="filled" fillcolor=gray]; + } + 166 [label="Exit when branch result" style="filled" fillcolor=gray]; + subgraph cluster_58 { + color=blue + 167 [label="Enter when branch condition else"]; + 168 [label="Exit when branch condition"]; + } + subgraph cluster_59 { + color=blue + 169 [label="Enter block"]; + 170 [label="Exit block"]; + } + 171 [label="Exit when branch result"]; + 172 [label="Exit when"]; + } + 173 [label="Exit block"]; + } + 174 [label="Exit loop block"]; + } + subgraph cluster_60 { + color=blue + 175 [label="Enter loop condition"]; + 176 [label="Const: Boolean(true)"]; + 177 [label="Exit loop condition"]; + } + 178 [label="Stub" style="filled" fillcolor=gray]; + 179 [label="Exit do-whileloop"]; + } + 180 [label="Access variable R|/x|"]; + 181 [label="Function call: R|/x|.R|/A.foo|()"]; + 182 [label="Exit block"]; + } + 183 [label="Exit function test_5" style="filled" fillcolor=red]; + } 151 -> {152}; 152 -> {153}; @@ -397,42 +571,73 @@ subgraph cluster_test_5 { 180 -> {181}; 181 -> {182}; 182 -> {183}; -} -subgraph cluster_test_6 { - 184 [shape=box label="Enter function test_6" style="filled"]; - 185 [shape=box label="Enter block"]; - 186 [shape=box label="Enter do-while loop"]; - 187 [shape=box label="Enter loop block"]; - 188 [shape=box label="Enter block"]; - 189 [shape=box label="Access variable R|/x|"]; - 190 [shape=box label="Type operator: x as A"]; - 191 [shape=box label="Enter when"]; - 192 [shape=box label="Enter when branch condition "]; - 193 [shape=box label="Access variable R|/b|"]; - 194 [shape=box label="Exit when branch condition"]; - 195 [shape=box label="Enter block"]; - 196 [shape=box label="Jump: break@@@[Boolean(true)] "]; - 197 [shape=box label="Stub[DEAD]"]; - 198 [shape=box label="Exit block[DEAD]"]; - 199 [shape=box label="Exit when branch result[DEAD]"]; - 200 [shape=box label="Enter when branch condition else"]; - 201 [shape=box label="Exit when branch condition"]; - 202 [shape=box label="Enter block"]; - 203 [shape=box label="Exit block"]; - 204 [shape=box label="Exit when branch result"]; - 205 [shape=box label="Exit when"]; - 206 [shape=box label="Exit block"]; - 207 [shape=box label="Exit loop block"]; - 208 [shape=box label="Enter loop condition"]; - 209 [shape=box label="Const: Boolean(true)"]; - 210 [shape=box label="Exit loop condition"]; - 211 [shape=box label="Stub[DEAD]"]; - 212 [shape=box label="Exit do-whileloop"]; - 213 [shape=box label="Access variable R|/x|"]; - 214 [shape=box label="Function call: R|/x|.R|/A.foo|()"]; - 215 [shape=box label="Exit block"]; - 216 [shape=box label="Exit function test_6" style="filled"]; + subgraph cluster_61 { + color=red + 184 [label="Enter function test_6" style="filled" fillcolor=red]; + subgraph cluster_62 { + color=blue + 185 [label="Enter block"]; + subgraph cluster_63 { + color=blue + 186 [label="Enter do-while loop"]; + subgraph cluster_64 { + color=blue + 187 [label="Enter loop block"]; + subgraph cluster_65 { + color=blue + 188 [label="Enter block"]; + 189 [label="Access variable R|/x|"]; + 190 [label="Type operator: x as A"]; + subgraph cluster_66 { + color=blue + 191 [label="Enter when"]; + subgraph cluster_67 { + color=blue + 192 [label="Enter when branch condition "]; + 193 [label="Access variable R|/b|"]; + 194 [label="Exit when branch condition"]; + } + subgraph cluster_68 { + color=blue + 195 [label="Enter block"]; + 196 [label="Jump: break@@@[Boolean(true)] "]; + 197 [label="Stub" style="filled" fillcolor=gray]; + 198 [label="Exit block" style="filled" fillcolor=gray]; + } + 199 [label="Exit when branch result" style="filled" fillcolor=gray]; + subgraph cluster_69 { + color=blue + 200 [label="Enter when branch condition else"]; + 201 [label="Exit when branch condition"]; + } + subgraph cluster_70 { + color=blue + 202 [label="Enter block"]; + 203 [label="Exit block"]; + } + 204 [label="Exit when branch result"]; + 205 [label="Exit when"]; + } + 206 [label="Exit block"]; + } + 207 [label="Exit loop block"]; + } + subgraph cluster_71 { + color=blue + 208 [label="Enter loop condition"]; + 209 [label="Const: Boolean(true)"]; + 210 [label="Exit loop condition"]; + } + 211 [label="Stub" style="filled" fillcolor=gray]; + 212 [label="Exit do-whileloop"]; + } + 213 [label="Access variable R|/x|"]; + 214 [label="Function call: R|/x|.R|/A.foo|()"]; + 215 [label="Exit block"]; + } + 216 [label="Exit function test_6" style="filled" fillcolor=red]; + } 184 -> {185}; 185 -> {186}; @@ -468,27 +673,43 @@ subgraph cluster_test_6 { 213 -> {214}; 214 -> {215}; 215 -> {216}; -} -subgraph cluster_test_7 { - 217 [shape=box label="Enter function test_7" style="filled"]; - 218 [shape=box label="Enter block"]; - 219 [shape=box label="Enter do-while loop"]; - 220 [shape=box label="Enter loop block"]; - 221 [shape=box label="Enter block"]; - 222 [shape=box label="Access variable R|/x|"]; - 223 [shape=box label="Type operator: x as A"]; - 224 [shape=box label="Exit block"]; - 225 [shape=box label="Exit loop block"]; - 226 [shape=box label="Enter loop condition"]; - 227 [shape=box label="Const: Boolean(true)"]; - 228 [shape=box label="Exit loop condition"]; - 229 [shape=box label="Stub[DEAD]"]; - 230 [shape=box label="Exit do-whileloop[DEAD]"]; - 231 [shape=box label="Access variable R|/x|[DEAD]"]; - 232 [shape=box label="Function call: R|/x|.#()[DEAD]"]; - 233 [shape=box label="Exit block[DEAD]"]; - 234 [shape=box label="Exit function test_7[DEAD]" style="filled"]; + subgraph cluster_72 { + color=red + 217 [label="Enter function test_7" style="filled" fillcolor=red]; + subgraph cluster_73 { + color=blue + 218 [label="Enter block"]; + subgraph cluster_74 { + color=blue + 219 [label="Enter do-while loop"]; + subgraph cluster_75 { + color=blue + 220 [label="Enter loop block"]; + subgraph cluster_76 { + color=blue + 221 [label="Enter block"]; + 222 [label="Access variable R|/x|"]; + 223 [label="Type operator: x as A"]; + 224 [label="Exit block"]; + } + 225 [label="Exit loop block"]; + } + subgraph cluster_77 { + color=blue + 226 [label="Enter loop condition"]; + 227 [label="Const: Boolean(true)"]; + 228 [label="Exit loop condition"]; + } + 229 [label="Stub" style="filled" fillcolor=gray]; + 230 [label="Exit do-whileloop" style="filled" fillcolor=gray]; + } + 231 [label="Access variable R|/x|" style="filled" fillcolor=gray]; + 232 [label="Function call: R|/x|.#()" style="filled" fillcolor=gray]; + 233 [label="Exit block" style="filled" fillcolor=gray]; + } + 234 [label="Exit function test_7" style="filled" fillcolor=red style="filled" fillcolor=gray]; + } 217 -> {218}; 218 -> {219}; @@ -508,6 +729,5 @@ subgraph cluster_test_7 { 231 -> {232} [style=dotted]; 232 -> {233} [style=dotted]; 233 -> {234} [style=dotted]; -} } diff --git a/compiler/fir/resolve/testData/resolve/smartcasts/equalsAndIdentity.dot b/compiler/fir/resolve/testData/resolve/smartcasts/equalsAndIdentity.dot index 8908f0882ea..24a78d4428c 100644 --- a/compiler/fir/resolve/testData/resolve/smartcasts/equalsAndIdentity.dot +++ b/compiler/fir/resolve/testData/resolve/smartcasts/equalsAndIdentity.dot @@ -1,56 +1,94 @@ digraph equalsAndIdentity_kt { -graph [splines=ortho, nodesep=3] + graph [splines=ortho nodesep=3] + node [shape=box penwidth=2] + edge [penwidth=2] -subgraph cluster_foo { - 0 [shape=box label="Enter function foo" style="filled"]; - 1 [shape=box label="Exit function foo" style="filled"]; + subgraph cluster_0 { + color=red + 0 [label="Enter function foo" style="filled" fillcolor=red]; + 1 [label="Exit function foo" style="filled" fillcolor=red]; + } 0 -> {1}; -} -subgraph cluster_test_1 { - 2 [shape=box label="Enter function test_1" style="filled"]; - 3 [shape=box label="Enter block"]; - 4 [shape=box label="Enter when"]; - 5 [shape=box label="Enter when branch condition "]; - 6 [shape=box label="Access variable R|/x|"]; - 7 [shape=box label="Access variable R|/y|"]; - 8 [shape=box label="Operator =="]; - 9 [shape=box label="Exit when branch condition"]; - 10 [shape=box label="Enter block"]; - 11 [shape=box label="Access variable R|/x|"]; - 12 [shape=box label="Function call: R|/x|.R|/A.foo|()"]; - 13 [shape=box label="Access variable R|/y|"]; - 14 [shape=box label="Function call: R|/y|.R|/A.foo|()"]; - 15 [shape=box label="Exit block"]; - 16 [shape=box label="Exit when branch result"]; - 17 [shape=box label="Enter when branch condition else"]; - 18 [shape=box label="Exit when branch condition"]; - 19 [shape=box label="Enter block"]; - 20 [shape=box label="Exit block"]; - 21 [shape=box label="Exit when branch result"]; - 22 [shape=box label="Exit when"]; - 23 [shape=box label="Enter when"]; - 24 [shape=box label="Enter when branch condition "]; - 25 [shape=box label="Access variable R|/x|"]; - 26 [shape=box label="Access variable R|/y|"]; - 27 [shape=box label="Operator ==="]; - 28 [shape=box label="Exit when branch condition"]; - 29 [shape=box label="Enter block"]; - 30 [shape=box label="Access variable R|/x|"]; - 31 [shape=box label="Function call: R|/x|.R|/A.foo|()"]; - 32 [shape=box label="Access variable R|/y|"]; - 33 [shape=box label="Function call: R|/y|.R|/A.foo|()"]; - 34 [shape=box label="Exit block"]; - 35 [shape=box label="Exit when branch result"]; - 36 [shape=box label="Enter when branch condition else"]; - 37 [shape=box label="Exit when branch condition"]; - 38 [shape=box label="Enter block"]; - 39 [shape=box label="Exit block"]; - 40 [shape=box label="Exit when branch result"]; - 41 [shape=box label="Exit when"]; - 42 [shape=box label="Exit block"]; - 43 [shape=box label="Exit function test_1" style="filled"]; + subgraph cluster_1 { + color=red + 2 [label="Enter function test_1" style="filled" fillcolor=red]; + subgraph cluster_2 { + color=blue + 3 [label="Enter block"]; + subgraph cluster_3 { + color=blue + 4 [label="Enter when"]; + subgraph cluster_4 { + color=blue + 5 [label="Enter when branch condition "]; + 6 [label="Access variable R|/x|"]; + 7 [label="Access variable R|/y|"]; + 8 [label="Operator =="]; + 9 [label="Exit when branch condition"]; + } + subgraph cluster_5 { + color=blue + 10 [label="Enter block"]; + 11 [label="Access variable R|/x|"]; + 12 [label="Function call: R|/x|.R|/A.foo|()"]; + 13 [label="Access variable R|/y|"]; + 14 [label="Function call: R|/y|.R|/A.foo|()"]; + 15 [label="Exit block"]; + } + 16 [label="Exit when branch result"]; + subgraph cluster_6 { + color=blue + 17 [label="Enter when branch condition else"]; + 18 [label="Exit when branch condition"]; + } + subgraph cluster_7 { + color=blue + 19 [label="Enter block"]; + 20 [label="Exit block"]; + } + 21 [label="Exit when branch result"]; + 22 [label="Exit when"]; + } + subgraph cluster_8 { + color=blue + 23 [label="Enter when"]; + subgraph cluster_9 { + color=blue + 24 [label="Enter when branch condition "]; + 25 [label="Access variable R|/x|"]; + 26 [label="Access variable R|/y|"]; + 27 [label="Operator ==="]; + 28 [label="Exit when branch condition"]; + } + subgraph cluster_10 { + color=blue + 29 [label="Enter block"]; + 30 [label="Access variable R|/x|"]; + 31 [label="Function call: R|/x|.R|/A.foo|()"]; + 32 [label="Access variable R|/y|"]; + 33 [label="Function call: R|/y|.R|/A.foo|()"]; + 34 [label="Exit block"]; + } + 35 [label="Exit when branch result"]; + subgraph cluster_11 { + color=blue + 36 [label="Enter when branch condition else"]; + 37 [label="Exit when branch condition"]; + } + subgraph cluster_12 { + color=blue + 38 [label="Enter block"]; + 39 [label="Exit block"]; + } + 40 [label="Exit when branch result"]; + 41 [label="Exit when"]; + } + 42 [label="Exit block"]; + } + 43 [label="Exit function test_1" style="filled" fillcolor=red]; + } 2 -> {3}; 3 -> {4}; @@ -93,51 +131,85 @@ subgraph cluster_test_1 { 40 -> {41}; 41 -> {42}; 42 -> {43}; -} -subgraph cluster_test_2 { - 44 [shape=box label="Enter function test_2" style="filled"]; - 45 [shape=box label="Enter block"]; - 46 [shape=box label="Enter when"]; - 47 [shape=box label="Enter when branch condition "]; - 48 [shape=box label="Access variable R|/x|"]; - 49 [shape=box label="Access variable R|/y|"]; - 50 [shape=box label="Operator =="]; - 51 [shape=box label="Exit when branch condition"]; - 52 [shape=box label="Enter block"]; - 53 [shape=box label="Access variable R|/x|"]; - 54 [shape=box label="Function call: R|/x|.#()"]; - 55 [shape=box label="Access variable R|/y|"]; - 56 [shape=box label="Function call: R|/y|.#()"]; - 57 [shape=box label="Exit block"]; - 58 [shape=box label="Exit when branch result"]; - 59 [shape=box label="Enter when branch condition else"]; - 60 [shape=box label="Exit when branch condition"]; - 61 [shape=box label="Enter block"]; - 62 [shape=box label="Exit block"]; - 63 [shape=box label="Exit when branch result"]; - 64 [shape=box label="Exit when"]; - 65 [shape=box label="Enter when"]; - 66 [shape=box label="Enter when branch condition "]; - 67 [shape=box label="Access variable R|/x|"]; - 68 [shape=box label="Access variable R|/y|"]; - 69 [shape=box label="Operator ==="]; - 70 [shape=box label="Exit when branch condition"]; - 71 [shape=box label="Enter block"]; - 72 [shape=box label="Access variable R|/x|"]; - 73 [shape=box label="Function call: R|/x|.#()"]; - 74 [shape=box label="Access variable R|/y|"]; - 75 [shape=box label="Function call: R|/y|.#()"]; - 76 [shape=box label="Exit block"]; - 77 [shape=box label="Exit when branch result"]; - 78 [shape=box label="Enter when branch condition else"]; - 79 [shape=box label="Exit when branch condition"]; - 80 [shape=box label="Enter block"]; - 81 [shape=box label="Exit block"]; - 82 [shape=box label="Exit when branch result"]; - 83 [shape=box label="Exit when"]; - 84 [shape=box label="Exit block"]; - 85 [shape=box label="Exit function test_2" style="filled"]; + subgraph cluster_13 { + color=red + 44 [label="Enter function test_2" style="filled" fillcolor=red]; + subgraph cluster_14 { + color=blue + 45 [label="Enter block"]; + subgraph cluster_15 { + color=blue + 46 [label="Enter when"]; + subgraph cluster_16 { + color=blue + 47 [label="Enter when branch condition "]; + 48 [label="Access variable R|/x|"]; + 49 [label="Access variable R|/y|"]; + 50 [label="Operator =="]; + 51 [label="Exit when branch condition"]; + } + subgraph cluster_17 { + color=blue + 52 [label="Enter block"]; + 53 [label="Access variable R|/x|"]; + 54 [label="Function call: R|/x|.#()"]; + 55 [label="Access variable R|/y|"]; + 56 [label="Function call: R|/y|.#()"]; + 57 [label="Exit block"]; + } + 58 [label="Exit when branch result"]; + subgraph cluster_18 { + color=blue + 59 [label="Enter when branch condition else"]; + 60 [label="Exit when branch condition"]; + } + subgraph cluster_19 { + color=blue + 61 [label="Enter block"]; + 62 [label="Exit block"]; + } + 63 [label="Exit when branch result"]; + 64 [label="Exit when"]; + } + subgraph cluster_20 { + color=blue + 65 [label="Enter when"]; + subgraph cluster_21 { + color=blue + 66 [label="Enter when branch condition "]; + 67 [label="Access variable R|/x|"]; + 68 [label="Access variable R|/y|"]; + 69 [label="Operator ==="]; + 70 [label="Exit when branch condition"]; + } + subgraph cluster_22 { + color=blue + 71 [label="Enter block"]; + 72 [label="Access variable R|/x|"]; + 73 [label="Function call: R|/x|.#()"]; + 74 [label="Access variable R|/y|"]; + 75 [label="Function call: R|/y|.#()"]; + 76 [label="Exit block"]; + } + 77 [label="Exit when branch result"]; + subgraph cluster_23 { + color=blue + 78 [label="Enter when branch condition else"]; + 79 [label="Exit when branch condition"]; + } + subgraph cluster_24 { + color=blue + 80 [label="Enter block"]; + 81 [label="Exit block"]; + } + 82 [label="Exit when branch result"]; + 83 [label="Exit when"]; + } + 84 [label="Exit block"]; + } + 85 [label="Exit function test_2" style="filled" fillcolor=red]; + } 44 -> {45}; 45 -> {46}; @@ -180,68 +252,117 @@ subgraph cluster_test_2 { 82 -> {83}; 83 -> {84}; 84 -> {85}; -} -subgraph cluster_test_3 { - 86 [shape=box label="Enter function test_3" style="filled"]; - 87 [shape=box label="Enter block"]; - 88 [shape=box label="Enter when"]; - 89 [shape=box label="Enter when branch condition "]; - 90 [shape=box label="Access variable R|/y|"]; - 91 [shape=box label="Const: Null(null)"]; - 92 [shape=box label="Operator =="]; - 93 [shape=box label="Exit when branch condition"]; - 94 [shape=box label="Enter block"]; - 95 [shape=box label="Jump: ^test_3 Unit"]; - 96 [shape=box label="Stub[DEAD]"]; - 97 [shape=box label="Exit block[DEAD]"]; - 98 [shape=box label="Exit when branch result[DEAD]"]; - 99 [shape=box label="Enter when branch condition else"]; - 100 [shape=box label="Exit when branch condition"]; - 101 [shape=box label="Enter block"]; - 102 [shape=box label="Exit block"]; - 103 [shape=box label="Exit when branch result"]; - 104 [shape=box label="Exit when"]; - 105 [shape=box label="Enter when"]; - 106 [shape=box label="Enter when branch condition "]; - 107 [shape=box label="Access variable R|/x|"]; - 108 [shape=box label="Access variable R|/y|"]; - 109 [shape=box label="Operator =="]; - 110 [shape=box label="Exit when branch condition"]; - 111 [shape=box label="Enter block"]; - 112 [shape=box label="Access variable R|/x|"]; - 113 [shape=box label="Function call: R|/x|.R|/A.foo|()"]; - 114 [shape=box label="Access variable R|/y|"]; - 115 [shape=box label="Function call: R|/y|.R|/A.foo|()"]; - 116 [shape=box label="Exit block"]; - 117 [shape=box label="Exit when branch result"]; - 118 [shape=box label="Enter when branch condition else"]; - 119 [shape=box label="Exit when branch condition"]; - 120 [shape=box label="Enter block"]; - 121 [shape=box label="Exit block"]; - 122 [shape=box label="Exit when branch result"]; - 123 [shape=box label="Exit when"]; - 124 [shape=box label="Enter when"]; - 125 [shape=box label="Enter when branch condition "]; - 126 [shape=box label="Access variable R|/x|"]; - 127 [shape=box label="Access variable R|/y|"]; - 128 [shape=box label="Operator ==="]; - 129 [shape=box label="Exit when branch condition"]; - 130 [shape=box label="Enter block"]; - 131 [shape=box label="Access variable R|/x|"]; - 132 [shape=box label="Function call: R|/x|.R|/A.foo|()"]; - 133 [shape=box label="Access variable R|/y|"]; - 134 [shape=box label="Function call: R|/y|.R|/A.foo|()"]; - 135 [shape=box label="Exit block"]; - 136 [shape=box label="Exit when branch result"]; - 137 [shape=box label="Enter when branch condition else"]; - 138 [shape=box label="Exit when branch condition"]; - 139 [shape=box label="Enter block"]; - 140 [shape=box label="Exit block"]; - 141 [shape=box label="Exit when branch result"]; - 142 [shape=box label="Exit when"]; - 143 [shape=box label="Exit block"]; - 144 [shape=box label="Exit function test_3" style="filled"]; + subgraph cluster_25 { + color=red + 86 [label="Enter function test_3" style="filled" fillcolor=red]; + subgraph cluster_26 { + color=blue + 87 [label="Enter block"]; + subgraph cluster_27 { + color=blue + 88 [label="Enter when"]; + subgraph cluster_28 { + color=blue + 89 [label="Enter when branch condition "]; + 90 [label="Access variable R|/y|"]; + 91 [label="Const: Null(null)"]; + 92 [label="Operator =="]; + 93 [label="Exit when branch condition"]; + } + subgraph cluster_29 { + color=blue + 94 [label="Enter block"]; + 95 [label="Jump: ^test_3 Unit"]; + 96 [label="Stub" style="filled" fillcolor=gray]; + 97 [label="Exit block" style="filled" fillcolor=gray]; + } + 98 [label="Exit when branch result" style="filled" fillcolor=gray]; + subgraph cluster_30 { + color=blue + 99 [label="Enter when branch condition else"]; + 100 [label="Exit when branch condition"]; + } + subgraph cluster_31 { + color=blue + 101 [label="Enter block"]; + 102 [label="Exit block"]; + } + 103 [label="Exit when branch result"]; + 104 [label="Exit when"]; + } + subgraph cluster_32 { + color=blue + 105 [label="Enter when"]; + subgraph cluster_33 { + color=blue + 106 [label="Enter when branch condition "]; + 107 [label="Access variable R|/x|"]; + 108 [label="Access variable R|/y|"]; + 109 [label="Operator =="]; + 110 [label="Exit when branch condition"]; + } + subgraph cluster_34 { + color=blue + 111 [label="Enter block"]; + 112 [label="Access variable R|/x|"]; + 113 [label="Function call: R|/x|.R|/A.foo|()"]; + 114 [label="Access variable R|/y|"]; + 115 [label="Function call: R|/y|.R|/A.foo|()"]; + 116 [label="Exit block"]; + } + 117 [label="Exit when branch result"]; + subgraph cluster_35 { + color=blue + 118 [label="Enter when branch condition else"]; + 119 [label="Exit when branch condition"]; + } + subgraph cluster_36 { + color=blue + 120 [label="Enter block"]; + 121 [label="Exit block"]; + } + 122 [label="Exit when branch result"]; + 123 [label="Exit when"]; + } + subgraph cluster_37 { + color=blue + 124 [label="Enter when"]; + subgraph cluster_38 { + color=blue + 125 [label="Enter when branch condition "]; + 126 [label="Access variable R|/x|"]; + 127 [label="Access variable R|/y|"]; + 128 [label="Operator ==="]; + 129 [label="Exit when branch condition"]; + } + subgraph cluster_39 { + color=blue + 130 [label="Enter block"]; + 131 [label="Access variable R|/x|"]; + 132 [label="Function call: R|/x|.R|/A.foo|()"]; + 133 [label="Access variable R|/y|"]; + 134 [label="Function call: R|/y|.R|/A.foo|()"]; + 135 [label="Exit block"]; + } + 136 [label="Exit when branch result"]; + subgraph cluster_40 { + color=blue + 137 [label="Enter when branch condition else"]; + 138 [label="Exit when branch condition"]; + } + subgraph cluster_41 { + color=blue + 139 [label="Enter block"]; + 140 [label="Exit block"]; + } + 141 [label="Exit when branch result"]; + 142 [label="Exit when"]; + } + 143 [label="Exit block"]; + } + 144 [label="Exit function test_3" style="filled" fillcolor=red]; + } 86 -> {87}; 87 -> {88}; @@ -302,6 +423,5 @@ subgraph cluster_test_3 { 141 -> {142}; 142 -> {143}; 143 -> {144}; -} } diff --git a/compiler/fir/resolve/testData/resolve/smartcasts/equalsToBoolean.dot b/compiler/fir/resolve/testData/resolve/smartcasts/equalsToBoolean.dot index f0a8fdeace4..330573c4b9e 100644 --- a/compiler/fir/resolve/testData/resolve/smartcasts/equalsToBoolean.dot +++ b/compiler/fir/resolve/testData/resolve/smartcasts/equalsToBoolean.dot @@ -1,46 +1,70 @@ digraph equalsToBoolean_kt { -graph [splines=ortho, nodesep=3] + graph [splines=ortho nodesep=3] + node [shape=box penwidth=2] + edge [penwidth=2] -subgraph cluster_foo { - 0 [shape=box label="Enter function foo" style="filled"]; - 1 [shape=box label="Exit function foo" style="filled"]; + subgraph cluster_0 { + color=red + 0 [label="Enter function foo" style="filled" fillcolor=red]; + 1 [label="Exit function foo" style="filled" fillcolor=red]; + } 0 -> {1}; -} -subgraph cluster_val_b { - 2 [shape=box label="Enter property" style="filled"]; - 3 [shape=box label="Exit property" style="filled"]; + subgraph cluster_1 { + color=red + 2 [label="Enter property" style="filled" fillcolor=red]; + 3 [label="Exit property" style="filled" fillcolor=red]; + } 2 -> {3}; -} -subgraph cluster_test_1 { - 4 [shape=box label="Enter function test_1" style="filled"]; - 5 [shape=box label="Enter block"]; - 6 [shape=box label="Enter when"]; - 7 [shape=box label="Enter when branch condition "]; - 8 [shape=box label="Access variable R|/b|"]; - 9 [shape=box label="Const: Boolean(true)"]; - 10 [shape=box label="Operator =="]; - 11 [shape=box label="Const: Boolean(true)"]; - 12 [shape=box label="Operator =="]; - 13 [shape=box label="Exit when branch condition"]; - 14 [shape=box label="Enter block"]; - 15 [shape=box label="Access variable R|/b|"]; - 16 [shape=box label="Function call: R|/b|.R|kotlin/Boolean.not|()"]; - 17 [shape=box label="Exit block"]; - 18 [shape=box label="Exit when branch result"]; - 19 [shape=box label="Enter when branch condition else"]; - 20 [shape=box label="Exit when branch condition"]; - 21 [shape=box label="Enter block"]; - 22 [shape=box label="Access variable R|/b|"]; - 23 [shape=box label="Function call: R|/b|.#()"]; - 24 [shape=box label="Exit block"]; - 25 [shape=box label="Exit when branch result"]; - 26 [shape=box label="Exit when"]; - 27 [shape=box label="Exit block"]; - 28 [shape=box label="Exit function test_1" style="filled"]; + subgraph cluster_2 { + color=red + 4 [label="Enter function test_1" style="filled" fillcolor=red]; + subgraph cluster_3 { + color=blue + 5 [label="Enter block"]; + subgraph cluster_4 { + color=blue + 6 [label="Enter when"]; + subgraph cluster_5 { + color=blue + 7 [label="Enter when branch condition "]; + 8 [label="Access variable R|/b|"]; + 9 [label="Const: Boolean(true)"]; + 10 [label="Operator =="]; + 11 [label="Const: Boolean(true)"]; + 12 [label="Operator =="]; + 13 [label="Exit when branch condition"]; + } + subgraph cluster_6 { + color=blue + 14 [label="Enter block"]; + 15 [label="Access variable R|/b|"]; + 16 [label="Function call: R|/b|.R|kotlin/Boolean.not|()"]; + 17 [label="Exit block"]; + } + 18 [label="Exit when branch result"]; + subgraph cluster_7 { + color=blue + 19 [label="Enter when branch condition else"]; + 20 [label="Exit when branch condition"]; + } + subgraph cluster_8 { + color=blue + 21 [label="Enter block"]; + 22 [label="Access variable R|/b|"]; + 23 [label="Function call: R|/b|.#()"]; + 24 [label="Exit block"]; + } + 25 [label="Exit when branch result"]; + 26 [label="Exit when"]; + } + 27 [label="Exit block"]; + } + 28 [label="Exit function test_1" style="filled" fillcolor=red]; + } 4 -> {5}; 5 -> {6}; @@ -66,34 +90,53 @@ subgraph cluster_test_1 { 25 -> {26}; 26 -> {27}; 27 -> {28}; -} -subgraph cluster_test_2 { - 29 [shape=box label="Enter function test_2" style="filled"]; - 30 [shape=box label="Enter block"]; - 31 [shape=box label="Enter when"]; - 32 [shape=box label="Enter when branch condition "]; - 33 [shape=box label="Access variable R|/b|"]; - 34 [shape=box label="Const: Boolean(true)"]; - 35 [shape=box label="Operator =="]; - 36 [shape=box label="Const: Boolean(true)"]; - 37 [shape=box label="Operator !="]; - 38 [shape=box label="Exit when branch condition"]; - 39 [shape=box label="Enter block"]; - 40 [shape=box label="Access variable R|/b|"]; - 41 [shape=box label="Function call: R|/b|.#()"]; - 42 [shape=box label="Exit block"]; - 43 [shape=box label="Exit when branch result"]; - 44 [shape=box label="Enter when branch condition else"]; - 45 [shape=box label="Exit when branch condition"]; - 46 [shape=box label="Enter block"]; - 47 [shape=box label="Access variable R|/b|"]; - 48 [shape=box label="Function call: R|/b|.R|kotlin/Boolean.not|()"]; - 49 [shape=box label="Exit block"]; - 50 [shape=box label="Exit when branch result"]; - 51 [shape=box label="Exit when"]; - 52 [shape=box label="Exit block"]; - 53 [shape=box label="Exit function test_2" style="filled"]; + subgraph cluster_9 { + color=red + 29 [label="Enter function test_2" style="filled" fillcolor=red]; + subgraph cluster_10 { + color=blue + 30 [label="Enter block"]; + subgraph cluster_11 { + color=blue + 31 [label="Enter when"]; + subgraph cluster_12 { + color=blue + 32 [label="Enter when branch condition "]; + 33 [label="Access variable R|/b|"]; + 34 [label="Const: Boolean(true)"]; + 35 [label="Operator =="]; + 36 [label="Const: Boolean(true)"]; + 37 [label="Operator !="]; + 38 [label="Exit when branch condition"]; + } + subgraph cluster_13 { + color=blue + 39 [label="Enter block"]; + 40 [label="Access variable R|/b|"]; + 41 [label="Function call: R|/b|.#()"]; + 42 [label="Exit block"]; + } + 43 [label="Exit when branch result"]; + subgraph cluster_14 { + color=blue + 44 [label="Enter when branch condition else"]; + 45 [label="Exit when branch condition"]; + } + subgraph cluster_15 { + color=blue + 46 [label="Enter block"]; + 47 [label="Access variable R|/b|"]; + 48 [label="Function call: R|/b|.R|kotlin/Boolean.not|()"]; + 49 [label="Exit block"]; + } + 50 [label="Exit when branch result"]; + 51 [label="Exit when"]; + } + 52 [label="Exit block"]; + } + 53 [label="Exit function test_2" style="filled" fillcolor=red]; + } 29 -> {30}; 30 -> {31}; @@ -119,34 +162,53 @@ subgraph cluster_test_2 { 50 -> {51}; 51 -> {52}; 52 -> {53}; -} -subgraph cluster_test_3 { - 54 [shape=box label="Enter function test_3" style="filled"]; - 55 [shape=box label="Enter block"]; - 56 [shape=box label="Enter when"]; - 57 [shape=box label="Enter when branch condition "]; - 58 [shape=box label="Access variable R|/b|"]; - 59 [shape=box label="Const: Boolean(true)"]; - 60 [shape=box label="Operator =="]; - 61 [shape=box label="Const: Boolean(false)"]; - 62 [shape=box label="Operator =="]; - 63 [shape=box label="Exit when branch condition"]; - 64 [shape=box label="Enter block"]; - 65 [shape=box label="Access variable R|/b|"]; - 66 [shape=box label="Function call: R|/b|.#()"]; - 67 [shape=box label="Exit block"]; - 68 [shape=box label="Exit when branch result"]; - 69 [shape=box label="Enter when branch condition else"]; - 70 [shape=box label="Exit when branch condition"]; - 71 [shape=box label="Enter block"]; - 72 [shape=box label="Access variable R|/b|"]; - 73 [shape=box label="Function call: R|/b|.R|kotlin/Boolean.not|()"]; - 74 [shape=box label="Exit block"]; - 75 [shape=box label="Exit when branch result"]; - 76 [shape=box label="Exit when"]; - 77 [shape=box label="Exit block"]; - 78 [shape=box label="Exit function test_3" style="filled"]; + subgraph cluster_16 { + color=red + 54 [label="Enter function test_3" style="filled" fillcolor=red]; + subgraph cluster_17 { + color=blue + 55 [label="Enter block"]; + subgraph cluster_18 { + color=blue + 56 [label="Enter when"]; + subgraph cluster_19 { + color=blue + 57 [label="Enter when branch condition "]; + 58 [label="Access variable R|/b|"]; + 59 [label="Const: Boolean(true)"]; + 60 [label="Operator =="]; + 61 [label="Const: Boolean(false)"]; + 62 [label="Operator =="]; + 63 [label="Exit when branch condition"]; + } + subgraph cluster_20 { + color=blue + 64 [label="Enter block"]; + 65 [label="Access variable R|/b|"]; + 66 [label="Function call: R|/b|.#()"]; + 67 [label="Exit block"]; + } + 68 [label="Exit when branch result"]; + subgraph cluster_21 { + color=blue + 69 [label="Enter when branch condition else"]; + 70 [label="Exit when branch condition"]; + } + subgraph cluster_22 { + color=blue + 71 [label="Enter block"]; + 72 [label="Access variable R|/b|"]; + 73 [label="Function call: R|/b|.R|kotlin/Boolean.not|()"]; + 74 [label="Exit block"]; + } + 75 [label="Exit when branch result"]; + 76 [label="Exit when"]; + } + 77 [label="Exit block"]; + } + 78 [label="Exit function test_3" style="filled" fillcolor=red]; + } 54 -> {55}; 55 -> {56}; @@ -172,34 +234,53 @@ subgraph cluster_test_3 { 75 -> {76}; 76 -> {77}; 77 -> {78}; -} -subgraph cluster_test_4 { - 79 [shape=box label="Enter function test_4" style="filled"]; - 80 [shape=box label="Enter block"]; - 81 [shape=box label="Enter when"]; - 82 [shape=box label="Enter when branch condition "]; - 83 [shape=box label="Access variable R|/b|"]; - 84 [shape=box label="Const: Boolean(true)"]; - 85 [shape=box label="Operator =="]; - 86 [shape=box label="Const: Boolean(false)"]; - 87 [shape=box label="Operator !="]; - 88 [shape=box label="Exit when branch condition"]; - 89 [shape=box label="Enter block"]; - 90 [shape=box label="Access variable R|/b|"]; - 91 [shape=box label="Function call: R|/b|.R|kotlin/Boolean.not|()"]; - 92 [shape=box label="Exit block"]; - 93 [shape=box label="Exit when branch result"]; - 94 [shape=box label="Enter when branch condition else"]; - 95 [shape=box label="Exit when branch condition"]; - 96 [shape=box label="Enter block"]; - 97 [shape=box label="Access variable R|/b|"]; - 98 [shape=box label="Function call: R|/b|.#()"]; - 99 [shape=box label="Exit block"]; - 100 [shape=box label="Exit when branch result"]; - 101 [shape=box label="Exit when"]; - 102 [shape=box label="Exit block"]; - 103 [shape=box label="Exit function test_4" style="filled"]; + subgraph cluster_23 { + color=red + 79 [label="Enter function test_4" style="filled" fillcolor=red]; + subgraph cluster_24 { + color=blue + 80 [label="Enter block"]; + subgraph cluster_25 { + color=blue + 81 [label="Enter when"]; + subgraph cluster_26 { + color=blue + 82 [label="Enter when branch condition "]; + 83 [label="Access variable R|/b|"]; + 84 [label="Const: Boolean(true)"]; + 85 [label="Operator =="]; + 86 [label="Const: Boolean(false)"]; + 87 [label="Operator !="]; + 88 [label="Exit when branch condition"]; + } + subgraph cluster_27 { + color=blue + 89 [label="Enter block"]; + 90 [label="Access variable R|/b|"]; + 91 [label="Function call: R|/b|.R|kotlin/Boolean.not|()"]; + 92 [label="Exit block"]; + } + 93 [label="Exit when branch result"]; + subgraph cluster_28 { + color=blue + 94 [label="Enter when branch condition else"]; + 95 [label="Exit when branch condition"]; + } + subgraph cluster_29 { + color=blue + 96 [label="Enter block"]; + 97 [label="Access variable R|/b|"]; + 98 [label="Function call: R|/b|.#()"]; + 99 [label="Exit block"]; + } + 100 [label="Exit when branch result"]; + 101 [label="Exit when"]; + } + 102 [label="Exit block"]; + } + 103 [label="Exit function test_4" style="filled" fillcolor=red]; + } 79 -> {80}; 80 -> {81}; @@ -225,34 +306,53 @@ subgraph cluster_test_4 { 100 -> {101}; 101 -> {102}; 102 -> {103}; -} -subgraph cluster_test_5 { - 104 [shape=box label="Enter function test_5" style="filled"]; - 105 [shape=box label="Enter block"]; - 106 [shape=box label="Enter when"]; - 107 [shape=box label="Enter when branch condition "]; - 108 [shape=box label="Access variable R|/b|"]; - 109 [shape=box label="Const: Boolean(true)"]; - 110 [shape=box label="Operator !="]; - 111 [shape=box label="Const: Boolean(true)"]; - 112 [shape=box label="Operator =="]; - 113 [shape=box label="Exit when branch condition"]; - 114 [shape=box label="Enter block"]; - 115 [shape=box label="Access variable R|/b|"]; - 116 [shape=box label="Function call: R|/b|.#()"]; - 117 [shape=box label="Exit block"]; - 118 [shape=box label="Exit when branch result"]; - 119 [shape=box label="Enter when branch condition else"]; - 120 [shape=box label="Exit when branch condition"]; - 121 [shape=box label="Enter block"]; - 122 [shape=box label="Access variable R|/b|"]; - 123 [shape=box label="Function call: R|/b|.R|kotlin/Boolean.not|()"]; - 124 [shape=box label="Exit block"]; - 125 [shape=box label="Exit when branch result"]; - 126 [shape=box label="Exit when"]; - 127 [shape=box label="Exit block"]; - 128 [shape=box label="Exit function test_5" style="filled"]; + subgraph cluster_30 { + color=red + 104 [label="Enter function test_5" style="filled" fillcolor=red]; + subgraph cluster_31 { + color=blue + 105 [label="Enter block"]; + subgraph cluster_32 { + color=blue + 106 [label="Enter when"]; + subgraph cluster_33 { + color=blue + 107 [label="Enter when branch condition "]; + 108 [label="Access variable R|/b|"]; + 109 [label="Const: Boolean(true)"]; + 110 [label="Operator !="]; + 111 [label="Const: Boolean(true)"]; + 112 [label="Operator =="]; + 113 [label="Exit when branch condition"]; + } + subgraph cluster_34 { + color=blue + 114 [label="Enter block"]; + 115 [label="Access variable R|/b|"]; + 116 [label="Function call: R|/b|.#()"]; + 117 [label="Exit block"]; + } + 118 [label="Exit when branch result"]; + subgraph cluster_35 { + color=blue + 119 [label="Enter when branch condition else"]; + 120 [label="Exit when branch condition"]; + } + subgraph cluster_36 { + color=blue + 121 [label="Enter block"]; + 122 [label="Access variable R|/b|"]; + 123 [label="Function call: R|/b|.R|kotlin/Boolean.not|()"]; + 124 [label="Exit block"]; + } + 125 [label="Exit when branch result"]; + 126 [label="Exit when"]; + } + 127 [label="Exit block"]; + } + 128 [label="Exit function test_5" style="filled" fillcolor=red]; + } 104 -> {105}; 105 -> {106}; @@ -278,34 +378,53 @@ subgraph cluster_test_5 { 125 -> {126}; 126 -> {127}; 127 -> {128}; -} -subgraph cluster_test_6 { - 129 [shape=box label="Enter function test_6" style="filled"]; - 130 [shape=box label="Enter block"]; - 131 [shape=box label="Enter when"]; - 132 [shape=box label="Enter when branch condition "]; - 133 [shape=box label="Access variable R|/b|"]; - 134 [shape=box label="Const: Boolean(true)"]; - 135 [shape=box label="Operator !="]; - 136 [shape=box label="Const: Boolean(true)"]; - 137 [shape=box label="Operator !="]; - 138 [shape=box label="Exit when branch condition"]; - 139 [shape=box label="Enter block"]; - 140 [shape=box label="Access variable R|/b|"]; - 141 [shape=box label="Function call: R|/b|.R|kotlin/Boolean.not|()"]; - 142 [shape=box label="Exit block"]; - 143 [shape=box label="Exit when branch result"]; - 144 [shape=box label="Enter when branch condition else"]; - 145 [shape=box label="Exit when branch condition"]; - 146 [shape=box label="Enter block"]; - 147 [shape=box label="Access variable R|/b|"]; - 148 [shape=box label="Function call: R|/b|.#()"]; - 149 [shape=box label="Exit block"]; - 150 [shape=box label="Exit when branch result"]; - 151 [shape=box label="Exit when"]; - 152 [shape=box label="Exit block"]; - 153 [shape=box label="Exit function test_6" style="filled"]; + subgraph cluster_37 { + color=red + 129 [label="Enter function test_6" style="filled" fillcolor=red]; + subgraph cluster_38 { + color=blue + 130 [label="Enter block"]; + subgraph cluster_39 { + color=blue + 131 [label="Enter when"]; + subgraph cluster_40 { + color=blue + 132 [label="Enter when branch condition "]; + 133 [label="Access variable R|/b|"]; + 134 [label="Const: Boolean(true)"]; + 135 [label="Operator !="]; + 136 [label="Const: Boolean(true)"]; + 137 [label="Operator !="]; + 138 [label="Exit when branch condition"]; + } + subgraph cluster_41 { + color=blue + 139 [label="Enter block"]; + 140 [label="Access variable R|/b|"]; + 141 [label="Function call: R|/b|.R|kotlin/Boolean.not|()"]; + 142 [label="Exit block"]; + } + 143 [label="Exit when branch result"]; + subgraph cluster_42 { + color=blue + 144 [label="Enter when branch condition else"]; + 145 [label="Exit when branch condition"]; + } + subgraph cluster_43 { + color=blue + 146 [label="Enter block"]; + 147 [label="Access variable R|/b|"]; + 148 [label="Function call: R|/b|.#()"]; + 149 [label="Exit block"]; + } + 150 [label="Exit when branch result"]; + 151 [label="Exit when"]; + } + 152 [label="Exit block"]; + } + 153 [label="Exit function test_6" style="filled" fillcolor=red]; + } 129 -> {130}; 130 -> {131}; @@ -331,34 +450,53 @@ subgraph cluster_test_6 { 150 -> {151}; 151 -> {152}; 152 -> {153}; -} -subgraph cluster_test_7 { - 154 [shape=box label="Enter function test_7" style="filled"]; - 155 [shape=box label="Enter block"]; - 156 [shape=box label="Enter when"]; - 157 [shape=box label="Enter when branch condition "]; - 158 [shape=box label="Access variable R|/b|"]; - 159 [shape=box label="Const: Boolean(true)"]; - 160 [shape=box label="Operator !="]; - 161 [shape=box label="Const: Boolean(false)"]; - 162 [shape=box label="Operator =="]; - 163 [shape=box label="Exit when branch condition"]; - 164 [shape=box label="Enter block"]; - 165 [shape=box label="Access variable R|/b|"]; - 166 [shape=box label="Function call: R|/b|.R|kotlin/Boolean.not|()"]; - 167 [shape=box label="Exit block"]; - 168 [shape=box label="Exit when branch result"]; - 169 [shape=box label="Enter when branch condition else"]; - 170 [shape=box label="Exit when branch condition"]; - 171 [shape=box label="Enter block"]; - 172 [shape=box label="Access variable R|/b|"]; - 173 [shape=box label="Function call: R|/b|.#()"]; - 174 [shape=box label="Exit block"]; - 175 [shape=box label="Exit when branch result"]; - 176 [shape=box label="Exit when"]; - 177 [shape=box label="Exit block"]; - 178 [shape=box label="Exit function test_7" style="filled"]; + subgraph cluster_44 { + color=red + 154 [label="Enter function test_7" style="filled" fillcolor=red]; + subgraph cluster_45 { + color=blue + 155 [label="Enter block"]; + subgraph cluster_46 { + color=blue + 156 [label="Enter when"]; + subgraph cluster_47 { + color=blue + 157 [label="Enter when branch condition "]; + 158 [label="Access variable R|/b|"]; + 159 [label="Const: Boolean(true)"]; + 160 [label="Operator !="]; + 161 [label="Const: Boolean(false)"]; + 162 [label="Operator =="]; + 163 [label="Exit when branch condition"]; + } + subgraph cluster_48 { + color=blue + 164 [label="Enter block"]; + 165 [label="Access variable R|/b|"]; + 166 [label="Function call: R|/b|.R|kotlin/Boolean.not|()"]; + 167 [label="Exit block"]; + } + 168 [label="Exit when branch result"]; + subgraph cluster_49 { + color=blue + 169 [label="Enter when branch condition else"]; + 170 [label="Exit when branch condition"]; + } + subgraph cluster_50 { + color=blue + 171 [label="Enter block"]; + 172 [label="Access variable R|/b|"]; + 173 [label="Function call: R|/b|.#()"]; + 174 [label="Exit block"]; + } + 175 [label="Exit when branch result"]; + 176 [label="Exit when"]; + } + 177 [label="Exit block"]; + } + 178 [label="Exit function test_7" style="filled" fillcolor=red]; + } 154 -> {155}; 155 -> {156}; @@ -384,34 +522,53 @@ subgraph cluster_test_7 { 175 -> {176}; 176 -> {177}; 177 -> {178}; -} -subgraph cluster_test_8 { - 179 [shape=box label="Enter function test_8" style="filled"]; - 180 [shape=box label="Enter block"]; - 181 [shape=box label="Enter when"]; - 182 [shape=box label="Enter when branch condition "]; - 183 [shape=box label="Access variable R|/b|"]; - 184 [shape=box label="Const: Boolean(true)"]; - 185 [shape=box label="Operator !="]; - 186 [shape=box label="Const: Boolean(false)"]; - 187 [shape=box label="Operator !="]; - 188 [shape=box label="Exit when branch condition"]; - 189 [shape=box label="Enter block"]; - 190 [shape=box label="Access variable R|/b|"]; - 191 [shape=box label="Function call: R|/b|.#()"]; - 192 [shape=box label="Exit block"]; - 193 [shape=box label="Exit when branch result"]; - 194 [shape=box label="Enter when branch condition else"]; - 195 [shape=box label="Exit when branch condition"]; - 196 [shape=box label="Enter block"]; - 197 [shape=box label="Access variable R|/b|"]; - 198 [shape=box label="Function call: R|/b|.R|kotlin/Boolean.not|()"]; - 199 [shape=box label="Exit block"]; - 200 [shape=box label="Exit when branch result"]; - 201 [shape=box label="Exit when"]; - 202 [shape=box label="Exit block"]; - 203 [shape=box label="Exit function test_8" style="filled"]; + subgraph cluster_51 { + color=red + 179 [label="Enter function test_8" style="filled" fillcolor=red]; + subgraph cluster_52 { + color=blue + 180 [label="Enter block"]; + subgraph cluster_53 { + color=blue + 181 [label="Enter when"]; + subgraph cluster_54 { + color=blue + 182 [label="Enter when branch condition "]; + 183 [label="Access variable R|/b|"]; + 184 [label="Const: Boolean(true)"]; + 185 [label="Operator !="]; + 186 [label="Const: Boolean(false)"]; + 187 [label="Operator !="]; + 188 [label="Exit when branch condition"]; + } + subgraph cluster_55 { + color=blue + 189 [label="Enter block"]; + 190 [label="Access variable R|/b|"]; + 191 [label="Function call: R|/b|.#()"]; + 192 [label="Exit block"]; + } + 193 [label="Exit when branch result"]; + subgraph cluster_56 { + color=blue + 194 [label="Enter when branch condition else"]; + 195 [label="Exit when branch condition"]; + } + subgraph cluster_57 { + color=blue + 196 [label="Enter block"]; + 197 [label="Access variable R|/b|"]; + 198 [label="Function call: R|/b|.R|kotlin/Boolean.not|()"]; + 199 [label="Exit block"]; + } + 200 [label="Exit when branch result"]; + 201 [label="Exit when"]; + } + 202 [label="Exit block"]; + } + 203 [label="Exit function test_8" style="filled" fillcolor=red]; + } 179 -> {180}; 180 -> {181}; @@ -437,6 +594,5 @@ subgraph cluster_test_8 { 200 -> {201}; 201 -> {202}; 202 -> {203}; -} } diff --git a/compiler/fir/resolve/testData/resolve/smartcasts/inPlaceLambdas.dot b/compiler/fir/resolve/testData/resolve/smartcasts/inPlaceLambdas.dot index 1f9bc6c25ef..053b059a17a 100644 --- a/compiler/fir/resolve/testData/resolve/smartcasts/inPlaceLambdas.dot +++ b/compiler/fir/resolve/testData/resolve/smartcasts/inPlaceLambdas.dot @@ -1,62 +1,96 @@ digraph inPlaceLambdas_kt { -graph [splines=ortho, nodesep=3] + graph [splines=ortho nodesep=3] + node [shape=box penwidth=2] + edge [penwidth=2] -subgraph cluster_foo { - 0 [shape=box label="Enter function foo" style="filled"]; - 1 [shape=box label="Exit function foo" style="filled"]; + subgraph cluster_0 { + color=red + 0 [label="Enter function foo" style="filled" fillcolor=red]; + 1 [label="Exit function foo" style="filled" fillcolor=red]; + } 0 -> {1}; -} -subgraph cluster_bar { - 2 [shape=box label="Enter function bar" style="filled"]; - 3 [shape=box label="Exit function bar" style="filled"]; + subgraph cluster_1 { + color=red + 2 [label="Enter function bar" style="filled" fillcolor=red]; + 3 [label="Exit function bar" style="filled" fillcolor=red]; + } 2 -> {3}; -} -subgraph cluster_run { - 4 [shape=box label="Enter function run" style="filled"]; - 5 [shape=box label="Enter block"]; - 6 [shape=box label="Function call: R|/block|.R|FakeOverride|()"]; - 7 [shape=box label="Exit block"]; - 8 [shape=box label="Exit function run" style="filled"]; + subgraph cluster_2 { + color=red + 4 [label="Enter function run" style="filled" fillcolor=red]; + subgraph cluster_3 { + color=blue + 5 [label="Enter block"]; + 6 [label="Function call: R|/block|.R|FakeOverride|()"]; + 7 [label="Exit block"]; + } + 8 [label="Exit function run" style="filled" fillcolor=red]; + } 4 -> {5}; 5 -> {6}; 6 -> {7}; 7 -> {8}; -} -subgraph cluster_test_1 { - 9 [shape=box label="Enter function test_1" style="filled"]; - 10 [shape=box label="Enter block"]; - 11 [shape=box label="Enter when"]; - 12 [shape=box label="Enter when branch condition "]; - 13 [shape=box label="Access variable R|/x|"]; - 14 [shape=box label="Type operator: x is A"]; - 15 [shape=box label="Exit when branch condition"]; - 16 [shape=box label="Enter block"]; - 17 [shape=box label="Enter function anonymousFunction"]; - 18 [shape=box label="Enter block"]; - 19 [shape=box label="Access variable R|/x|"]; - 20 [shape=box label="Function call: R|/x|.R|/A.foo|()"]; - 21 [shape=box label="Exit block"]; - 22 [shape=box label="Exit function anonymousFunction"]; - 23 [shape=box label="Function call: R|/run|( = run@fun (): R|kotlin/Unit| { + subgraph cluster_4 { + color=red + 9 [label="Enter function test_1" style="filled" fillcolor=red]; + subgraph cluster_5 { + color=blue + 10 [label="Enter block"]; + subgraph cluster_6 { + color=blue + 11 [label="Enter when"]; + subgraph cluster_7 { + color=blue + 12 [label="Enter when branch condition "]; + 13 [label="Access variable R|/x|"]; + 14 [label="Type operator: x is A"]; + 15 [label="Exit when branch condition"]; + } + subgraph cluster_8 { + color=blue + 16 [label="Enter block"]; + subgraph cluster_9 { + color=blue + 17 [label="Enter function anonymousFunction"]; + subgraph cluster_10 { + color=blue + 18 [label="Enter block"]; + 19 [label="Access variable R|/x|"]; + 20 [label="Function call: R|/x|.R|/A.foo|()"]; + 21 [label="Exit block"]; + } + 22 [label="Exit function anonymousFunction"]; + } + 23 [label="Function call: R|/run|( = run@fun (): R|kotlin/Unit| { R|/x|.R|/A.foo|() } )"]; - 24 [shape=box label="Exit block"]; - 25 [shape=box label="Exit when branch result"]; - 26 [shape=box label="Enter when branch condition else"]; - 27 [shape=box label="Exit when branch condition"]; - 28 [shape=box label="Enter block"]; - 29 [shape=box label="Exit block"]; - 30 [shape=box label="Exit when branch result"]; - 31 [shape=box label="Exit when"]; - 32 [shape=box label="Exit block"]; - 33 [shape=box label="Exit function test_1" style="filled"]; + 24 [label="Exit block"]; + } + 25 [label="Exit when branch result"]; + subgraph cluster_11 { + color=blue + 26 [label="Enter when branch condition else"]; + 27 [label="Exit when branch condition"]; + } + subgraph cluster_12 { + color=blue + 28 [label="Enter block"]; + 29 [label="Exit block"]; + } + 30 [label="Exit when branch result"]; + 31 [label="Exit when"]; + } + 32 [label="Exit block"]; + } + 33 [label="Exit function test_1" style="filled" fillcolor=red]; + } 9 -> {10}; 10 -> {11}; @@ -82,25 +116,35 @@ subgraph cluster_test_1 { 30 -> {31}; 31 -> {32}; 32 -> {33}; -} -subgraph cluster_test_2 { - 34 [shape=box label="Enter function test_2" style="filled"]; - 35 [shape=box label="Enter block"]; - 36 [shape=box label="Enter function anonymousFunction"]; - 37 [shape=box label="Enter block"]; - 38 [shape=box label="Access variable R|/x|"]; - 39 [shape=box label="Type operator: x as B"]; - 40 [shape=box label="Exit block"]; - 41 [shape=box label="Exit function anonymousFunction"]; - 42 [shape=box label="Function call: R|/run|( = run@fun (): R|kotlin/Unit| { + subgraph cluster_13 { + color=red + 34 [label="Enter function test_2" style="filled" fillcolor=red]; + subgraph cluster_14 { + color=blue + 35 [label="Enter block"]; + subgraph cluster_15 { + color=blue + 36 [label="Enter function anonymousFunction"]; + subgraph cluster_16 { + color=blue + 37 [label="Enter block"]; + 38 [label="Access variable R|/x|"]; + 39 [label="Type operator: x as B"]; + 40 [label="Exit block"]; + } + 41 [label="Exit function anonymousFunction"]; + } + 42 [label="Function call: R|/run|( = run@fun (): R|kotlin/Unit| { (R|/x| as R|B|) } )"]; - 43 [shape=box label="Access variable R|/x|"]; - 44 [shape=box label="Function call: R|/x|.R|/B.bar|()"]; - 45 [shape=box label="Exit block"]; - 46 [shape=box label="Exit function test_2" style="filled"]; + 43 [label="Access variable R|/x|"]; + 44 [label="Function call: R|/x|.R|/B.bar|()"]; + 45 [label="Exit block"]; + } + 46 [label="Exit function test_2" style="filled" fillcolor=red]; + } 34 -> {35}; 35 -> {36}; @@ -114,42 +158,67 @@ subgraph cluster_test_2 { 43 -> {44}; 44 -> {45}; 45 -> {46}; -} -subgraph cluster_test_3 { - 47 [shape=box label="Enter function test_3" style="filled"]; - 48 [shape=box label="Enter block"]; - 49 [shape=box label="Enter when"]; - 50 [shape=box label="Enter when branch condition "]; - 51 [shape=box label="Access variable R|/x|"]; - 52 [shape=box label="Type operator: x is A"]; - 53 [shape=box label="Exit when branch condition"]; - 54 [shape=box label="Enter block"]; - 55 [shape=box label="Enter function anonymousFunction"]; - 56 [shape=box label="Enter block"]; - 57 [shape=box label="Access variable R|/x|"]; - 58 [shape=box label="Function call: R|/x|.R|/A.foo|()"]; - 59 [shape=box label="Access variable R|/x|"]; - 60 [shape=box label="Type operator: x as B"]; - 61 [shape=box label="Exit block"]; - 62 [shape=box label="Exit function anonymousFunction"]; - 63 [shape=box label="Function call: R|/run|( = run@fun (): R|kotlin/Unit| { + subgraph cluster_17 { + color=red + 47 [label="Enter function test_3" style="filled" fillcolor=red]; + subgraph cluster_18 { + color=blue + 48 [label="Enter block"]; + subgraph cluster_19 { + color=blue + 49 [label="Enter when"]; + subgraph cluster_20 { + color=blue + 50 [label="Enter when branch condition "]; + 51 [label="Access variable R|/x|"]; + 52 [label="Type operator: x is A"]; + 53 [label="Exit when branch condition"]; + } + subgraph cluster_21 { + color=blue + 54 [label="Enter block"]; + subgraph cluster_22 { + color=blue + 55 [label="Enter function anonymousFunction"]; + subgraph cluster_23 { + color=blue + 56 [label="Enter block"]; + 57 [label="Access variable R|/x|"]; + 58 [label="Function call: R|/x|.R|/A.foo|()"]; + 59 [label="Access variable R|/x|"]; + 60 [label="Type operator: x as B"]; + 61 [label="Exit block"]; + } + 62 [label="Exit function anonymousFunction"]; + } + 63 [label="Function call: R|/run|( = run@fun (): R|kotlin/Unit| { R|/x|.R|/A.foo|() (R|/x| as R|B|) } )"]; - 64 [shape=box label="Access variable R|/x|"]; - 65 [shape=box label="Function call: R|/x|.R|/B.bar|()"]; - 66 [shape=box label="Exit block"]; - 67 [shape=box label="Exit when branch result"]; - 68 [shape=box label="Enter when branch condition else"]; - 69 [shape=box label="Exit when branch condition"]; - 70 [shape=box label="Enter block"]; - 71 [shape=box label="Exit block"]; - 72 [shape=box label="Exit when branch result"]; - 73 [shape=box label="Exit when"]; - 74 [shape=box label="Exit block"]; - 75 [shape=box label="Exit function test_3" style="filled"]; + 64 [label="Access variable R|/x|"]; + 65 [label="Function call: R|/x|.R|/B.bar|()"]; + 66 [label="Exit block"]; + } + 67 [label="Exit when branch result"]; + subgraph cluster_24 { + color=blue + 68 [label="Enter when branch condition else"]; + 69 [label="Exit when branch condition"]; + } + subgraph cluster_25 { + color=blue + 70 [label="Enter block"]; + 71 [label="Exit block"]; + } + 72 [label="Exit when branch result"]; + 73 [label="Exit when"]; + } + 74 [label="Exit block"]; + } + 75 [label="Exit function test_3" style="filled" fillcolor=red]; + } 47 -> {48}; 48 -> {49}; @@ -179,6 +248,5 @@ subgraph cluster_test_3 { 72 -> {73}; 73 -> {74}; 74 -> {75}; -} } diff --git a/compiler/fir/resolve/testData/resolve/smartcasts/nullability.dot b/compiler/fir/resolve/testData/resolve/smartcasts/nullability.dot index 679cd624963..060076e890d 100644 --- a/compiler/fir/resolve/testData/resolve/smartcasts/nullability.dot +++ b/compiler/fir/resolve/testData/resolve/smartcasts/nullability.dot @@ -1,74 +1,102 @@ digraph nullability_kt { -graph [splines=ortho, nodesep=3] + graph [splines=ortho nodesep=3] + node [shape=box penwidth=2] + edge [penwidth=2] -subgraph cluster_foo { - 0 [shape=box label="Enter function foo" style="filled"]; - 1 [shape=box label="Exit function foo" style="filled"]; + subgraph cluster_0 { + color=red + 0 [label="Enter function foo" style="filled" fillcolor=red]; + 1 [label="Exit function foo" style="filled" fillcolor=red]; + } 0 -> {1}; -} -subgraph cluster_getA { - 2 [shape=box label="Enter function getA" style="filled"]; - 3 [shape=box label="Exit function getA" style="filled"]; + subgraph cluster_1 { + color=red + 2 [label="Enter function getA" style="filled" fillcolor=red]; + 3 [label="Exit function getA" style="filled" fillcolor=red]; + } 2 -> {3}; -} -subgraph cluster_val_s { - 4 [shape=box label="Enter property" style="filled"]; - 5 [shape=box label="Exit property" style="filled"]; + subgraph cluster_2 { + color=red + 4 [label="Enter property" style="filled" fillcolor=red]; + 5 [label="Exit property" style="filled" fillcolor=red]; + } 4 -> {5}; -} -subgraph cluster_fs { - 6 [shape=box label="Enter function fs" style="filled"]; - 7 [shape=box label="Exit function fs" style="filled"]; + subgraph cluster_3 { + color=red + 6 [label="Enter function fs" style="filled" fillcolor=red]; + 7 [label="Exit function fs" style="filled" fillcolor=red]; + } 6 -> {7}; -} -subgraph cluster_val_data { - 8 [shape=box label="Enter property" style="filled"]; - 9 [shape=box label="Exit property" style="filled"]; + subgraph cluster_4 { + color=red + 8 [label="Enter property" style="filled" fillcolor=red]; + 9 [label="Exit property" style="filled" fillcolor=red]; + } 8 -> {9}; -} -subgraph cluster_fdata { - 10 [shape=box label="Enter function fdata" style="filled"]; - 11 [shape=box label="Exit function fdata" style="filled"]; + subgraph cluster_5 { + color=red + 10 [label="Enter function fdata" style="filled" fillcolor=red]; + 11 [label="Exit function fdata" style="filled" fillcolor=red]; + } 10 -> {11}; -} -subgraph cluster_test_1 { - 12 [shape=box label="Enter function test_1" style="filled"]; - 13 [shape=box label="Enter block"]; - 14 [shape=box label="Enter when"]; - 15 [shape=box label="Enter when branch condition "]; - 16 [shape=box label="Access variable R|/x|"]; - 17 [shape=box label="Const: Null(null)"]; - 18 [shape=box label="Operator !="]; - 19 [shape=box label="Exit when branch condition"]; - 20 [shape=box label="Enter block"]; - 21 [shape=box label="Access variable R|/x|"]; - 22 [shape=box label="Function call: R|/x|.R|/A.foo|()"]; - 23 [shape=box label="Exit block"]; - 24 [shape=box label="Exit when branch result"]; - 25 [shape=box label="Enter when branch condition else"]; - 26 [shape=box label="Exit when branch condition"]; - 27 [shape=box label="Enter block"]; - 28 [shape=box label="Access variable R|/x|"]; - 29 [shape=box label="Function call: R|/x|.#()"]; - 30 [shape=box label="Exit block"]; - 31 [shape=box label="Exit when branch result"]; - 32 [shape=box label="Exit when"]; - 33 [shape=box label="Access variable R|/x|"]; - 34 [shape=box label="Function call: R|/x|.#()"]; - 35 [shape=box label="Exit block"]; - 36 [shape=box label="Exit function test_1" style="filled"]; + subgraph cluster_6 { + color=red + 12 [label="Enter function test_1" style="filled" fillcolor=red]; + subgraph cluster_7 { + color=blue + 13 [label="Enter block"]; + subgraph cluster_8 { + color=blue + 14 [label="Enter when"]; + subgraph cluster_9 { + color=blue + 15 [label="Enter when branch condition "]; + 16 [label="Access variable R|/x|"]; + 17 [label="Const: Null(null)"]; + 18 [label="Operator !="]; + 19 [label="Exit when branch condition"]; + } + subgraph cluster_10 { + color=blue + 20 [label="Enter block"]; + 21 [label="Access variable R|/x|"]; + 22 [label="Function call: R|/x|.R|/A.foo|()"]; + 23 [label="Exit block"]; + } + 24 [label="Exit when branch result"]; + subgraph cluster_11 { + color=blue + 25 [label="Enter when branch condition else"]; + 26 [label="Exit when branch condition"]; + } + subgraph cluster_12 { + color=blue + 27 [label="Enter block"]; + 28 [label="Access variable R|/x|"]; + 29 [label="Function call: R|/x|.#()"]; + 30 [label="Exit block"]; + } + 31 [label="Exit when branch result"]; + 32 [label="Exit when"]; + } + 33 [label="Access variable R|/x|"]; + 34 [label="Function call: R|/x|.#()"]; + 35 [label="Exit block"]; + } + 36 [label="Exit function test_1" style="filled" fillcolor=red]; + } 12 -> {13}; 13 -> {14}; @@ -94,34 +122,53 @@ subgraph cluster_test_1 { 33 -> {34}; 34 -> {35}; 35 -> {36}; -} -subgraph cluster_test_2 { - 37 [shape=box label="Enter function test_2" style="filled"]; - 38 [shape=box label="Enter block"]; - 39 [shape=box label="Enter when"]; - 40 [shape=box label="Enter when branch condition "]; - 41 [shape=box label="Access variable R|/x|"]; - 42 [shape=box label="Const: Null(null)"]; - 43 [shape=box label="Operator =="]; - 44 [shape=box label="Exit when branch condition"]; - 45 [shape=box label="Enter block"]; - 46 [shape=box label="Access variable R|/x|"]; - 47 [shape=box label="Function call: R|/x|.#()"]; - 48 [shape=box label="Exit block"]; - 49 [shape=box label="Exit when branch result"]; - 50 [shape=box label="Enter when branch condition else"]; - 51 [shape=box label="Exit when branch condition"]; - 52 [shape=box label="Enter block"]; - 53 [shape=box label="Access variable R|/x|"]; - 54 [shape=box label="Function call: R|/x|.R|/A.foo|()"]; - 55 [shape=box label="Exit block"]; - 56 [shape=box label="Exit when branch result"]; - 57 [shape=box label="Exit when"]; - 58 [shape=box label="Access variable R|/x|"]; - 59 [shape=box label="Function call: R|/x|.#()"]; - 60 [shape=box label="Exit block"]; - 61 [shape=box label="Exit function test_2" style="filled"]; + subgraph cluster_13 { + color=red + 37 [label="Enter function test_2" style="filled" fillcolor=red]; + subgraph cluster_14 { + color=blue + 38 [label="Enter block"]; + subgraph cluster_15 { + color=blue + 39 [label="Enter when"]; + subgraph cluster_16 { + color=blue + 40 [label="Enter when branch condition "]; + 41 [label="Access variable R|/x|"]; + 42 [label="Const: Null(null)"]; + 43 [label="Operator =="]; + 44 [label="Exit when branch condition"]; + } + subgraph cluster_17 { + color=blue + 45 [label="Enter block"]; + 46 [label="Access variable R|/x|"]; + 47 [label="Function call: R|/x|.#()"]; + 48 [label="Exit block"]; + } + 49 [label="Exit when branch result"]; + subgraph cluster_18 { + color=blue + 50 [label="Enter when branch condition else"]; + 51 [label="Exit when branch condition"]; + } + subgraph cluster_19 { + color=blue + 52 [label="Enter block"]; + 53 [label="Access variable R|/x|"]; + 54 [label="Function call: R|/x|.R|/A.foo|()"]; + 55 [label="Exit block"]; + } + 56 [label="Exit when branch result"]; + 57 [label="Exit when"]; + } + 58 [label="Access variable R|/x|"]; + 59 [label="Function call: R|/x|.#()"]; + 60 [label="Exit block"]; + } + 61 [label="Exit function test_2" style="filled" fillcolor=red]; + } 37 -> {38}; 38 -> {39}; @@ -147,34 +194,53 @@ subgraph cluster_test_2 { 58 -> {59}; 59 -> {60}; 60 -> {61}; -} -subgraph cluster_test_3 { - 62 [shape=box label="Enter function test_3" style="filled"]; - 63 [shape=box label="Enter block"]; - 64 [shape=box label="Enter when"]; - 65 [shape=box label="Access variable R|/x|"]; - 66 [shape=box label="Variable declaration: lval : R|A?|"]; - 67 [shape=box label="Enter when branch condition "]; - 68 [shape=box label="Const: Null(null)"]; - 69 [shape=box label="Operator =="]; - 70 [shape=box label="Exit when branch condition"]; - 71 [shape=box label="Enter block"]; - 72 [shape=box label="Jump: ^test_3 Unit"]; - 73 [shape=box label="Stub[DEAD]"]; - 74 [shape=box label="Exit block[DEAD]"]; - 75 [shape=box label="Exit when branch result[DEAD]"]; - 76 [shape=box label="Enter when branch condition else"]; - 77 [shape=box label="Exit when branch condition"]; - 78 [shape=box label="Enter block"]; - 79 [shape=box label="Access variable R|/|"]; - 80 [shape=box label="Exit block"]; - 81 [shape=box label="Exit when branch result"]; - 82 [shape=box label="Exit when"]; - 83 [shape=box label="Access variable R|/x|"]; - 84 [shape=box label="Function call: R|/x|.R|/A.foo|()"]; - 85 [shape=box label="Exit block"]; - 86 [shape=box label="Exit function test_3" style="filled"]; + subgraph cluster_20 { + color=red + 62 [label="Enter function test_3" style="filled" fillcolor=red]; + subgraph cluster_21 { + color=blue + 63 [label="Enter block"]; + subgraph cluster_22 { + color=blue + 64 [label="Enter when"]; + 65 [label="Access variable R|/x|"]; + 66 [label="Variable declaration: lval : R|A?|"]; + subgraph cluster_23 { + color=blue + 67 [label="Enter when branch condition "]; + 68 [label="Const: Null(null)"]; + 69 [label="Operator =="]; + 70 [label="Exit when branch condition"]; + } + subgraph cluster_24 { + color=blue + 71 [label="Enter block"]; + 72 [label="Jump: ^test_3 Unit"]; + 73 [label="Stub" style="filled" fillcolor=gray]; + 74 [label="Exit block" style="filled" fillcolor=gray]; + } + 75 [label="Exit when branch result" style="filled" fillcolor=gray]; + subgraph cluster_25 { + color=blue + 76 [label="Enter when branch condition else"]; + 77 [label="Exit when branch condition"]; + } + subgraph cluster_26 { + color=blue + 78 [label="Enter block"]; + 79 [label="Access variable R|/|"]; + 80 [label="Exit block"]; + } + 81 [label="Exit when branch result"]; + 82 [label="Exit when"]; + } + 83 [label="Access variable R|/x|"]; + 84 [label="Function call: R|/x|.R|/A.foo|()"]; + 85 [label="Exit block"]; + } + 86 [label="Exit function test_3" style="filled" fillcolor=red]; + } 62 -> {63}; 63 -> {64}; @@ -201,33 +267,52 @@ subgraph cluster_test_3 { 83 -> {84}; 84 -> {85}; 85 -> {86}; -} -subgraph cluster_test_4 { - 87 [shape=box label="Enter function test_4" style="filled"]; - 88 [shape=box label="Enter block"]; - 89 [shape=box label="Enter when"]; - 90 [shape=box label="Enter when branch condition "]; - 91 [shape=box label="Access variable R|/x|"]; - 92 [shape=box label="Function call: R|/x|?.R|/A.getA|()"]; - 93 [shape=box label="Const: Null(null)"]; - 94 [shape=box label="Operator =="]; - 95 [shape=box label="Exit when branch condition"]; - 96 [shape=box label="Enter block"]; - 97 [shape=box label="Jump: ^test_4 Unit"]; - 98 [shape=box label="Stub[DEAD]"]; - 99 [shape=box label="Exit block[DEAD]"]; - 100 [shape=box label="Exit when branch result[DEAD]"]; - 101 [shape=box label="Enter when branch condition else"]; - 102 [shape=box label="Exit when branch condition"]; - 103 [shape=box label="Enter block"]; - 104 [shape=box label="Exit block"]; - 105 [shape=box label="Exit when branch result"]; - 106 [shape=box label="Exit when"]; - 107 [shape=box label="Access variable R|/x|"]; - 108 [shape=box label="Function call: R|/x|.R|/A.foo|()"]; - 109 [shape=box label="Exit block"]; - 110 [shape=box label="Exit function test_4" style="filled"]; + subgraph cluster_27 { + color=red + 87 [label="Enter function test_4" style="filled" fillcolor=red]; + subgraph cluster_28 { + color=blue + 88 [label="Enter block"]; + subgraph cluster_29 { + color=blue + 89 [label="Enter when"]; + subgraph cluster_30 { + color=blue + 90 [label="Enter when branch condition "]; + 91 [label="Access variable R|/x|"]; + 92 [label="Function call: R|/x|?.R|/A.getA|()"]; + 93 [label="Const: Null(null)"]; + 94 [label="Operator =="]; + 95 [label="Exit when branch condition"]; + } + subgraph cluster_31 { + color=blue + 96 [label="Enter block"]; + 97 [label="Jump: ^test_4 Unit"]; + 98 [label="Stub" style="filled" fillcolor=gray]; + 99 [label="Exit block" style="filled" fillcolor=gray]; + } + 100 [label="Exit when branch result" style="filled" fillcolor=gray]; + subgraph cluster_32 { + color=blue + 101 [label="Enter when branch condition else"]; + 102 [label="Exit when branch condition"]; + } + subgraph cluster_33 { + color=blue + 103 [label="Enter block"]; + 104 [label="Exit block"]; + } + 105 [label="Exit when branch result"]; + 106 [label="Exit when"]; + } + 107 [label="Access variable R|/x|"]; + 108 [label="Function call: R|/x|.R|/A.foo|()"]; + 109 [label="Exit block"]; + } + 110 [label="Exit function test_4" style="filled" fillcolor=red]; + } 87 -> {88}; 88 -> {89}; @@ -253,40 +338,59 @@ subgraph cluster_test_4 { 107 -> {108}; 108 -> {109}; 109 -> {110}; -} -subgraph cluster_test_5 { - 111 [shape=box label="Enter function test_5" style="filled"]; - 112 [shape=box label="Enter block"]; - 113 [shape=box label="Enter when"]; - 114 [shape=box label="Enter when branch condition "]; - 115 [shape=box label="Access variable R|/q|"]; - 116 [shape=box label="Access variable R|/Q.data|"]; - 117 [shape=box label="Access variable R|/MyData.s|"]; - 118 [shape=box label="Function call: R|/q|?.R|/Q.data|?.R|/MyData.s|?.R|kotlin/Int.inc|()"]; - 119 [shape=box label="Const: Null(null)"]; - 120 [shape=box label="Operator !="]; - 121 [shape=box label="Exit when branch condition"]; - 122 [shape=box label="Enter block"]; - 123 [shape=box label="Access variable R|/q|"]; - 124 [shape=box label="Access variable R|/Q.data|"]; - 125 [shape=box label="Access variable R|/q|"]; - 126 [shape=box label="Access variable R|/Q.data|"]; - 127 [shape=box label="Access variable R|/MyData.s|"]; - 128 [shape=box label="Access variable R|/q|"]; - 129 [shape=box label="Access variable R|/Q.data|"]; - 130 [shape=box label="Access variable R|/MyData.s|"]; - 131 [shape=box label="Function call: R|/q|.R|/Q.data|.R|/MyData.s|.R|kotlin/Int.inc|()"]; - 132 [shape=box label="Exit block"]; - 133 [shape=box label="Exit when branch result"]; - 134 [shape=box label="Enter when branch condition else"]; - 135 [shape=box label="Exit when branch condition"]; - 136 [shape=box label="Enter block"]; - 137 [shape=box label="Exit block"]; - 138 [shape=box label="Exit when branch result"]; - 139 [shape=box label="Exit when"]; - 140 [shape=box label="Exit block"]; - 141 [shape=box label="Exit function test_5" style="filled"]; + subgraph cluster_34 { + color=red + 111 [label="Enter function test_5" style="filled" fillcolor=red]; + subgraph cluster_35 { + color=blue + 112 [label="Enter block"]; + subgraph cluster_36 { + color=blue + 113 [label="Enter when"]; + subgraph cluster_37 { + color=blue + 114 [label="Enter when branch condition "]; + 115 [label="Access variable R|/q|"]; + 116 [label="Access variable R|/Q.data|"]; + 117 [label="Access variable R|/MyData.s|"]; + 118 [label="Function call: R|/q|?.R|/Q.data|?.R|/MyData.s|?.R|kotlin/Int.inc|()"]; + 119 [label="Const: Null(null)"]; + 120 [label="Operator !="]; + 121 [label="Exit when branch condition"]; + } + subgraph cluster_38 { + color=blue + 122 [label="Enter block"]; + 123 [label="Access variable R|/q|"]; + 124 [label="Access variable R|/Q.data|"]; + 125 [label="Access variable R|/q|"]; + 126 [label="Access variable R|/Q.data|"]; + 127 [label="Access variable R|/MyData.s|"]; + 128 [label="Access variable R|/q|"]; + 129 [label="Access variable R|/Q.data|"]; + 130 [label="Access variable R|/MyData.s|"]; + 131 [label="Function call: R|/q|.R|/Q.data|.R|/MyData.s|.R|kotlin/Int.inc|()"]; + 132 [label="Exit block"]; + } + 133 [label="Exit when branch result"]; + subgraph cluster_39 { + color=blue + 134 [label="Enter when branch condition else"]; + 135 [label="Exit when branch condition"]; + } + subgraph cluster_40 { + color=blue + 136 [label="Enter block"]; + 137 [label="Exit block"]; + } + 138 [label="Exit when branch result"]; + 139 [label="Exit when"]; + } + 140 [label="Exit block"]; + } + 141 [label="Exit function test_5" style="filled" fillcolor=red]; + } 111 -> {112}; 112 -> {113}; @@ -318,44 +422,63 @@ subgraph cluster_test_5 { 138 -> {139}; 139 -> {140}; 140 -> {141}; -} -subgraph cluster_test_6 { - 142 [shape=box label="Enter function test_6" style="filled"]; - 143 [shape=box label="Enter block"]; - 144 [shape=box label="Enter when"]; - 145 [shape=box label="Access variable R|/q|"]; - 146 [shape=box label="Access variable R|/Q.data|"]; - 147 [shape=box label="Access variable R|/MyData.s|"]; - 148 [shape=box label="Function call: R|/q|?.R|/Q.data|?.R|/MyData.s|?.R|kotlin/Int.inc|()"]; - 149 [shape=box label="Variable declaration: lval : R|kotlin/Int?|"]; - 150 [shape=box label="Enter when branch condition "]; - 151 [shape=box label="Const: Null(null)"]; - 152 [shape=box label="Operator =="]; - 153 [shape=box label="Exit when branch condition"]; - 154 [shape=box label="Enter block"]; - 155 [shape=box label="Jump: ^test_6 Unit"]; - 156 [shape=box label="Stub[DEAD]"]; - 157 [shape=box label="Exit block[DEAD]"]; - 158 [shape=box label="Exit when branch result[DEAD]"]; - 159 [shape=box label="Enter when branch condition else"]; - 160 [shape=box label="Exit when branch condition"]; - 161 [shape=box label="Enter block"]; - 162 [shape=box label="Access variable R|/|"]; - 163 [shape=box label="Exit block"]; - 164 [shape=box label="Exit when branch result"]; - 165 [shape=box label="Exit when"]; - 166 [shape=box label="Access variable R|/q|"]; - 167 [shape=box label="Access variable R|/Q.data|"]; - 168 [shape=box label="Access variable R|/q|"]; - 169 [shape=box label="Access variable R|/Q.data|"]; - 170 [shape=box label="Access variable R|/MyData.s|"]; - 171 [shape=box label="Access variable R|/q|"]; - 172 [shape=box label="Access variable R|/Q.data|"]; - 173 [shape=box label="Access variable R|/MyData.s|"]; - 174 [shape=box label="Function call: R|/q|.R|/Q.data|.R|/MyData.s|.R|kotlin/Int.inc|()"]; - 175 [shape=box label="Exit block"]; - 176 [shape=box label="Exit function test_6" style="filled"]; + subgraph cluster_41 { + color=red + 142 [label="Enter function test_6" style="filled" fillcolor=red]; + subgraph cluster_42 { + color=blue + 143 [label="Enter block"]; + subgraph cluster_43 { + color=blue + 144 [label="Enter when"]; + 145 [label="Access variable R|/q|"]; + 146 [label="Access variable R|/Q.data|"]; + 147 [label="Access variable R|/MyData.s|"]; + 148 [label="Function call: R|/q|?.R|/Q.data|?.R|/MyData.s|?.R|kotlin/Int.inc|()"]; + 149 [label="Variable declaration: lval : R|kotlin/Int?|"]; + subgraph cluster_44 { + color=blue + 150 [label="Enter when branch condition "]; + 151 [label="Const: Null(null)"]; + 152 [label="Operator =="]; + 153 [label="Exit when branch condition"]; + } + subgraph cluster_45 { + color=blue + 154 [label="Enter block"]; + 155 [label="Jump: ^test_6 Unit"]; + 156 [label="Stub" style="filled" fillcolor=gray]; + 157 [label="Exit block" style="filled" fillcolor=gray]; + } + 158 [label="Exit when branch result" style="filled" fillcolor=gray]; + subgraph cluster_46 { + color=blue + 159 [label="Enter when branch condition else"]; + 160 [label="Exit when branch condition"]; + } + subgraph cluster_47 { + color=blue + 161 [label="Enter block"]; + 162 [label="Access variable R|/|"]; + 163 [label="Exit block"]; + } + 164 [label="Exit when branch result"]; + 165 [label="Exit when"]; + } + 166 [label="Access variable R|/q|"]; + 167 [label="Access variable R|/Q.data|"]; + 168 [label="Access variable R|/q|"]; + 169 [label="Access variable R|/Q.data|"]; + 170 [label="Access variable R|/MyData.s|"]; + 171 [label="Access variable R|/q|"]; + 172 [label="Access variable R|/Q.data|"]; + 173 [label="Access variable R|/MyData.s|"]; + 174 [label="Function call: R|/q|.R|/Q.data|.R|/MyData.s|.R|kotlin/Int.inc|()"]; + 175 [label="Exit block"]; + } + 176 [label="Exit function test_6" style="filled" fillcolor=red]; + } 142 -> {143}; 143 -> {144}; @@ -392,40 +515,59 @@ subgraph cluster_test_6 { 173 -> {174}; 174 -> {175}; 175 -> {176}; -} -subgraph cluster_test_7 { - 177 [shape=box label="Enter function test_7" style="filled"]; - 178 [shape=box label="Enter block"]; - 179 [shape=box label="Enter when"]; - 180 [shape=box label="Enter when branch condition "]; - 181 [shape=box label="Access variable R|/q|"]; - 182 [shape=box label="Function call: R|/q|?.R|/Q.fdata|()"]; - 183 [shape=box label="Function call: R|/q|?.R|/Q.fdata|()?.R|/MyData.fs|()"]; - 184 [shape=box label="Function call: R|/q|?.R|/Q.fdata|()?.R|/MyData.fs|()?.R|kotlin/Int.inc|()"]; - 185 [shape=box label="Const: Null(null)"]; - 186 [shape=box label="Operator !="]; - 187 [shape=box label="Exit when branch condition"]; - 188 [shape=box label="Enter block"]; - 189 [shape=box label="Access variable R|/q|"]; - 190 [shape=box label="Function call: R|/q|.R|/Q.fdata|()"]; - 191 [shape=box label="Access variable R|/q|"]; - 192 [shape=box label="Function call: R|/q|.R|/Q.fdata|()"]; - 193 [shape=box label="Function call: R|/q|.R|/Q.fdata|().#()"]; - 194 [shape=box label="Access variable R|/q|"]; - 195 [shape=box label="Function call: R|/q|.R|/Q.fdata|()"]; - 196 [shape=box label="Function call: R|/q|.R|/Q.fdata|().#()"]; - 197 [shape=box label="Function call: R|/q|.R|/Q.fdata|().#().#()"]; - 198 [shape=box label="Exit block"]; - 199 [shape=box label="Exit when branch result"]; - 200 [shape=box label="Enter when branch condition else"]; - 201 [shape=box label="Exit when branch condition"]; - 202 [shape=box label="Enter block"]; - 203 [shape=box label="Exit block"]; - 204 [shape=box label="Exit when branch result"]; - 205 [shape=box label="Exit when"]; - 206 [shape=box label="Exit block"]; - 207 [shape=box label="Exit function test_7" style="filled"]; + subgraph cluster_48 { + color=red + 177 [label="Enter function test_7" style="filled" fillcolor=red]; + subgraph cluster_49 { + color=blue + 178 [label="Enter block"]; + subgraph cluster_50 { + color=blue + 179 [label="Enter when"]; + subgraph cluster_51 { + color=blue + 180 [label="Enter when branch condition "]; + 181 [label="Access variable R|/q|"]; + 182 [label="Function call: R|/q|?.R|/Q.fdata|()"]; + 183 [label="Function call: R|/q|?.R|/Q.fdata|()?.R|/MyData.fs|()"]; + 184 [label="Function call: R|/q|?.R|/Q.fdata|()?.R|/MyData.fs|()?.R|kotlin/Int.inc|()"]; + 185 [label="Const: Null(null)"]; + 186 [label="Operator !="]; + 187 [label="Exit when branch condition"]; + } + subgraph cluster_52 { + color=blue + 188 [label="Enter block"]; + 189 [label="Access variable R|/q|"]; + 190 [label="Function call: R|/q|.R|/Q.fdata|()"]; + 191 [label="Access variable R|/q|"]; + 192 [label="Function call: R|/q|.R|/Q.fdata|()"]; + 193 [label="Function call: R|/q|.R|/Q.fdata|().#()"]; + 194 [label="Access variable R|/q|"]; + 195 [label="Function call: R|/q|.R|/Q.fdata|()"]; + 196 [label="Function call: R|/q|.R|/Q.fdata|().#()"]; + 197 [label="Function call: R|/q|.R|/Q.fdata|().#().#()"]; + 198 [label="Exit block"]; + } + 199 [label="Exit when branch result"]; + subgraph cluster_53 { + color=blue + 200 [label="Enter when branch condition else"]; + 201 [label="Exit when branch condition"]; + } + subgraph cluster_54 { + color=blue + 202 [label="Enter block"]; + 203 [label="Exit block"]; + } + 204 [label="Exit when branch result"]; + 205 [label="Exit when"]; + } + 206 [label="Exit block"]; + } + 207 [label="Exit function test_7" style="filled" fillcolor=red]; + } 177 -> {178}; 178 -> {179}; @@ -457,30 +599,49 @@ subgraph cluster_test_7 { 204 -> {205}; 205 -> {206}; 206 -> {207}; -} -subgraph cluster_test_8 { - 208 [shape=box label="Enter function test_8" style="filled"]; - 209 [shape=box label="Enter block"]; - 210 [shape=box label="Enter when"]; - 211 [shape=box label="Enter when branch condition "]; - 212 [shape=box label="Access variable R|/b|"]; - 213 [shape=box label="Const: Boolean(true)"]; - 214 [shape=box label="Operator =="]; - 215 [shape=box label="Exit when branch condition"]; - 216 [shape=box label="Enter block"]; - 217 [shape=box label="Access variable R|/b|"]; - 218 [shape=box label="Function call: R|/b|.R|kotlin/Boolean.not|()"]; - 219 [shape=box label="Exit block"]; - 220 [shape=box label="Exit when branch result"]; - 221 [shape=box label="Enter when branch condition else"]; - 222 [shape=box label="Exit when branch condition"]; - 223 [shape=box label="Enter block"]; - 224 [shape=box label="Exit block"]; - 225 [shape=box label="Exit when branch result"]; - 226 [shape=box label="Exit when"]; - 227 [shape=box label="Exit block"]; - 228 [shape=box label="Exit function test_8" style="filled"]; + subgraph cluster_55 { + color=red + 208 [label="Enter function test_8" style="filled" fillcolor=red]; + subgraph cluster_56 { + color=blue + 209 [label="Enter block"]; + subgraph cluster_57 { + color=blue + 210 [label="Enter when"]; + subgraph cluster_58 { + color=blue + 211 [label="Enter when branch condition "]; + 212 [label="Access variable R|/b|"]; + 213 [label="Const: Boolean(true)"]; + 214 [label="Operator =="]; + 215 [label="Exit when branch condition"]; + } + subgraph cluster_59 { + color=blue + 216 [label="Enter block"]; + 217 [label="Access variable R|/b|"]; + 218 [label="Function call: R|/b|.R|kotlin/Boolean.not|()"]; + 219 [label="Exit block"]; + } + 220 [label="Exit when branch result"]; + subgraph cluster_60 { + color=blue + 221 [label="Enter when branch condition else"]; + 222 [label="Exit when branch condition"]; + } + subgraph cluster_61 { + color=blue + 223 [label="Enter block"]; + 224 [label="Exit block"]; + } + 225 [label="Exit when branch result"]; + 226 [label="Exit when"]; + } + 227 [label="Exit block"]; + } + 228 [label="Exit function test_8" style="filled" fillcolor=red]; + } 208 -> {209}; 209 -> {210}; @@ -502,89 +663,153 @@ subgraph cluster_test_8 { 225 -> {226}; 226 -> {227}; 227 -> {228}; -} -subgraph cluster_test_9 { - 229 [shape=box label="Enter function test_9" style="filled"]; - 230 [shape=box label="Enter block"]; - 231 [shape=box label="Enter when"]; - 232 [shape=box label="Enter when branch condition "]; - 233 [shape=box label="Access variable R|/a|"]; - 234 [shape=box label="Access variable R|/b|"]; - 235 [shape=box label="Operator =="]; - 236 [shape=box label="Exit when branch condition"]; - 237 [shape=box label="Enter block"]; - 238 [shape=box label="Access variable R|/b|"]; - 239 [shape=box label="Function call: R|/b|.R|kotlin/Int.inc|()"]; - 240 [shape=box label="Exit block"]; - 241 [shape=box label="Exit when branch result"]; - 242 [shape=box label="Enter when branch condition else"]; - 243 [shape=box label="Exit when branch condition"]; - 244 [shape=box label="Enter block"]; - 245 [shape=box label="Exit block"]; - 246 [shape=box label="Exit when branch result"]; - 247 [shape=box label="Exit when"]; - 248 [shape=box label="Access variable R|/b|"]; - 249 [shape=box label="Function call: R|/b|.#()"]; - 250 [shape=box label="Enter when"]; - 251 [shape=box label="Enter when branch condition "]; - 252 [shape=box label="Access variable R|/a|"]; - 253 [shape=box label="Access variable R|/b|"]; - 254 [shape=box label="Operator ==="]; - 255 [shape=box label="Exit when branch condition"]; - 256 [shape=box label="Enter block"]; - 257 [shape=box label="Access variable R|/b|"]; - 258 [shape=box label="Function call: R|/b|.R|kotlin/Int.inc|()"]; - 259 [shape=box label="Exit block"]; - 260 [shape=box label="Exit when branch result"]; - 261 [shape=box label="Enter when branch condition else"]; - 262 [shape=box label="Exit when branch condition"]; - 263 [shape=box label="Enter block"]; - 264 [shape=box label="Exit block"]; - 265 [shape=box label="Exit when branch result"]; - 266 [shape=box label="Exit when"]; - 267 [shape=box label="Access variable R|/b|"]; - 268 [shape=box label="Function call: R|/b|.#()"]; - 269 [shape=box label="Enter when"]; - 270 [shape=box label="Enter when branch condition "]; - 271 [shape=box label="Access variable R|/b|"]; - 272 [shape=box label="Access variable R|/a|"]; - 273 [shape=box label="Operator =="]; - 274 [shape=box label="Exit when branch condition"]; - 275 [shape=box label="Enter block"]; - 276 [shape=box label="Access variable R|/b|"]; - 277 [shape=box label="Function call: R|/b|.R|kotlin/Int.inc|()"]; - 278 [shape=box label="Exit block"]; - 279 [shape=box label="Exit when branch result"]; - 280 [shape=box label="Enter when branch condition else"]; - 281 [shape=box label="Exit when branch condition"]; - 282 [shape=box label="Enter block"]; - 283 [shape=box label="Exit block"]; - 284 [shape=box label="Exit when branch result"]; - 285 [shape=box label="Exit when"]; - 286 [shape=box label="Access variable R|/b|"]; - 287 [shape=box label="Function call: R|/b|.#()"]; - 288 [shape=box label="Enter when"]; - 289 [shape=box label="Enter when branch condition "]; - 290 [shape=box label="Access variable R|/b|"]; - 291 [shape=box label="Access variable R|/a|"]; - 292 [shape=box label="Operator ==="]; - 293 [shape=box label="Exit when branch condition"]; - 294 [shape=box label="Enter block"]; - 295 [shape=box label="Access variable R|/b|"]; - 296 [shape=box label="Function call: R|/b|.R|kotlin/Int.inc|()"]; - 297 [shape=box label="Exit block"]; - 298 [shape=box label="Exit when branch result"]; - 299 [shape=box label="Enter when branch condition else"]; - 300 [shape=box label="Exit when branch condition"]; - 301 [shape=box label="Enter block"]; - 302 [shape=box label="Exit block"]; - 303 [shape=box label="Exit when branch result"]; - 304 [shape=box label="Exit when"]; - 305 [shape=box label="Access variable R|/b|"]; - 306 [shape=box label="Function call: R|/b|.#()"]; - 307 [shape=box label="Exit block"]; - 308 [shape=box label="Exit function test_9" style="filled"]; + subgraph cluster_62 { + color=red + 229 [label="Enter function test_9" style="filled" fillcolor=red]; + subgraph cluster_63 { + color=blue + 230 [label="Enter block"]; + subgraph cluster_64 { + color=blue + 231 [label="Enter when"]; + subgraph cluster_65 { + color=blue + 232 [label="Enter when branch condition "]; + 233 [label="Access variable R|/a|"]; + 234 [label="Access variable R|/b|"]; + 235 [label="Operator =="]; + 236 [label="Exit when branch condition"]; + } + subgraph cluster_66 { + color=blue + 237 [label="Enter block"]; + 238 [label="Access variable R|/b|"]; + 239 [label="Function call: R|/b|.R|kotlin/Int.inc|()"]; + 240 [label="Exit block"]; + } + 241 [label="Exit when branch result"]; + subgraph cluster_67 { + color=blue + 242 [label="Enter when branch condition else"]; + 243 [label="Exit when branch condition"]; + } + subgraph cluster_68 { + color=blue + 244 [label="Enter block"]; + 245 [label="Exit block"]; + } + 246 [label="Exit when branch result"]; + 247 [label="Exit when"]; + } + 248 [label="Access variable R|/b|"]; + 249 [label="Function call: R|/b|.#()"]; + subgraph cluster_69 { + color=blue + 250 [label="Enter when"]; + subgraph cluster_70 { + color=blue + 251 [label="Enter when branch condition "]; + 252 [label="Access variable R|/a|"]; + 253 [label="Access variable R|/b|"]; + 254 [label="Operator ==="]; + 255 [label="Exit when branch condition"]; + } + subgraph cluster_71 { + color=blue + 256 [label="Enter block"]; + 257 [label="Access variable R|/b|"]; + 258 [label="Function call: R|/b|.R|kotlin/Int.inc|()"]; + 259 [label="Exit block"]; + } + 260 [label="Exit when branch result"]; + subgraph cluster_72 { + color=blue + 261 [label="Enter when branch condition else"]; + 262 [label="Exit when branch condition"]; + } + subgraph cluster_73 { + color=blue + 263 [label="Enter block"]; + 264 [label="Exit block"]; + } + 265 [label="Exit when branch result"]; + 266 [label="Exit when"]; + } + 267 [label="Access variable R|/b|"]; + 268 [label="Function call: R|/b|.#()"]; + subgraph cluster_74 { + color=blue + 269 [label="Enter when"]; + subgraph cluster_75 { + color=blue + 270 [label="Enter when branch condition "]; + 271 [label="Access variable R|/b|"]; + 272 [label="Access variable R|/a|"]; + 273 [label="Operator =="]; + 274 [label="Exit when branch condition"]; + } + subgraph cluster_76 { + color=blue + 275 [label="Enter block"]; + 276 [label="Access variable R|/b|"]; + 277 [label="Function call: R|/b|.R|kotlin/Int.inc|()"]; + 278 [label="Exit block"]; + } + 279 [label="Exit when branch result"]; + subgraph cluster_77 { + color=blue + 280 [label="Enter when branch condition else"]; + 281 [label="Exit when branch condition"]; + } + subgraph cluster_78 { + color=blue + 282 [label="Enter block"]; + 283 [label="Exit block"]; + } + 284 [label="Exit when branch result"]; + 285 [label="Exit when"]; + } + 286 [label="Access variable R|/b|"]; + 287 [label="Function call: R|/b|.#()"]; + subgraph cluster_79 { + color=blue + 288 [label="Enter when"]; + subgraph cluster_80 { + color=blue + 289 [label="Enter when branch condition "]; + 290 [label="Access variable R|/b|"]; + 291 [label="Access variable R|/a|"]; + 292 [label="Operator ==="]; + 293 [label="Exit when branch condition"]; + } + subgraph cluster_81 { + color=blue + 294 [label="Enter block"]; + 295 [label="Access variable R|/b|"]; + 296 [label="Function call: R|/b|.R|kotlin/Int.inc|()"]; + 297 [label="Exit block"]; + } + 298 [label="Exit when branch result"]; + subgraph cluster_82 { + color=blue + 299 [label="Enter when branch condition else"]; + 300 [label="Exit when branch condition"]; + } + subgraph cluster_83 { + color=blue + 301 [label="Enter block"]; + 302 [label="Exit block"]; + } + 303 [label="Exit when branch result"]; + 304 [label="Exit when"]; + } + 305 [label="Access variable R|/b|"]; + 306 [label="Function call: R|/b|.#()"]; + 307 [label="Exit block"]; + } + 308 [label="Exit function test_9" style="filled" fillcolor=red]; + } 229 -> {230}; 230 -> {231}; @@ -665,89 +890,153 @@ subgraph cluster_test_9 { 305 -> {306}; 306 -> {307}; 307 -> {308}; -} -subgraph cluster_test_10 { - 309 [shape=box label="Enter function test_10" style="filled"]; - 310 [shape=box label="Enter block"]; - 311 [shape=box label="Enter when"]; - 312 [shape=box label="Enter when branch condition "]; - 313 [shape=box label="Access variable R|/a|"]; - 314 [shape=box label="Access variable R|/b|"]; - 315 [shape=box label="Operator =="]; - 316 [shape=box label="Exit when branch condition"]; - 317 [shape=box label="Enter block"]; - 318 [shape=box label="Access variable R|/b|"]; - 319 [shape=box label="Function call: R|/b|.#()"]; - 320 [shape=box label="Exit block"]; - 321 [shape=box label="Exit when branch result"]; - 322 [shape=box label="Enter when branch condition else"]; - 323 [shape=box label="Exit when branch condition"]; - 324 [shape=box label="Enter block"]; - 325 [shape=box label="Exit block"]; - 326 [shape=box label="Exit when branch result"]; - 327 [shape=box label="Exit when"]; - 328 [shape=box label="Access variable R|/b|"]; - 329 [shape=box label="Function call: R|/b|.#()"]; - 330 [shape=box label="Enter when"]; - 331 [shape=box label="Enter when branch condition "]; - 332 [shape=box label="Access variable R|/a|"]; - 333 [shape=box label="Access variable R|/b|"]; - 334 [shape=box label="Operator ==="]; - 335 [shape=box label="Exit when branch condition"]; - 336 [shape=box label="Enter block"]; - 337 [shape=box label="Access variable R|/b|"]; - 338 [shape=box label="Function call: R|/b|.#()"]; - 339 [shape=box label="Exit block"]; - 340 [shape=box label="Exit when branch result"]; - 341 [shape=box label="Enter when branch condition else"]; - 342 [shape=box label="Exit when branch condition"]; - 343 [shape=box label="Enter block"]; - 344 [shape=box label="Exit block"]; - 345 [shape=box label="Exit when branch result"]; - 346 [shape=box label="Exit when"]; - 347 [shape=box label="Access variable R|/b|"]; - 348 [shape=box label="Function call: R|/b|.#()"]; - 349 [shape=box label="Enter when"]; - 350 [shape=box label="Enter when branch condition "]; - 351 [shape=box label="Access variable R|/b|"]; - 352 [shape=box label="Access variable R|/a|"]; - 353 [shape=box label="Operator =="]; - 354 [shape=box label="Exit when branch condition"]; - 355 [shape=box label="Enter block"]; - 356 [shape=box label="Access variable R|/b|"]; - 357 [shape=box label="Function call: R|/b|.#()"]; - 358 [shape=box label="Exit block"]; - 359 [shape=box label="Exit when branch result"]; - 360 [shape=box label="Enter when branch condition else"]; - 361 [shape=box label="Exit when branch condition"]; - 362 [shape=box label="Enter block"]; - 363 [shape=box label="Exit block"]; - 364 [shape=box label="Exit when branch result"]; - 365 [shape=box label="Exit when"]; - 366 [shape=box label="Access variable R|/b|"]; - 367 [shape=box label="Function call: R|/b|.#()"]; - 368 [shape=box label="Enter when"]; - 369 [shape=box label="Enter when branch condition "]; - 370 [shape=box label="Access variable R|/b|"]; - 371 [shape=box label="Access variable R|/a|"]; - 372 [shape=box label="Operator ==="]; - 373 [shape=box label="Exit when branch condition"]; - 374 [shape=box label="Enter block"]; - 375 [shape=box label="Access variable R|/b|"]; - 376 [shape=box label="Function call: R|/b|.#()"]; - 377 [shape=box label="Exit block"]; - 378 [shape=box label="Exit when branch result"]; - 379 [shape=box label="Enter when branch condition else"]; - 380 [shape=box label="Exit when branch condition"]; - 381 [shape=box label="Enter block"]; - 382 [shape=box label="Exit block"]; - 383 [shape=box label="Exit when branch result"]; - 384 [shape=box label="Exit when"]; - 385 [shape=box label="Access variable R|/b|"]; - 386 [shape=box label="Function call: R|/b|.#()"]; - 387 [shape=box label="Exit block"]; - 388 [shape=box label="Exit function test_10" style="filled"]; + subgraph cluster_84 { + color=red + 309 [label="Enter function test_10" style="filled" fillcolor=red]; + subgraph cluster_85 { + color=blue + 310 [label="Enter block"]; + subgraph cluster_86 { + color=blue + 311 [label="Enter when"]; + subgraph cluster_87 { + color=blue + 312 [label="Enter when branch condition "]; + 313 [label="Access variable R|/a|"]; + 314 [label="Access variable R|/b|"]; + 315 [label="Operator =="]; + 316 [label="Exit when branch condition"]; + } + subgraph cluster_88 { + color=blue + 317 [label="Enter block"]; + 318 [label="Access variable R|/b|"]; + 319 [label="Function call: R|/b|.#()"]; + 320 [label="Exit block"]; + } + 321 [label="Exit when branch result"]; + subgraph cluster_89 { + color=blue + 322 [label="Enter when branch condition else"]; + 323 [label="Exit when branch condition"]; + } + subgraph cluster_90 { + color=blue + 324 [label="Enter block"]; + 325 [label="Exit block"]; + } + 326 [label="Exit when branch result"]; + 327 [label="Exit when"]; + } + 328 [label="Access variable R|/b|"]; + 329 [label="Function call: R|/b|.#()"]; + subgraph cluster_91 { + color=blue + 330 [label="Enter when"]; + subgraph cluster_92 { + color=blue + 331 [label="Enter when branch condition "]; + 332 [label="Access variable R|/a|"]; + 333 [label="Access variable R|/b|"]; + 334 [label="Operator ==="]; + 335 [label="Exit when branch condition"]; + } + subgraph cluster_93 { + color=blue + 336 [label="Enter block"]; + 337 [label="Access variable R|/b|"]; + 338 [label="Function call: R|/b|.#()"]; + 339 [label="Exit block"]; + } + 340 [label="Exit when branch result"]; + subgraph cluster_94 { + color=blue + 341 [label="Enter when branch condition else"]; + 342 [label="Exit when branch condition"]; + } + subgraph cluster_95 { + color=blue + 343 [label="Enter block"]; + 344 [label="Exit block"]; + } + 345 [label="Exit when branch result"]; + 346 [label="Exit when"]; + } + 347 [label="Access variable R|/b|"]; + 348 [label="Function call: R|/b|.#()"]; + subgraph cluster_96 { + color=blue + 349 [label="Enter when"]; + subgraph cluster_97 { + color=blue + 350 [label="Enter when branch condition "]; + 351 [label="Access variable R|/b|"]; + 352 [label="Access variable R|/a|"]; + 353 [label="Operator =="]; + 354 [label="Exit when branch condition"]; + } + subgraph cluster_98 { + color=blue + 355 [label="Enter block"]; + 356 [label="Access variable R|/b|"]; + 357 [label="Function call: R|/b|.#()"]; + 358 [label="Exit block"]; + } + 359 [label="Exit when branch result"]; + subgraph cluster_99 { + color=blue + 360 [label="Enter when branch condition else"]; + 361 [label="Exit when branch condition"]; + } + subgraph cluster_100 { + color=blue + 362 [label="Enter block"]; + 363 [label="Exit block"]; + } + 364 [label="Exit when branch result"]; + 365 [label="Exit when"]; + } + 366 [label="Access variable R|/b|"]; + 367 [label="Function call: R|/b|.#()"]; + subgraph cluster_101 { + color=blue + 368 [label="Enter when"]; + subgraph cluster_102 { + color=blue + 369 [label="Enter when branch condition "]; + 370 [label="Access variable R|/b|"]; + 371 [label="Access variable R|/a|"]; + 372 [label="Operator ==="]; + 373 [label="Exit when branch condition"]; + } + subgraph cluster_103 { + color=blue + 374 [label="Enter block"]; + 375 [label="Access variable R|/b|"]; + 376 [label="Function call: R|/b|.#()"]; + 377 [label="Exit block"]; + } + 378 [label="Exit when branch result"]; + subgraph cluster_104 { + color=blue + 379 [label="Enter when branch condition else"]; + 380 [label="Exit when branch condition"]; + } + subgraph cluster_105 { + color=blue + 381 [label="Enter block"]; + 382 [label="Exit block"]; + } + 383 [label="Exit when branch result"]; + 384 [label="Exit when"]; + } + 385 [label="Access variable R|/b|"]; + 386 [label="Function call: R|/b|.#()"]; + 387 [label="Exit block"]; + } + 388 [label="Exit function test_10" style="filled" fillcolor=red]; + } 309 -> {310}; 310 -> {311}; @@ -828,6 +1117,5 @@ subgraph cluster_test_10 { 385 -> {386}; 386 -> {387}; 387 -> {388}; -} } diff --git a/compiler/fir/resolve/testData/resolve/smartcasts/returns.dot b/compiler/fir/resolve/testData/resolve/smartcasts/returns.dot index 32885c08b9f..cf295f2d72f 100644 --- a/compiler/fir/resolve/testData/resolve/smartcasts/returns.dot +++ b/compiler/fir/resolve/testData/resolve/smartcasts/returns.dot @@ -1,29 +1,51 @@ digraph returns_kt { -graph [splines=ortho, nodesep=3] + graph [splines=ortho nodesep=3] + node [shape=box penwidth=2] + edge [penwidth=2] -subgraph cluster_test_0 { - 0 [shape=box label="Enter function test_0" style="filled"]; - 1 [shape=box label="Enter block"]; - 2 [shape=box label="Enter when"]; - 3 [shape=box label="Enter when branch condition "]; - 4 [shape=box label="Access variable R|/x|"]; - 5 [shape=box label="Type operator: x is String"]; - 6 [shape=box label="Exit when branch condition"]; - 7 [shape=box label="Enter block"]; - 8 [shape=box label="Access variable R|/x|"]; - 9 [shape=box label="Access variable R|kotlin/String.length|"]; - 10 [shape=box label="Exit block"]; - 11 [shape=box label="Exit when branch result"]; - 12 [shape=box label="Enter when branch condition else"]; - 13 [shape=box label="Exit when branch condition"]; - 14 [shape=box label="Enter block"]; - 15 [shape=box label="Exit block"]; - 16 [shape=box label="Exit when branch result"]; - 17 [shape=box label="Exit when"]; - 18 [shape=box label="Access variable R|/x|"]; - 19 [shape=box label="Access variable #"]; - 20 [shape=box label="Exit block"]; - 21 [shape=box label="Exit function test_0" style="filled"]; + subgraph cluster_0 { + color=red + 0 [label="Enter function test_0" style="filled" fillcolor=red]; + subgraph cluster_1 { + color=blue + 1 [label="Enter block"]; + subgraph cluster_2 { + color=blue + 2 [label="Enter when"]; + subgraph cluster_3 { + color=blue + 3 [label="Enter when branch condition "]; + 4 [label="Access variable R|/x|"]; + 5 [label="Type operator: x is String"]; + 6 [label="Exit when branch condition"]; + } + subgraph cluster_4 { + color=blue + 7 [label="Enter block"]; + 8 [label="Access variable R|/x|"]; + 9 [label="Access variable R|kotlin/String.length|"]; + 10 [label="Exit block"]; + } + 11 [label="Exit when branch result"]; + subgraph cluster_5 { + color=blue + 12 [label="Enter when branch condition else"]; + 13 [label="Exit when branch condition"]; + } + subgraph cluster_6 { + color=blue + 14 [label="Enter block"]; + 15 [label="Exit block"]; + } + 16 [label="Exit when branch result"]; + 17 [label="Exit when"]; + } + 18 [label="Access variable R|/x|"]; + 19 [label="Access variable #"]; + 20 [label="Exit block"]; + } + 21 [label="Exit function test_0" style="filled" fillcolor=red]; + } 0 -> {1}; 1 -> {2}; @@ -46,33 +68,52 @@ subgraph cluster_test_0 { 18 -> {19}; 19 -> {20}; 20 -> {21}; -} -subgraph cluster_test_1 { - 22 [shape=box label="Enter function test_1" style="filled"]; - 23 [shape=box label="Enter block"]; - 24 [shape=box label="Enter when"]; - 25 [shape=box label="Enter when branch condition "]; - 26 [shape=box label="Access variable R|/x|"]; - 27 [shape=box label="Type operator: x is String"]; - 28 [shape=box label="Exit when branch condition"]; - 29 [shape=box label="Enter block"]; - 30 [shape=box label="Access variable R|/x|"]; - 31 [shape=box label="Access variable R|kotlin/String.length|"]; - 32 [shape=box label="Exit block"]; - 33 [shape=box label="Exit when branch result"]; - 34 [shape=box label="Enter when branch condition else"]; - 35 [shape=box label="Exit when branch condition"]; - 36 [shape=box label="Enter block"]; - 37 [shape=box label="Jump: ^test_1 Unit"]; - 38 [shape=box label="Stub[DEAD]"]; - 39 [shape=box label="Exit block[DEAD]"]; - 40 [shape=box label="Exit when branch result[DEAD]"]; - 41 [shape=box label="Exit when"]; - 42 [shape=box label="Access variable R|/x|"]; - 43 [shape=box label="Access variable R|kotlin/String.length|"]; - 44 [shape=box label="Exit block"]; - 45 [shape=box label="Exit function test_1" style="filled"]; + subgraph cluster_7 { + color=red + 22 [label="Enter function test_1" style="filled" fillcolor=red]; + subgraph cluster_8 { + color=blue + 23 [label="Enter block"]; + subgraph cluster_9 { + color=blue + 24 [label="Enter when"]; + subgraph cluster_10 { + color=blue + 25 [label="Enter when branch condition "]; + 26 [label="Access variable R|/x|"]; + 27 [label="Type operator: x is String"]; + 28 [label="Exit when branch condition"]; + } + subgraph cluster_11 { + color=blue + 29 [label="Enter block"]; + 30 [label="Access variable R|/x|"]; + 31 [label="Access variable R|kotlin/String.length|"]; + 32 [label="Exit block"]; + } + 33 [label="Exit when branch result"]; + subgraph cluster_12 { + color=blue + 34 [label="Enter when branch condition else"]; + 35 [label="Exit when branch condition"]; + } + subgraph cluster_13 { + color=blue + 36 [label="Enter block"]; + 37 [label="Jump: ^test_1 Unit"]; + 38 [label="Stub" style="filled" fillcolor=gray]; + 39 [label="Exit block" style="filled" fillcolor=gray]; + } + 40 [label="Exit when branch result" style="filled" fillcolor=gray]; + 41 [label="Exit when"]; + } + 42 [label="Access variable R|/x|"]; + 43 [label="Access variable R|kotlin/String.length|"]; + 44 [label="Exit block"]; + } + 45 [label="Exit function test_1" style="filled" fillcolor=red]; + } 22 -> {23}; 23 -> {24}; @@ -98,67 +139,95 @@ subgraph cluster_test_1 { 42 -> {43}; 43 -> {44}; 44 -> {45}; -} -subgraph cluster_foo { - 46 [shape=box label="Enter function foo" style="filled"]; - 47 [shape=box label="Exit function foo" style="filled"]; + subgraph cluster_14 { + color=red + 46 [label="Enter function foo" style="filled" fillcolor=red]; + 47 [label="Exit function foo" style="filled" fillcolor=red]; + } 46 -> {47}; -} -subgraph cluster_bar { - 48 [shape=box label="Enter function bar" style="filled"]; - 49 [shape=box label="Exit function bar" style="filled"]; + subgraph cluster_15 { + color=red + 48 [label="Enter function bar" style="filled" fillcolor=red]; + 49 [label="Exit function bar" style="filled" fillcolor=red]; + } 48 -> {49}; -} -subgraph cluster_baz { - 50 [shape=box label="Enter function baz" style="filled"]; - 51 [shape=box label="Exit function baz" style="filled"]; + subgraph cluster_16 { + color=red + 50 [label="Enter function baz" style="filled" fillcolor=red]; + 51 [label="Exit function baz" style="filled" fillcolor=red]; + } 50 -> {51}; -} -subgraph cluster_test_2 { - 52 [shape=box label="Enter function test_2" style="filled"]; - 53 [shape=box label="Enter block"]; - 54 [shape=box label="Enter when"]; - 55 [shape=box label="Enter when branch condition "]; - 56 [shape=box label="Access variable R|/x|"]; - 57 [shape=box label="Type operator: x is B"]; - 58 [shape=box label="Exit when branch condition"]; - 59 [shape=box label="Enter block"]; - 60 [shape=box label="Access variable R|/x|"]; - 61 [shape=box label="Function call: R|/x|.R|/B.bar|()"]; - 62 [shape=box label="Exit block"]; - 63 [shape=box label="Exit when branch result"]; - 64 [shape=box label="Enter when branch condition "]; - 65 [shape=box label="Access variable R|/x|"]; - 66 [shape=box label="Type operator: x is C"]; - 67 [shape=box label="Exit when branch condition"]; - 68 [shape=box label="Enter block"]; - 69 [shape=box label="Access variable R|/x|"]; - 70 [shape=box label="Function call: R|/x|.R|/C.baz|()"]; - 71 [shape=box label="Exit block"]; - 72 [shape=box label="Exit when branch result"]; - 73 [shape=box label="Enter when branch condition else"]; - 74 [shape=box label="Exit when branch condition"]; - 75 [shape=box label="Enter block"]; - 76 [shape=box label="Jump: ^test_2 Unit"]; - 77 [shape=box label="Stub[DEAD]"]; - 78 [shape=box label="Exit block[DEAD]"]; - 79 [shape=box label="Exit when branch result[DEAD]"]; - 80 [shape=box label="Exit when"]; - 81 [shape=box label="Access variable R|/x|"]; - 82 [shape=box label="Function call: R|/x|.R|/A.foo|()"]; - 83 [shape=box label="Access variable R|/x|"]; - 84 [shape=box label="Function call: R|/x|.#()"]; - 85 [shape=box label="Access variable R|/x|"]; - 86 [shape=box label="Function call: R|/x|.#()"]; - 87 [shape=box label="Exit block"]; - 88 [shape=box label="Exit function test_2" style="filled"]; + subgraph cluster_17 { + color=red + 52 [label="Enter function test_2" style="filled" fillcolor=red]; + subgraph cluster_18 { + color=blue + 53 [label="Enter block"]; + subgraph cluster_19 { + color=blue + 54 [label="Enter when"]; + subgraph cluster_20 { + color=blue + 55 [label="Enter when branch condition "]; + 56 [label="Access variable R|/x|"]; + 57 [label="Type operator: x is B"]; + 58 [label="Exit when branch condition"]; + } + subgraph cluster_21 { + color=blue + 59 [label="Enter block"]; + 60 [label="Access variable R|/x|"]; + 61 [label="Function call: R|/x|.R|/B.bar|()"]; + 62 [label="Exit block"]; + } + 63 [label="Exit when branch result"]; + subgraph cluster_22 { + color=blue + 64 [label="Enter when branch condition "]; + 65 [label="Access variable R|/x|"]; + 66 [label="Type operator: x is C"]; + 67 [label="Exit when branch condition"]; + } + subgraph cluster_23 { + color=blue + 68 [label="Enter block"]; + 69 [label="Access variable R|/x|"]; + 70 [label="Function call: R|/x|.R|/C.baz|()"]; + 71 [label="Exit block"]; + } + 72 [label="Exit when branch result"]; + subgraph cluster_24 { + color=blue + 73 [label="Enter when branch condition else"]; + 74 [label="Exit when branch condition"]; + } + subgraph cluster_25 { + color=blue + 75 [label="Enter block"]; + 76 [label="Jump: ^test_2 Unit"]; + 77 [label="Stub" style="filled" fillcolor=gray]; + 78 [label="Exit block" style="filled" fillcolor=gray]; + } + 79 [label="Exit when branch result" style="filled" fillcolor=gray]; + 80 [label="Exit when"]; + } + 81 [label="Access variable R|/x|"]; + 82 [label="Function call: R|/x|.R|/A.foo|()"]; + 83 [label="Access variable R|/x|"]; + 84 [label="Function call: R|/x|.#()"]; + 85 [label="Access variable R|/x|"]; + 86 [label="Function call: R|/x|.#()"]; + 87 [label="Exit block"]; + } + 88 [label="Exit function test_2" style="filled" fillcolor=red]; + } 52 -> {53}; 53 -> {54}; @@ -197,44 +266,69 @@ subgraph cluster_test_2 { 85 -> {86}; 86 -> {87}; 87 -> {88}; -} -subgraph cluster_test_3 { - 89 [shape=box label="Enter function test_3" style="filled"]; - 90 [shape=box label="Enter block"]; - 91 [shape=box label="Enter when"]; - 92 [shape=box label="Enter when branch condition "]; - 93 [shape=box label="Access variable R|/x|"]; - 94 [shape=box label="Type operator: x is B"]; - 95 [shape=box label="Exit when branch condition"]; - 96 [shape=box label="Enter block"]; - 97 [shape=box label="Access variable R|/x|"]; - 98 [shape=box label="Function call: R|/x|.R|/B.bar|()"]; - 99 [shape=box label="Exit block"]; - 100 [shape=box label="Exit when branch result"]; - 101 [shape=box label="Enter when branch condition "]; - 102 [shape=box label="Access variable R|/x|"]; - 103 [shape=box label="Type operator: x is C"]; - 104 [shape=box label="Exit when branch condition"]; - 105 [shape=box label="Enter block"]; - 106 [shape=box label="Access variable R|/x|"]; - 107 [shape=box label="Function call: R|/x|.R|/C.baz|()"]; - 108 [shape=box label="Exit block"]; - 109 [shape=box label="Exit when branch result"]; - 110 [shape=box label="Enter when branch condition else"]; - 111 [shape=box label="Exit when branch condition"]; - 112 [shape=box label="Enter block"]; - 113 [shape=box label="Exit block"]; - 114 [shape=box label="Exit when branch result"]; - 115 [shape=box label="Exit when"]; - 116 [shape=box label="Access variable R|/x|"]; - 117 [shape=box label="Function call: R|/x|.#()"]; - 118 [shape=box label="Access variable R|/x|"]; - 119 [shape=box label="Function call: R|/x|.#()"]; - 120 [shape=box label="Access variable R|/x|"]; - 121 [shape=box label="Function call: R|/x|.#()"]; - 122 [shape=box label="Exit block"]; - 123 [shape=box label="Exit function test_3" style="filled"]; + subgraph cluster_26 { + color=red + 89 [label="Enter function test_3" style="filled" fillcolor=red]; + subgraph cluster_27 { + color=blue + 90 [label="Enter block"]; + subgraph cluster_28 { + color=blue + 91 [label="Enter when"]; + subgraph cluster_29 { + color=blue + 92 [label="Enter when branch condition "]; + 93 [label="Access variable R|/x|"]; + 94 [label="Type operator: x is B"]; + 95 [label="Exit when branch condition"]; + } + subgraph cluster_30 { + color=blue + 96 [label="Enter block"]; + 97 [label="Access variable R|/x|"]; + 98 [label="Function call: R|/x|.R|/B.bar|()"]; + 99 [label="Exit block"]; + } + 100 [label="Exit when branch result"]; + subgraph cluster_31 { + color=blue + 101 [label="Enter when branch condition "]; + 102 [label="Access variable R|/x|"]; + 103 [label="Type operator: x is C"]; + 104 [label="Exit when branch condition"]; + } + subgraph cluster_32 { + color=blue + 105 [label="Enter block"]; + 106 [label="Access variable R|/x|"]; + 107 [label="Function call: R|/x|.R|/C.baz|()"]; + 108 [label="Exit block"]; + } + 109 [label="Exit when branch result"]; + subgraph cluster_33 { + color=blue + 110 [label="Enter when branch condition else"]; + 111 [label="Exit when branch condition"]; + } + subgraph cluster_34 { + color=blue + 112 [label="Enter block"]; + 113 [label="Exit block"]; + } + 114 [label="Exit when branch result"]; + 115 [label="Exit when"]; + } + 116 [label="Access variable R|/x|"]; + 117 [label="Function call: R|/x|.#()"]; + 118 [label="Access variable R|/x|"]; + 119 [label="Function call: R|/x|.#()"]; + 120 [label="Access variable R|/x|"]; + 121 [label="Function call: R|/x|.#()"]; + 122 [label="Exit block"]; + } + 123 [label="Exit function test_3" style="filled" fillcolor=red]; + } 89 -> {90}; 90 -> {91}; @@ -270,6 +364,5 @@ subgraph cluster_test_3 { 120 -> {121}; 121 -> {122}; 122 -> {123}; -} } diff --git a/compiler/fir/resolve/testData/resolve/smartcasts/simpleIf.dot b/compiler/fir/resolve/testData/resolve/smartcasts/simpleIf.dot index 8f0a7603c38..b3d68e74ab0 100644 --- a/compiler/fir/resolve/testData/resolve/smartcasts/simpleIf.dot +++ b/compiler/fir/resolve/testData/resolve/smartcasts/simpleIf.dot @@ -1,29 +1,51 @@ digraph simpleIf_kt { -graph [splines=ortho, nodesep=3] + graph [splines=ortho nodesep=3] + node [shape=box penwidth=2] + edge [penwidth=2] -subgraph cluster_test_1 { - 0 [shape=box label="Enter function test_1" style="filled"]; - 1 [shape=box label="Enter block"]; - 2 [shape=box label="Enter when"]; - 3 [shape=box label="Enter when branch condition "]; - 4 [shape=box label="Access variable R|/x|"]; - 5 [shape=box label="Type operator: x is String"]; - 6 [shape=box label="Exit when branch condition"]; - 7 [shape=box label="Enter block"]; - 8 [shape=box label="Access variable R|/x|"]; - 9 [shape=box label="Access variable R|kotlin/String.length|"]; - 10 [shape=box label="Exit block"]; - 11 [shape=box label="Exit when branch result"]; - 12 [shape=box label="Enter when branch condition else"]; - 13 [shape=box label="Exit when branch condition"]; - 14 [shape=box label="Enter block"]; - 15 [shape=box label="Exit block"]; - 16 [shape=box label="Exit when branch result"]; - 17 [shape=box label="Exit when"]; - 18 [shape=box label="Access variable R|/x|"]; - 19 [shape=box label="Access variable #"]; - 20 [shape=box label="Exit block"]; - 21 [shape=box label="Exit function test_1" style="filled"]; + subgraph cluster_0 { + color=red + 0 [label="Enter function test_1" style="filled" fillcolor=red]; + subgraph cluster_1 { + color=blue + 1 [label="Enter block"]; + subgraph cluster_2 { + color=blue + 2 [label="Enter when"]; + subgraph cluster_3 { + color=blue + 3 [label="Enter when branch condition "]; + 4 [label="Access variable R|/x|"]; + 5 [label="Type operator: x is String"]; + 6 [label="Exit when branch condition"]; + } + subgraph cluster_4 { + color=blue + 7 [label="Enter block"]; + 8 [label="Access variable R|/x|"]; + 9 [label="Access variable R|kotlin/String.length|"]; + 10 [label="Exit block"]; + } + 11 [label="Exit when branch result"]; + subgraph cluster_5 { + color=blue + 12 [label="Enter when branch condition else"]; + 13 [label="Exit when branch condition"]; + } + subgraph cluster_6 { + color=blue + 14 [label="Enter block"]; + 15 [label="Exit block"]; + } + 16 [label="Exit when branch result"]; + 17 [label="Exit when"]; + } + 18 [label="Access variable R|/x|"]; + 19 [label="Access variable #"]; + 20 [label="Exit block"]; + } + 21 [label="Exit function test_1" style="filled" fillcolor=red]; + } 0 -> {1}; 1 -> {2}; @@ -46,33 +68,52 @@ subgraph cluster_test_1 { 18 -> {19}; 19 -> {20}; 20 -> {21}; -} -subgraph cluster_test_2 { - 22 [shape=box label="Enter function test_2" style="filled"]; - 23 [shape=box label="Enter block"]; - 24 [shape=box label="Access variable R|/x|"]; - 25 [shape=box label="Type operator: x is String"]; - 26 [shape=box label="Variable declaration: lval b: R|kotlin/Boolean|"]; - 27 [shape=box label="Enter when"]; - 28 [shape=box label="Enter when branch condition "]; - 29 [shape=box label="Access variable R|/b|"]; - 30 [shape=box label="Exit when branch condition"]; - 31 [shape=box label="Enter block"]; - 32 [shape=box label="Access variable R|/x|"]; - 33 [shape=box label="Access variable R|kotlin/String.length|"]; - 34 [shape=box label="Exit block"]; - 35 [shape=box label="Exit when branch result"]; - 36 [shape=box label="Enter when branch condition else"]; - 37 [shape=box label="Exit when branch condition"]; - 38 [shape=box label="Enter block"]; - 39 [shape=box label="Exit block"]; - 40 [shape=box label="Exit when branch result"]; - 41 [shape=box label="Exit when"]; - 42 [shape=box label="Access variable R|/x|"]; - 43 [shape=box label="Access variable #"]; - 44 [shape=box label="Exit block"]; - 45 [shape=box label="Exit function test_2" style="filled"]; + subgraph cluster_7 { + color=red + 22 [label="Enter function test_2" style="filled" fillcolor=red]; + subgraph cluster_8 { + color=blue + 23 [label="Enter block"]; + 24 [label="Access variable R|/x|"]; + 25 [label="Type operator: x is String"]; + 26 [label="Variable declaration: lval b: R|kotlin/Boolean|"]; + subgraph cluster_9 { + color=blue + 27 [label="Enter when"]; + subgraph cluster_10 { + color=blue + 28 [label="Enter when branch condition "]; + 29 [label="Access variable R|/b|"]; + 30 [label="Exit when branch condition"]; + } + subgraph cluster_11 { + color=blue + 31 [label="Enter block"]; + 32 [label="Access variable R|/x|"]; + 33 [label="Access variable R|kotlin/String.length|"]; + 34 [label="Exit block"]; + } + 35 [label="Exit when branch result"]; + subgraph cluster_12 { + color=blue + 36 [label="Enter when branch condition else"]; + 37 [label="Exit when branch condition"]; + } + subgraph cluster_13 { + color=blue + 38 [label="Enter block"]; + 39 [label="Exit block"]; + } + 40 [label="Exit when branch result"]; + 41 [label="Exit when"]; + } + 42 [label="Access variable R|/x|"]; + 43 [label="Access variable #"]; + 44 [label="Exit block"]; + } + 45 [label="Exit function test_2" style="filled" fillcolor=red]; + } 22 -> {23}; 23 -> {24}; @@ -97,38 +138,63 @@ subgraph cluster_test_2 { 42 -> {43}; 43 -> {44}; 44 -> {45}; -} -subgraph cluster_test_3 { - 46 [shape=box label="Enter function test_3" style="filled"]; - 47 [shape=box label="Enter block"]; - 48 [shape=box label="Enter when"]; - 49 [shape=box label="Enter when branch condition "]; - 50 [shape=box label="Access variable R|/x|"]; - 51 [shape=box label="Type operator: x !is String"]; - 52 [shape=box label="Exit when branch condition"]; - 53 [shape=box label="Enter block"]; - 54 [shape=box label="Exit block"]; - 55 [shape=box label="Exit when branch result"]; - 56 [shape=box label="Enter when branch condition "]; - 57 [shape=box label="Access variable R|/x|"]; - 58 [shape=box label="Type operator: x !is Int"]; - 59 [shape=box label="Exit when branch condition"]; - 60 [shape=box label="Enter block"]; - 61 [shape=box label="Exit block"]; - 62 [shape=box label="Exit when branch result"]; - 63 [shape=box label="Enter when branch condition else"]; - 64 [shape=box label="Exit when branch condition"]; - 65 [shape=box label="Enter block"]; - 66 [shape=box label="Access variable R|/x|"]; - 67 [shape=box label="Access variable R|kotlin/String.length|"]; - 68 [shape=box label="Access variable R|/x|"]; - 69 [shape=box label="Function call: R|/x|.R|kotlin/Int.inc|()"]; - 70 [shape=box label="Exit block"]; - 71 [shape=box label="Exit when branch result"]; - 72 [shape=box label="Exit when"]; - 73 [shape=box label="Exit block"]; - 74 [shape=box label="Exit function test_3" style="filled"]; + subgraph cluster_14 { + color=red + 46 [label="Enter function test_3" style="filled" fillcolor=red]; + subgraph cluster_15 { + color=blue + 47 [label="Enter block"]; + subgraph cluster_16 { + color=blue + 48 [label="Enter when"]; + subgraph cluster_17 { + color=blue + 49 [label="Enter when branch condition "]; + 50 [label="Access variable R|/x|"]; + 51 [label="Type operator: x !is String"]; + 52 [label="Exit when branch condition"]; + } + subgraph cluster_18 { + color=blue + 53 [label="Enter block"]; + 54 [label="Exit block"]; + } + 55 [label="Exit when branch result"]; + subgraph cluster_19 { + color=blue + 56 [label="Enter when branch condition "]; + 57 [label="Access variable R|/x|"]; + 58 [label="Type operator: x !is Int"]; + 59 [label="Exit when branch condition"]; + } + subgraph cluster_20 { + color=blue + 60 [label="Enter block"]; + 61 [label="Exit block"]; + } + 62 [label="Exit when branch result"]; + subgraph cluster_21 { + color=blue + 63 [label="Enter when branch condition else"]; + 64 [label="Exit when branch condition"]; + } + subgraph cluster_22 { + color=blue + 65 [label="Enter block"]; + 66 [label="Access variable R|/x|"]; + 67 [label="Access variable R|kotlin/String.length|"]; + 68 [label="Access variable R|/x|"]; + 69 [label="Function call: R|/x|.R|kotlin/Int.inc|()"]; + 70 [label="Exit block"]; + } + 71 [label="Exit when branch result"]; + 72 [label="Exit when"]; + } + 73 [label="Exit block"]; + } + 74 [label="Exit function test_3" style="filled" fillcolor=red]; + } 46 -> {47}; 47 -> {48}; @@ -158,6 +224,5 @@ subgraph cluster_test_3 { 71 -> {72}; 72 -> {73}; 73 -> {74}; -} } diff --git a/compiler/fir/resolve/testData/resolve/smartcasts/when.dot b/compiler/fir/resolve/testData/resolve/smartcasts/when.dot index bfa875d621e..9664c4fb88a 100644 --- a/compiler/fir/resolve/testData/resolve/smartcasts/when.dot +++ b/compiler/fir/resolve/testData/resolve/smartcasts/when.dot @@ -1,90 +1,147 @@ digraph when_kt { -graph [splines=ortho, nodesep=3] + graph [splines=ortho nodesep=3] + node [shape=box penwidth=2] + edge [penwidth=2] -subgraph cluster_foo { - 0 [shape=box label="Enter function foo" style="filled"]; - 1 [shape=box label="Exit function foo" style="filled"]; + subgraph cluster_0 { + color=red + 0 [label="Enter function foo" style="filled" fillcolor=red]; + 1 [label="Exit function foo" style="filled" fillcolor=red]; + } 0 -> {1}; -} -subgraph cluster_bar { - 2 [shape=box label="Enter function bar" style="filled"]; - 3 [shape=box label="Exit function bar" style="filled"]; + subgraph cluster_1 { + color=red + 2 [label="Enter function bar" style="filled" fillcolor=red]; + 3 [label="Exit function bar" style="filled" fillcolor=red]; + } 2 -> {3}; -} -subgraph cluster_test_1 { - 4 [shape=box label="Enter function test_1" style="filled"]; - 5 [shape=box label="Enter block"]; - 6 [shape=box label="Enter when"]; - 7 [shape=box label="Enter when branch condition "]; - 8 [shape=box label="Access variable R|/x|"]; - 9 [shape=box label="Type operator: x is A"]; - 10 [shape=box label="Exit when branch condition"]; - 11 [shape=box label="Enter block"]; - 12 [shape=box label="Access variable R|/x|"]; - 13 [shape=box label="Function call: R|/x|.R|/A.foo|()"]; - 14 [shape=box label="Exit block"]; - 15 [shape=box label="Exit when branch result"]; - 16 [shape=box label="Enter when branch condition "]; - 17 [shape=box label="Access variable R|/x|"]; - 18 [shape=box label="Type operator: x is B"]; - 19 [shape=box label="Exit when branch condition"]; - 20 [shape=box label="Enter block"]; - 21 [shape=box label="Access variable R|/x|"]; - 22 [shape=box label="Function call: R|/x|.R|/B.bar|()"]; - 23 [shape=box label="Exit block"]; - 24 [shape=box label="Exit when branch result"]; - 25 [shape=box label="Enter when branch condition else"]; - 26 [shape=box label="Exit when branch condition"]; - 27 [shape=box label="Enter block"]; - 28 [shape=box label="Exit block"]; - 29 [shape=box label="Exit when branch result"]; - 30 [shape=box label="Exit when"]; - 31 [shape=box label="Enter when"]; - 32 [shape=box label="Enter when branch condition "]; - 33 [shape=box label="Access variable R|/x|"]; - 34 [shape=box label="Type operator: x !is A"]; - 35 [shape=box label="Exit when branch condition"]; - 36 [shape=box label="Enter block"]; - 37 [shape=box label="Exit block"]; - 38 [shape=box label="Exit when branch result"]; - 39 [shape=box label="Enter when branch condition "]; - 40 [shape=box label="Access variable R|/x|"]; - 41 [shape=box label="Type operator: x !is B"]; - 42 [shape=box label="Exit when branch condition"]; - 43 [shape=box label="Enter block"]; - 44 [shape=box label="Access variable R|/x|"]; - 45 [shape=box label="Function call: R|/x|.R|/A.foo|()"]; - 46 [shape=box label="Exit block"]; - 47 [shape=box label="Exit when branch result"]; - 48 [shape=box label="Enter when branch condition "]; - 49 [shape=box label="Access variable R|/x|"]; - 50 [shape=box label="Type operator: x is Int"]; - 51 [shape=box label="Exit when branch condition"]; - 52 [shape=box label="Enter block"]; - 53 [shape=box label="Access variable R|/x|"]; - 54 [shape=box label="Function call: R|/x|.R|/A.foo|()"]; - 55 [shape=box label="Access variable R|/x|"]; - 56 [shape=box label="Function call: R|/x|.R|/B.bar|()"]; - 57 [shape=box label="Access variable R|/x|"]; - 58 [shape=box label="Function call: R|/x|.R|kotlin/Int.inc|()"]; - 59 [shape=box label="Exit block"]; - 60 [shape=box label="Exit when branch result"]; - 61 [shape=box label="Enter when branch condition else"]; - 62 [shape=box label="Exit when branch condition"]; - 63 [shape=box label="Enter block"]; - 64 [shape=box label="Access variable R|/x|"]; - 65 [shape=box label="Function call: R|/x|.R|/A.foo|()"]; - 66 [shape=box label="Access variable R|/x|"]; - 67 [shape=box label="Function call: R|/x|.R|/B.bar|()"]; - 68 [shape=box label="Exit block"]; - 69 [shape=box label="Exit when branch result"]; - 70 [shape=box label="Exit when"]; - 71 [shape=box label="Exit block"]; - 72 [shape=box label="Exit function test_1" style="filled"]; + subgraph cluster_2 { + color=red + 4 [label="Enter function test_1" style="filled" fillcolor=red]; + subgraph cluster_3 { + color=blue + 5 [label="Enter block"]; + subgraph cluster_4 { + color=blue + 6 [label="Enter when"]; + subgraph cluster_5 { + color=blue + 7 [label="Enter when branch condition "]; + 8 [label="Access variable R|/x|"]; + 9 [label="Type operator: x is A"]; + 10 [label="Exit when branch condition"]; + } + subgraph cluster_6 { + color=blue + 11 [label="Enter block"]; + 12 [label="Access variable R|/x|"]; + 13 [label="Function call: R|/x|.R|/A.foo|()"]; + 14 [label="Exit block"]; + } + 15 [label="Exit when branch result"]; + subgraph cluster_7 { + color=blue + 16 [label="Enter when branch condition "]; + 17 [label="Access variable R|/x|"]; + 18 [label="Type operator: x is B"]; + 19 [label="Exit when branch condition"]; + } + subgraph cluster_8 { + color=blue + 20 [label="Enter block"]; + 21 [label="Access variable R|/x|"]; + 22 [label="Function call: R|/x|.R|/B.bar|()"]; + 23 [label="Exit block"]; + } + 24 [label="Exit when branch result"]; + subgraph cluster_9 { + color=blue + 25 [label="Enter when branch condition else"]; + 26 [label="Exit when branch condition"]; + } + subgraph cluster_10 { + color=blue + 27 [label="Enter block"]; + 28 [label="Exit block"]; + } + 29 [label="Exit when branch result"]; + 30 [label="Exit when"]; + } + subgraph cluster_11 { + color=blue + 31 [label="Enter when"]; + subgraph cluster_12 { + color=blue + 32 [label="Enter when branch condition "]; + 33 [label="Access variable R|/x|"]; + 34 [label="Type operator: x !is A"]; + 35 [label="Exit when branch condition"]; + } + subgraph cluster_13 { + color=blue + 36 [label="Enter block"]; + 37 [label="Exit block"]; + } + 38 [label="Exit when branch result"]; + subgraph cluster_14 { + color=blue + 39 [label="Enter when branch condition "]; + 40 [label="Access variable R|/x|"]; + 41 [label="Type operator: x !is B"]; + 42 [label="Exit when branch condition"]; + } + subgraph cluster_15 { + color=blue + 43 [label="Enter block"]; + 44 [label="Access variable R|/x|"]; + 45 [label="Function call: R|/x|.R|/A.foo|()"]; + 46 [label="Exit block"]; + } + 47 [label="Exit when branch result"]; + subgraph cluster_16 { + color=blue + 48 [label="Enter when branch condition "]; + 49 [label="Access variable R|/x|"]; + 50 [label="Type operator: x is Int"]; + 51 [label="Exit when branch condition"]; + } + subgraph cluster_17 { + color=blue + 52 [label="Enter block"]; + 53 [label="Access variable R|/x|"]; + 54 [label="Function call: R|/x|.R|/A.foo|()"]; + 55 [label="Access variable R|/x|"]; + 56 [label="Function call: R|/x|.R|/B.bar|()"]; + 57 [label="Access variable R|/x|"]; + 58 [label="Function call: R|/x|.R|kotlin/Int.inc|()"]; + 59 [label="Exit block"]; + } + 60 [label="Exit when branch result"]; + subgraph cluster_18 { + color=blue + 61 [label="Enter when branch condition else"]; + 62 [label="Exit when branch condition"]; + } + subgraph cluster_19 { + color=blue + 63 [label="Enter block"]; + 64 [label="Access variable R|/x|"]; + 65 [label="Function call: R|/x|.R|/A.foo|()"]; + 66 [label="Access variable R|/x|"]; + 67 [label="Function call: R|/x|.R|/B.bar|()"]; + 68 [label="Exit block"]; + } + 69 [label="Exit when branch result"]; + 70 [label="Exit when"]; + } + 71 [label="Exit block"]; + } + 72 [label="Exit function test_1" style="filled" fillcolor=red]; + } 4 -> {5}; 5 -> {6}; @@ -154,75 +211,127 @@ subgraph cluster_test_1 { 69 -> {70}; 70 -> {71}; 71 -> {72}; -} -subgraph cluster_test_2 { - 73 [shape=box label="Enter function test_2" style="filled"]; - 74 [shape=box label="Enter block"]; - 75 [shape=box label="Enter when"]; - 76 [shape=box label="Access variable R|/x|"]; - 77 [shape=box label="Enter when branch condition "]; - 78 [shape=box label="Type operator: A"]; - 79 [shape=box label="Exit when branch condition"]; - 80 [shape=box label="Enter block"]; - 81 [shape=box label="Access variable R|/x|"]; - 82 [shape=box label="Function call: R|/x|.R|/A.foo|()"]; - 83 [shape=box label="Exit block"]; - 84 [shape=box label="Exit when branch result"]; - 85 [shape=box label="Enter when branch condition "]; - 86 [shape=box label="Type operator: B"]; - 87 [shape=box label="Exit when branch condition"]; - 88 [shape=box label="Enter block"]; - 89 [shape=box label="Access variable R|/x|"]; - 90 [shape=box label="Function call: R|/x|.R|/B.bar|()"]; - 91 [shape=box label="Exit block"]; - 92 [shape=box label="Exit when branch result"]; - 93 [shape=box label="Enter when branch condition else"]; - 94 [shape=box label="Exit when branch condition"]; - 95 [shape=box label="Enter block"]; - 96 [shape=box label="Exit block"]; - 97 [shape=box label="Exit when branch result"]; - 98 [shape=box label="Exit when"]; - 99 [shape=box label="Enter when"]; - 100 [shape=box label="Access variable R|/x|"]; - 101 [shape=box label="Enter when branch condition "]; - 102 [shape=box label="Type operator: A"]; - 103 [shape=box label="Exit when branch condition"]; - 104 [shape=box label="Enter block"]; - 105 [shape=box label="Exit block"]; - 106 [shape=box label="Exit when branch result"]; - 107 [shape=box label="Enter when branch condition "]; - 108 [shape=box label="Type operator: B"]; - 109 [shape=box label="Exit when branch condition"]; - 110 [shape=box label="Enter block"]; - 111 [shape=box label="Access variable R|/x|"]; - 112 [shape=box label="Function call: R|/x|.R|/A.foo|()"]; - 113 [shape=box label="Exit block"]; - 114 [shape=box label="Exit when branch result"]; - 115 [shape=box label="Enter when branch condition "]; - 116 [shape=box label="Type operator: Int"]; - 117 [shape=box label="Exit when branch condition"]; - 118 [shape=box label="Enter block"]; - 119 [shape=box label="Access variable R|/x|"]; - 120 [shape=box label="Function call: R|/x|.R|/A.foo|()"]; - 121 [shape=box label="Access variable R|/x|"]; - 122 [shape=box label="Function call: R|/x|.R|/B.bar|()"]; - 123 [shape=box label="Access variable R|/x|"]; - 124 [shape=box label="Function call: R|/x|.R|kotlin/Int.inc|()"]; - 125 [shape=box label="Exit block"]; - 126 [shape=box label="Exit when branch result"]; - 127 [shape=box label="Enter when branch condition else"]; - 128 [shape=box label="Exit when branch condition"]; - 129 [shape=box label="Enter block"]; - 130 [shape=box label="Access variable R|/x|"]; - 131 [shape=box label="Function call: R|/x|.R|/A.foo|()"]; - 132 [shape=box label="Access variable R|/x|"]; - 133 [shape=box label="Function call: R|/x|.R|/B.bar|()"]; - 134 [shape=box label="Exit block"]; - 135 [shape=box label="Exit when branch result"]; - 136 [shape=box label="Exit when"]; - 137 [shape=box label="Exit block"]; - 138 [shape=box label="Exit function test_2" style="filled"]; + subgraph cluster_20 { + color=red + 73 [label="Enter function test_2" style="filled" fillcolor=red]; + subgraph cluster_21 { + color=blue + 74 [label="Enter block"]; + subgraph cluster_22 { + color=blue + 75 [label="Enter when"]; + 76 [label="Access variable R|/x|"]; + subgraph cluster_23 { + color=blue + 77 [label="Enter when branch condition "]; + 78 [label="Type operator: A"]; + 79 [label="Exit when branch condition"]; + } + subgraph cluster_24 { + color=blue + 80 [label="Enter block"]; + 81 [label="Access variable R|/x|"]; + 82 [label="Function call: R|/x|.R|/A.foo|()"]; + 83 [label="Exit block"]; + } + 84 [label="Exit when branch result"]; + subgraph cluster_25 { + color=blue + 85 [label="Enter when branch condition "]; + 86 [label="Type operator: B"]; + 87 [label="Exit when branch condition"]; + } + subgraph cluster_26 { + color=blue + 88 [label="Enter block"]; + 89 [label="Access variable R|/x|"]; + 90 [label="Function call: R|/x|.R|/B.bar|()"]; + 91 [label="Exit block"]; + } + 92 [label="Exit when branch result"]; + subgraph cluster_27 { + color=blue + 93 [label="Enter when branch condition else"]; + 94 [label="Exit when branch condition"]; + } + subgraph cluster_28 { + color=blue + 95 [label="Enter block"]; + 96 [label="Exit block"]; + } + 97 [label="Exit when branch result"]; + 98 [label="Exit when"]; + } + subgraph cluster_29 { + color=blue + 99 [label="Enter when"]; + 100 [label="Access variable R|/x|"]; + subgraph cluster_30 { + color=blue + 101 [label="Enter when branch condition "]; + 102 [label="Type operator: A"]; + 103 [label="Exit when branch condition"]; + } + subgraph cluster_31 { + color=blue + 104 [label="Enter block"]; + 105 [label="Exit block"]; + } + 106 [label="Exit when branch result"]; + subgraph cluster_32 { + color=blue + 107 [label="Enter when branch condition "]; + 108 [label="Type operator: B"]; + 109 [label="Exit when branch condition"]; + } + subgraph cluster_33 { + color=blue + 110 [label="Enter block"]; + 111 [label="Access variable R|/x|"]; + 112 [label="Function call: R|/x|.R|/A.foo|()"]; + 113 [label="Exit block"]; + } + 114 [label="Exit when branch result"]; + subgraph cluster_34 { + color=blue + 115 [label="Enter when branch condition "]; + 116 [label="Type operator: Int"]; + 117 [label="Exit when branch condition"]; + } + subgraph cluster_35 { + color=blue + 118 [label="Enter block"]; + 119 [label="Access variable R|/x|"]; + 120 [label="Function call: R|/x|.R|/A.foo|()"]; + 121 [label="Access variable R|/x|"]; + 122 [label="Function call: R|/x|.R|/B.bar|()"]; + 123 [label="Access variable R|/x|"]; + 124 [label="Function call: R|/x|.R|kotlin/Int.inc|()"]; + 125 [label="Exit block"]; + } + 126 [label="Exit when branch result"]; + subgraph cluster_36 { + color=blue + 127 [label="Enter when branch condition else"]; + 128 [label="Exit when branch condition"]; + } + subgraph cluster_37 { + color=blue + 129 [label="Enter block"]; + 130 [label="Access variable R|/x|"]; + 131 [label="Function call: R|/x|.R|/A.foo|()"]; + 132 [label="Access variable R|/x|"]; + 133 [label="Function call: R|/x|.R|/B.bar|()"]; + 134 [label="Exit block"]; + } + 135 [label="Exit when branch result"]; + 136 [label="Exit when"]; + } + 137 [label="Exit block"]; + } + 138 [label="Exit function test_2" style="filled" fillcolor=red]; + } 73 -> {74}; 74 -> {75}; @@ -289,93 +398,145 @@ subgraph cluster_test_2 { 135 -> {136}; 136 -> {137}; 137 -> {138}; -} -subgraph cluster_test_3 { - 139 [shape=box label="Enter function test_3" style="filled"]; - 140 [shape=box label="Enter block"]; - 141 [shape=box label="Enter when"]; - 142 [shape=box label="Access variable R|/x|"]; - 143 [shape=box label="Variable declaration: lval y: R|kotlin/Any?|"]; - 144 [shape=box label="Enter when branch condition "]; - 145 [shape=box label="Type operator: A"]; - 146 [shape=box label="Exit when branch condition"]; - 147 [shape=box label="Enter block"]; - 148 [shape=box label="Access variable R|/x|"]; - 149 [shape=box label="Function call: R|/x|.R|/A.foo|()"]; - 150 [shape=box label="Access variable R|/y|"]; - 151 [shape=box label="Function call: R|/y|.R|/A.foo|()"]; - 152 [shape=box label="Exit block"]; - 153 [shape=box label="Exit when branch result"]; - 154 [shape=box label="Enter when branch condition "]; - 155 [shape=box label="Type operator: B"]; - 156 [shape=box label="Exit when branch condition"]; - 157 [shape=box label="Enter block"]; - 158 [shape=box label="Access variable R|/x|"]; - 159 [shape=box label="Function call: R|/x|.R|/B.bar|()"]; - 160 [shape=box label="Access variable R|/y|"]; - 161 [shape=box label="Function call: R|/y|.R|/B.bar|()"]; - 162 [shape=box label="Exit block"]; - 163 [shape=box label="Exit when branch result"]; - 164 [shape=box label="Enter when branch condition else"]; - 165 [shape=box label="Exit when branch condition"]; - 166 [shape=box label="Enter block"]; - 167 [shape=box label="Exit block"]; - 168 [shape=box label="Exit when branch result"]; - 169 [shape=box label="Exit when"]; - 170 [shape=box label="Enter when"]; - 171 [shape=box label="Access variable R|/x|"]; - 172 [shape=box label="Variable declaration: lval y: R|kotlin/Any?|"]; - 173 [shape=box label="Enter when branch condition "]; - 174 [shape=box label="Type operator: A"]; - 175 [shape=box label="Exit when branch condition"]; - 176 [shape=box label="Enter block"]; - 177 [shape=box label="Exit block"]; - 178 [shape=box label="Exit when branch result"]; - 179 [shape=box label="Enter when branch condition "]; - 180 [shape=box label="Type operator: B"]; - 181 [shape=box label="Exit when branch condition"]; - 182 [shape=box label="Enter block"]; - 183 [shape=box label="Access variable R|/x|"]; - 184 [shape=box label="Function call: R|/x|.R|/A.foo|()"]; - 185 [shape=box label="Access variable R|/y|"]; - 186 [shape=box label="Function call: R|/y|.R|/A.foo|()"]; - 187 [shape=box label="Exit block"]; - 188 [shape=box label="Exit when branch result"]; - 189 [shape=box label="Enter when branch condition "]; - 190 [shape=box label="Type operator: Int"]; - 191 [shape=box label="Exit when branch condition"]; - 192 [shape=box label="Enter block"]; - 193 [shape=box label="Access variable R|/x|"]; - 194 [shape=box label="Function call: R|/x|.R|/A.foo|()"]; - 195 [shape=box label="Access variable R|/x|"]; - 196 [shape=box label="Function call: R|/x|.R|/B.bar|()"]; - 197 [shape=box label="Access variable R|/x|"]; - 198 [shape=box label="Function call: R|/x|.R|kotlin/Int.inc|()"]; - 199 [shape=box label="Access variable R|/y|"]; - 200 [shape=box label="Function call: R|/y|.R|/A.foo|()"]; - 201 [shape=box label="Access variable R|/y|"]; - 202 [shape=box label="Function call: R|/y|.R|/B.bar|()"]; - 203 [shape=box label="Access variable R|/y|"]; - 204 [shape=box label="Function call: R|/y|.R|kotlin/Int.inc|()"]; - 205 [shape=box label="Exit block"]; - 206 [shape=box label="Exit when branch result"]; - 207 [shape=box label="Enter when branch condition else"]; - 208 [shape=box label="Exit when branch condition"]; - 209 [shape=box label="Enter block"]; - 210 [shape=box label="Access variable R|/x|"]; - 211 [shape=box label="Function call: R|/x|.R|/A.foo|()"]; - 212 [shape=box label="Access variable R|/x|"]; - 213 [shape=box label="Function call: R|/x|.R|/B.bar|()"]; - 214 [shape=box label="Access variable R|/y|"]; - 215 [shape=box label="Function call: R|/y|.R|/A.foo|()"]; - 216 [shape=box label="Access variable R|/y|"]; - 217 [shape=box label="Function call: R|/y|.R|/B.bar|()"]; - 218 [shape=box label="Exit block"]; - 219 [shape=box label="Exit when branch result"]; - 220 [shape=box label="Exit when"]; - 221 [shape=box label="Exit block"]; - 222 [shape=box label="Exit function test_3" style="filled"]; + subgraph cluster_38 { + color=red + 139 [label="Enter function test_3" style="filled" fillcolor=red]; + subgraph cluster_39 { + color=blue + 140 [label="Enter block"]; + subgraph cluster_40 { + color=blue + 141 [label="Enter when"]; + 142 [label="Access variable R|/x|"]; + 143 [label="Variable declaration: lval y: R|kotlin/Any?|"]; + subgraph cluster_41 { + color=blue + 144 [label="Enter when branch condition "]; + 145 [label="Type operator: A"]; + 146 [label="Exit when branch condition"]; + } + subgraph cluster_42 { + color=blue + 147 [label="Enter block"]; + 148 [label="Access variable R|/x|"]; + 149 [label="Function call: R|/x|.R|/A.foo|()"]; + 150 [label="Access variable R|/y|"]; + 151 [label="Function call: R|/y|.R|/A.foo|()"]; + 152 [label="Exit block"]; + } + 153 [label="Exit when branch result"]; + subgraph cluster_43 { + color=blue + 154 [label="Enter when branch condition "]; + 155 [label="Type operator: B"]; + 156 [label="Exit when branch condition"]; + } + subgraph cluster_44 { + color=blue + 157 [label="Enter block"]; + 158 [label="Access variable R|/x|"]; + 159 [label="Function call: R|/x|.R|/B.bar|()"]; + 160 [label="Access variable R|/y|"]; + 161 [label="Function call: R|/y|.R|/B.bar|()"]; + 162 [label="Exit block"]; + } + 163 [label="Exit when branch result"]; + subgraph cluster_45 { + color=blue + 164 [label="Enter when branch condition else"]; + 165 [label="Exit when branch condition"]; + } + subgraph cluster_46 { + color=blue + 166 [label="Enter block"]; + 167 [label="Exit block"]; + } + 168 [label="Exit when branch result"]; + 169 [label="Exit when"]; + } + subgraph cluster_47 { + color=blue + 170 [label="Enter when"]; + 171 [label="Access variable R|/x|"]; + 172 [label="Variable declaration: lval y: R|kotlin/Any?|"]; + subgraph cluster_48 { + color=blue + 173 [label="Enter when branch condition "]; + 174 [label="Type operator: A"]; + 175 [label="Exit when branch condition"]; + } + subgraph cluster_49 { + color=blue + 176 [label="Enter block"]; + 177 [label="Exit block"]; + } + 178 [label="Exit when branch result"]; + subgraph cluster_50 { + color=blue + 179 [label="Enter when branch condition "]; + 180 [label="Type operator: B"]; + 181 [label="Exit when branch condition"]; + } + subgraph cluster_51 { + color=blue + 182 [label="Enter block"]; + 183 [label="Access variable R|/x|"]; + 184 [label="Function call: R|/x|.R|/A.foo|()"]; + 185 [label="Access variable R|/y|"]; + 186 [label="Function call: R|/y|.R|/A.foo|()"]; + 187 [label="Exit block"]; + } + 188 [label="Exit when branch result"]; + subgraph cluster_52 { + color=blue + 189 [label="Enter when branch condition "]; + 190 [label="Type operator: Int"]; + 191 [label="Exit when branch condition"]; + } + subgraph cluster_53 { + color=blue + 192 [label="Enter block"]; + 193 [label="Access variable R|/x|"]; + 194 [label="Function call: R|/x|.R|/A.foo|()"]; + 195 [label="Access variable R|/x|"]; + 196 [label="Function call: R|/x|.R|/B.bar|()"]; + 197 [label="Access variable R|/x|"]; + 198 [label="Function call: R|/x|.R|kotlin/Int.inc|()"]; + 199 [label="Access variable R|/y|"]; + 200 [label="Function call: R|/y|.R|/A.foo|()"]; + 201 [label="Access variable R|/y|"]; + 202 [label="Function call: R|/y|.R|/B.bar|()"]; + 203 [label="Access variable R|/y|"]; + 204 [label="Function call: R|/y|.R|kotlin/Int.inc|()"]; + 205 [label="Exit block"]; + } + 206 [label="Exit when branch result"]; + subgraph cluster_54 { + color=blue + 207 [label="Enter when branch condition else"]; + 208 [label="Exit when branch condition"]; + } + subgraph cluster_55 { + color=blue + 209 [label="Enter block"]; + 210 [label="Access variable R|/x|"]; + 211 [label="Function call: R|/x|.R|/A.foo|()"]; + 212 [label="Access variable R|/x|"]; + 213 [label="Function call: R|/x|.R|/B.bar|()"]; + 214 [label="Access variable R|/y|"]; + 215 [label="Function call: R|/y|.R|/A.foo|()"]; + 216 [label="Access variable R|/y|"]; + 217 [label="Function call: R|/y|.R|/B.bar|()"]; + 218 [label="Exit block"]; + } + 219 [label="Exit when branch result"]; + 220 [label="Exit when"]; + } + 221 [label="Exit block"]; + } + 222 [label="Exit function test_3" style="filled" fillcolor=red]; + } 139 -> {140}; 140 -> {141}; @@ -460,33 +621,52 @@ subgraph cluster_test_3 { 219 -> {220}; 220 -> {221}; 221 -> {222}; -} -subgraph cluster_test_4 { - 223 [shape=box label="Enter function test_4" style="filled"]; - 224 [shape=box label="Enter block"]; - 225 [shape=box label="Enter when"]; - 226 [shape=box label="Access variable R|/x|"]; - 227 [shape=box label="Type operator: x as Int"]; - 228 [shape=box label="Enter when branch condition "]; - 229 [shape=box label="Const: Int(1)"]; - 230 [shape=box label="Operator =="]; - 231 [shape=box label="Exit when branch condition"]; - 232 [shape=box label="Enter block"]; - 233 [shape=box label="Access variable R|/x|"]; - 234 [shape=box label="Function call: R|/x|.R|kotlin/Int.inc|()"]; - 235 [shape=box label="Exit block"]; - 236 [shape=box label="Exit when branch result"]; - 237 [shape=box label="Enter when branch condition else"]; - 238 [shape=box label="Exit when branch condition"]; - 239 [shape=box label="Enter block"]; - 240 [shape=box label="Exit block"]; - 241 [shape=box label="Exit when branch result"]; - 242 [shape=box label="Exit when"]; - 243 [shape=box label="Access variable R|/x|"]; - 244 [shape=box label="Function call: R|/x|.R|kotlin/Int.inc|()"]; - 245 [shape=box label="Exit block"]; - 246 [shape=box label="Exit function test_4" style="filled"]; + subgraph cluster_56 { + color=red + 223 [label="Enter function test_4" style="filled" fillcolor=red]; + subgraph cluster_57 { + color=blue + 224 [label="Enter block"]; + subgraph cluster_58 { + color=blue + 225 [label="Enter when"]; + 226 [label="Access variable R|/x|"]; + 227 [label="Type operator: x as Int"]; + subgraph cluster_59 { + color=blue + 228 [label="Enter when branch condition "]; + 229 [label="Const: Int(1)"]; + 230 [label="Operator =="]; + 231 [label="Exit when branch condition"]; + } + subgraph cluster_60 { + color=blue + 232 [label="Enter block"]; + 233 [label="Access variable R|/x|"]; + 234 [label="Function call: R|/x|.R|kotlin/Int.inc|()"]; + 235 [label="Exit block"]; + } + 236 [label="Exit when branch result"]; + subgraph cluster_61 { + color=blue + 237 [label="Enter when branch condition else"]; + 238 [label="Exit when branch condition"]; + } + subgraph cluster_62 { + color=blue + 239 [label="Enter block"]; + 240 [label="Exit block"]; + } + 241 [label="Exit when branch result"]; + 242 [label="Exit when"]; + } + 243 [label="Access variable R|/x|"]; + 244 [label="Function call: R|/x|.R|kotlin/Int.inc|()"]; + 245 [label="Exit block"]; + } + 246 [label="Exit function test_4" style="filled" fillcolor=red]; + } 223 -> {224}; 224 -> {225}; @@ -511,6 +691,5 @@ subgraph cluster_test_4 { 243 -> {244}; 244 -> {245}; 245 -> {246}; -} } diff --git a/compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/AbstractFirCfgBuildingTest.kt b/compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/AbstractFirCfgBuildingTest.kt index d659ba2be71..3565e31225b 100644 --- a/compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/AbstractFirCfgBuildingTest.kt +++ b/compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/AbstractFirCfgBuildingTest.kt @@ -13,7 +13,10 @@ import org.jetbrains.kotlin.fir.visitors.FirVisitorVoid import org.jetbrains.kotlin.test.ConfigurationKind import org.jetbrains.kotlin.test.KotlinTestUtils import java.io.File - +private const val EDGE = " -> " +private const val INDENT = " " +private const val RED = "red" +private const val BLUE = "blue" /* * For comfort viewing dumps of control flow graph you can setup external tool in IDEA that opens .dot files @@ -57,10 +60,14 @@ abstract class AbstractFirCfgBuildingTest : AbstractFirResolveTestCase() { private val dotBuilder: StringBuilder ) : FirVisitorVoid() { private var indexOffset = 0 + private var clusterCounter = 0 + private var offset = 1 override fun visitFile(file: FirFile) { dotBuilder.appendln("digraph ${file.name.replace(".", "_")} {") - .appendln("graph [splines=ortho, nodesep=3]") + .appendln("${INDENT}graph [splines=ortho nodesep=3]") + .appendln("${INDENT}node [shape=box penwidth=2]") + .appendln("${INDENT}edge [penwidth=2]") .appendln() super.visitFile(file) dotBuilder.appendln("}") @@ -73,60 +80,85 @@ abstract class AbstractFirCfgBuildingTest : AbstractFirResolveTestCase() { override fun visitControlFlowGraphReference(controlFlowGraphReference: FirControlFlowGraphReference) { val controlFlowGraph = (controlFlowGraphReference as? FirControlFlowGraphReferenceImpl)?.controlFlowGraph ?: return controlFlowGraph.renderToStringBuilder(simpleBuilder) - indexOffset = controlFlowGraph.dotRenderToStringBuilder(dotBuilder, indexOffset) + indexOffset = controlFlowGraph.dotRenderToStringBuilder(dotBuilder) dotBuilder.appendln() } - } -} -private const val EDGE = " -> " -private const val INDENT = " " - -fun ControlFlowGraph.dotRenderToStringBuilder(builder: StringBuilder, indexOffset: Int): Int { - with(builder) { - val sortedNodes = sortNodes() - val indices = sortedNodes.indicesMap().mapValues { (_, index) -> index + indexOffset } - val graphName = name.replace(Regex("[ <>]"), "_") - appendln("subgraph cluster_$graphName {") - - fun CFGNode<*>.splitEdges(): Pair>, List>> = - if (isDead) emptyList>() to followingNodes - else followingNodes.filter { !it.isDead } to followingNodes.filter { it.isDead } - - sortedNodes.forEach { - append(INDENT) - append(indices.getValue(it)) - val attributes = mutableListOf("shape=box") - attributes += "label=\"${it.render().replace("\"", "")}\"" - if (it == enterNode || it == exitNode) { - attributes += "style=\"filled\"" - } - appendln(attributes.joinToString(separator = " ", prefix = " [", postfix = "];")) + private fun StringBuilder.enterCluster(color: String) { + indent() + appendln("subgraph cluster_${clusterCounter++} {") + offset++ + indent() + appendln("color=$color") } - appendln() - sortedNodes.forEachIndexed { i, node -> - if (node.followingNodes.isEmpty()) return@forEachIndexed - val (aliveEdges, deadEdges) = node.splitEdges() + private fun StringBuilder.exitCluster() { + offset-- + indent() + appendln("}") + } - fun renderEdges(edges: List>, isDead: Boolean) { - if (edges.isEmpty()) return - append(INDENT) - append(i + indexOffset) - append(EDGE) - append(edges.joinToString(prefix = "{", postfix = "}", separator = " ") { indices.getValue(it).toString() }) - if (isDead) { - append(" [style=dotted]") + private fun StringBuilder.indent() { + append(INDENT.repeat(offset)) + } + + fun ControlFlowGraph.dotRenderToStringBuilder(builder: StringBuilder): Int { + with(builder) { + val sortedNodes = sortNodes() + val indices = sortedNodes.indicesMap().mapValues { (_, index) -> index + indexOffset } + + fun CFGNode<*>.splitEdges(): Pair>, List>> = + if (isDead) emptyList>() to followingNodes + else followingNodes.filter { !it.isDead } to followingNodes.filter { it.isDead } + + var color = RED + sortedNodes.forEach { + if (it is EnterNode) { + enterCluster(color) + color = BLUE + } + indent() + append(indices.getValue(it)) + val attributes = mutableListOf() + attributes += "label=\"${it.render().replace("\"", "")}\"" + if (it == enterNode || it == exitNode) { + attributes += "style=\"filled\"" + attributes += "fillcolor=red" + } + if (it.isDead) { + attributes += "style=\"filled\"" + attributes += "fillcolor=gray" + } + appendln(attributes.joinToString(separator = " ", prefix = " [", postfix = "];")) + if (it is ExitNode) { + exitCluster() + } } - appendln(";") + appendln() + + sortedNodes.forEachIndexed { i, node -> + if (node.followingNodes.isEmpty()) return@forEachIndexed + + val (aliveEdges, deadEdges) = node.splitEdges() + + fun renderEdges(edges: List>, isDead: Boolean) { + if (edges.isEmpty()) return + indent() + append(i + indexOffset) + append(EDGE) + append(edges.joinToString(prefix = "{", postfix = "}", separator = " ") { indices.getValue(it).toString() }) + if (isDead) { + append(" [style=dotted]") + } + appendln(";") + } + + renderEdges(aliveEdges, false) + renderEdges(deadEdges, true) + } + + return indexOffset + sortedNodes.size } - - renderEdges(aliveEdges, false) - renderEdges(deadEdges, true) } - - appendln("}") - - return indexOffset + sortedNodes.size } } \ No newline at end of file