diff --git a/compiler/fir/analysis-tests/testData/resolve/cfg/annotatedLocalClass.dot b/compiler/fir/analysis-tests/testData/resolve/cfg/annotatedLocalClass.dot index 2bf107e6bdc..85e1de12083 100644 --- a/compiler/fir/analysis-tests/testData/resolve/cfg/annotatedLocalClass.dot +++ b/compiler/fir/analysis-tests/testData/resolve/cfg/annotatedLocalClass.dot @@ -57,6 +57,12 @@ digraph annotatedLocalClass_kt { 23 [label="Enter class Local" style="filled" fillcolor=red]; 24 [label="Exit class Local" style="filled" fillcolor=red]; } + subgraph cluster_8 { + color=blue + 25 [label="Enter function " style="filled" fillcolor=red]; + 26 [label="Delegated constructor call: super()" style="filled" fillcolor=yellow]; + 27 [label="Exit function " style="filled" fillcolor=red]; + } 5 -> {6}; 6 -> {7}; 7 -> {8}; @@ -79,13 +85,6 @@ digraph annotatedLocalClass_kt { 20 -> {21}; 21 -> {22}; 23 -> {24} [color=green]; - - subgraph cluster_8 { - color=red - 25 [label="Enter function " style="filled" fillcolor=red]; - 26 [label="Delegated constructor call: super()" style="filled" fillcolor=yellow]; - 27 [label="Exit function " style="filled" fillcolor=red]; - } 25 -> {26}; 26 -> {27}; diff --git a/compiler/fir/analysis-tests/testData/resolve/cfg/initBlock.dot b/compiler/fir/analysis-tests/testData/resolve/cfg/initBlock.dot index a6579819a18..16d414e9bdf 100644 --- a/compiler/fir/analysis-tests/testData/resolve/cfg/initBlock.dot +++ b/compiler/fir/analysis-tests/testData/resolve/cfg/initBlock.dot @@ -13,34 +13,33 @@ digraph initBlock_kt { 1 -> {2}; subgraph cluster_1 { - color=red - 3 [label="Enter init block" style="filled" fillcolor=red]; - subgraph cluster_2 { - 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="Exit init block" style="filled" fillcolor=red]; - } - 3 -> {4}; - 4 -> {5}; - 5 -> {6}; - 6 -> {7}; - 7 -> {8}; - 8 -> {11} [color=green]; - - subgraph cluster_3 { color=red 9 [label="Enter class Foo" style="filled" fillcolor=red]; 10 [label="Part of class initialization"]; + subgraph cluster_2 { + color=blue + 3 [label="Enter init block" style="filled" fillcolor=red]; + subgraph cluster_3 { + 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="Exit init block" style="filled" fillcolor=red]; + } 11 [label="Exit class Foo" style="filled" fillcolor=red]; } 9 -> {10} [color=green]; 10 -> {3} [color=green]; 10 -> {11} [style=dotted]; 10 -> {3} [style=dashed]; + 3 -> {4}; + 4 -> {5}; + 5 -> {6}; + 6 -> {7}; + 7 -> {8}; + 8 -> {11} [color=green]; subgraph cluster_4 { color=red @@ -53,21 +52,31 @@ digraph initBlock_kt { subgraph cluster_5 { color=red - 15 [label="Enter init block" style="filled" fillcolor=red]; + 26 [label="Enter class Bar" style="filled" fillcolor=red]; + 27 [label="Part of class initialization"]; subgraph cluster_6 { color=blue - 16 [label="Enter block"]; - 17 [label="Const: Int(1)"]; - 18 [label="Variable declaration: lval x: R|kotlin/Int|"]; - 19 [label="Function call: R|java/lang/Exception.Exception|()" style="filled" fillcolor=yellow]; - 20 [label="Throw: throw R|java/lang/Exception.Exception|()"]; - 21 [label="Stub" style="filled" fillcolor=gray]; - 22 [label="Const: Int(2)" style="filled" fillcolor=gray]; - 23 [label="Variable declaration: lval y: R|kotlin/Int|" style="filled" fillcolor=gray]; - 24 [label="Exit block" style="filled" fillcolor=gray]; + 15 [label="Enter init block" style="filled" fillcolor=red]; + subgraph cluster_7 { + color=blue + 16 [label="Enter block"]; + 17 [label="Const: Int(1)"]; + 18 [label="Variable declaration: lval x: R|kotlin/Int|"]; + 19 [label="Function call: R|java/lang/Exception.Exception|()" style="filled" fillcolor=yellow]; + 20 [label="Throw: throw R|java/lang/Exception.Exception|()"]; + 21 [label="Stub" style="filled" fillcolor=gray]; + 22 [label="Const: Int(2)" style="filled" fillcolor=gray]; + 23 [label="Variable declaration: lval y: R|kotlin/Int|" style="filled" fillcolor=gray]; + 24 [label="Exit block" style="filled" fillcolor=gray]; + } + 25 [label="Exit init block" style="filled" fillcolor=red style="filled" fillcolor=gray]; } - 25 [label="Exit init block" style="filled" fillcolor=red style="filled" fillcolor=gray]; + 28 [label="Exit class Bar" style="filled" fillcolor=red style="filled" fillcolor=gray]; } + 26 -> {27} [color=green]; + 27 -> {15} [color=green]; + 27 -> {28} [style=dotted]; + 27 -> {15} [style=dashed]; 15 -> {16}; 16 -> {17}; 17 -> {18}; @@ -80,15 +89,4 @@ digraph initBlock_kt { 24 -> {25} [style=dotted]; 25 -> {28} [style=dotted]; - subgraph cluster_7 { - color=red - 26 [label="Enter class Bar" style="filled" fillcolor=red]; - 27 [label="Part of class initialization"]; - 28 [label="Exit class Bar" style="filled" fillcolor=red style="filled" fillcolor=gray]; - } - 26 -> {27} [color=green]; - 27 -> {15} [color=green]; - 27 -> {28} [style=dotted]; - 27 -> {15} [style=dashed]; - } diff --git a/compiler/fir/analysis-tests/testData/resolve/cfg/initBlockAndInPlaceLambda.dot b/compiler/fir/analysis-tests/testData/resolve/cfg/initBlockAndInPlaceLambda.dot index 37075e8eb79..008c157614c 100644 --- a/compiler/fir/analysis-tests/testData/resolve/cfg/initBlockAndInPlaceLambda.dot +++ b/compiler/fir/analysis-tests/testData/resolve/cfg/initBlockAndInPlaceLambda.dot @@ -28,35 +28,45 @@ digraph initBlockAndInPlaceLambda_kt { subgraph cluster_3 { color=red - 7 [label="Enter init block" style="filled" fillcolor=red]; + 26 [label="Enter class C" style="filled" fillcolor=red]; + 27 [label="Part of class initialization"]; subgraph cluster_4 { color=blue - 8 [label="Enter block"]; - 9 [label="Access variable R|/a|"]; - 10 [label="Access variable R|/A.b|"]; - 11 [label="Enter safe call"]; - 12 [label="Postponed enter to lambda"]; + 7 [label="Enter init block" style="filled" fillcolor=red]; subgraph cluster_5 { color=blue - 19 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; + 8 [label="Enter block"]; + 9 [label="Access variable R|/a|"]; + 10 [label="Access variable R|/A.b|"]; + 11 [label="Enter safe call"]; + 12 [label="Postponed enter to lambda"]; subgraph cluster_6 { color=blue - 20 [label="Enter block"]; - 21 [label="Access variable R|/a|"]; - 22 [label="Access variable R|/it|"]; - 23 [label="Function call: R|/C.C|(...)" style="filled" fillcolor=yellow]; - 24 [label="Exit block"]; + 19 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; + subgraph cluster_7 { + color=blue + 20 [label="Enter block"]; + 21 [label="Access variable R|/a|"]; + 22 [label="Access variable R|/it|"]; + 23 [label="Function call: R|/C.C|(...)" style="filled" fillcolor=yellow]; + 24 [label="Exit block"]; + } + 25 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; } - 25 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; + 13 [label="Postponed exit from lambda"]; + 14 [label="Function call: $subj$.R|kotlin/let|(...)" style="filled" fillcolor=yellow]; + 15 [label="Exit safe call"]; + 16 [label="Variable declaration: lval c: R|C?|"]; + 17 [label="Exit block"]; } - 13 [label="Postponed exit from lambda"]; - 14 [label="Function call: $subj$.R|kotlin/let|(...)" style="filled" fillcolor=yellow]; - 15 [label="Exit safe call"]; - 16 [label="Variable declaration: lval c: R|C?|"]; - 17 [label="Exit block"]; + 18 [label="Exit init block" style="filled" fillcolor=red]; } - 18 [label="Exit init block" style="filled" fillcolor=red]; + 28 [label="Exit class C" style="filled" fillcolor=red]; } + 26 -> {27} [color=green]; + 27 -> {7} [color=green]; + 27 -> {28} [style=dotted]; + 27 -> {7} [style=dashed]; 7 -> {8}; 8 -> {9}; 9 -> {10}; @@ -79,15 +89,4 @@ digraph initBlockAndInPlaceLambda_kt { 24 -> {25}; 25 -> {13}; - subgraph cluster_7 { - color=red - 26 [label="Enter class C" style="filled" fillcolor=red]; - 27 [label="Part of class initialization"]; - 28 [label="Exit class C" style="filled" fillcolor=red]; - } - 26 -> {27} [color=green]; - 27 -> {7} [color=green]; - 27 -> {28} [style=dotted]; - 27 -> {7} [style=dashed]; - } diff --git a/compiler/fir/analysis-tests/testData/resolve/cfg/innerClassInAnonymousObject.dot b/compiler/fir/analysis-tests/testData/resolve/cfg/innerClassInAnonymousObject.dot index 655a8ff25f9..70ec9dd2ee4 100644 --- a/compiler/fir/analysis-tests/testData/resolve/cfg/innerClassInAnonymousObject.dot +++ b/compiler/fir/analysis-tests/testData/resolve/cfg/innerClassInAnonymousObject.dot @@ -4,15 +4,6 @@ digraph innerClassInAnonymousObject_kt { edge [penwidth=2] subgraph cluster_0 { - color=red - 0 [label="Enter function " style="filled" fillcolor=red]; - 1 [label="Delegated constructor call: super()" style="filled" fillcolor=yellow]; - 2 [label="Exit function " style="filled" fillcolor=red]; - } - 0 -> {1}; - 1 -> {2}; - - subgraph cluster_1 { color=red 3 [label="Enter function " style="filled" fillcolor=red]; 4 [label="Delegated constructor call: super()" style="filled" fillcolor=yellow]; @@ -21,10 +12,10 @@ digraph innerClassInAnonymousObject_kt { 3 -> {4}; 4 -> {5}; - subgraph cluster_2 { + subgraph cluster_1 { color=red 6 [label="Enter function foo" style="filled" fillcolor=red]; - subgraph cluster_3 { + subgraph cluster_2 { color=blue 7 [label="Enter block"]; 8 [label="Exit block"]; @@ -35,18 +26,18 @@ digraph innerClassInAnonymousObject_kt { 7 -> {8}; 8 -> {9}; - subgraph cluster_4 { + subgraph cluster_3 { color=red 10 [label="Enter class Nested" style="filled" fillcolor=red]; 11 [label="Exit class Nested" style="filled" fillcolor=red]; } 10 -> {11} [color=green]; - subgraph cluster_5 { + subgraph cluster_4 { color=red 14 [label="Enter property" style="filled" fillcolor=red]; 15 [label="Enter anonymous object"]; - subgraph cluster_6 { + subgraph cluster_5 { color=blue 12 [label="Enter class " style="filled" fillcolor=red]; 13 [label="Exit class " style="filled" fillcolor=red]; @@ -55,6 +46,12 @@ digraph innerClassInAnonymousObject_kt { 17 [label="Exit anonymous object expression"]; 18 [label="Exit property" style="filled" fillcolor=red]; } + subgraph cluster_6 { + color=blue + 0 [label="Enter function " style="filled" fillcolor=red]; + 1 [label="Delegated constructor call: super()" style="filled" fillcolor=yellow]; + 2 [label="Exit function " style="filled" fillcolor=red]; + } 14 -> {15}; 14 -> {0 3 6} [color=red]; 15 -> {12} [color=green]; @@ -66,5 +63,7 @@ digraph innerClassInAnonymousObject_kt { 17 -> {18}; 12 -> {13} [color=green]; 13 -> {16} [color=green]; + 0 -> {1}; + 1 -> {2}; } diff --git a/compiler/fir/analysis-tests/testData/resolve/cfg/localClassesWithImplicit.dot b/compiler/fir/analysis-tests/testData/resolve/cfg/localClassesWithImplicit.dot index a21ddd0fce2..14b0122a135 100644 --- a/compiler/fir/analysis-tests/testData/resolve/cfg/localClassesWithImplicit.dot +++ b/compiler/fir/analysis-tests/testData/resolve/cfg/localClassesWithImplicit.dot @@ -56,8 +56,8 @@ digraph localClassesWithImplicit_kt { 23 [label="Enter anonymous object"]; subgraph cluster_7 { color=blue - 31 [label="Enter class " style="filled" fillcolor=red]; - 32 [label="Exit class " style="filled" fillcolor=red]; + 97 [label="Enter class " style="filled" fillcolor=red]; + 98 [label="Exit class " style="filled" fillcolor=red]; } 24 [label="Exit anonymous object"]; 25 [label="Exit anonymous object expression"]; @@ -68,290 +68,86 @@ digraph localClassesWithImplicit_kt { } subgraph cluster_8 { color=blue - 29 [label="Enter class A" style="filled" fillcolor=red]; - 30 [label="Exit class A" style="filled" fillcolor=red]; + 158 [label="Enter function baz" style="filled" fillcolor=red]; + subgraph cluster_9 { + color=blue + 159 [label="Enter block"]; + 160 [label="Const: Int(1)"]; + 161 [label="Jump: ^baz Int(1)"]; + 162 [label="Stub" style="filled" fillcolor=gray]; + 163 [label="Exit block" style="filled" fillcolor=gray]; + } + 164 [label="Exit function baz" style="filled" fillcolor=red]; } - 7 -> {8}; - 8 -> {9}; - 9 -> {10}; - 10 -> {11}; - 11 -> {12}; - 12 -> {13}; - 13 -> {14 15}; - 14 -> {21}; - 15 -> {16}; - 16 -> {17}; - 17 -> {28}; - 17 -> {18} [style=dotted]; - 18 -> {19} [style=dotted]; - 19 -> {20} [style=dotted]; - 20 -> {21} [style=dotted]; - 21 -> {22}; - 21 -> {33 36 73 92} [color=red]; - 22 -> {23}; - 22 -> {29 33 36 73 92} [color=green]; - 22 -> {99 102 139 158} [color=red]; - 22 -> {29 33 36 73 92} [style=dashed]; - 23 -> {31} [color=green]; - 23 -> {24} [color=red]; - 23 -> {31} [style=dashed]; - 24 -> {25}; - 24 -> {99 102 139 158} [color=green]; - 24 -> {99 102 139 158} [style=dashed]; - 25 -> {26}; - 26 -> {27}; - 27 -> {28}; - 29 -> {30} [color=green]; - 31 -> {32} [color=green]; - 32 -> {24} [color=green]; - - subgraph cluster_9 { - color=red - 33 [label="Enter function " style="filled" fillcolor=red]; - 34 [label="Delegated constructor call: super()" style="filled" fillcolor=yellow]; - 35 [label="Exit function " style="filled" fillcolor=red]; - } - 33 -> {34}; - 34 -> {35}; - subgraph cluster_10 { - color=red - 36 [label="Enter function foo" style="filled" fillcolor=red]; + color=blue + 139 [label="Enter function bar" style="filled" fillcolor=red]; subgraph cluster_11 { color=blue - 37 [label="Enter block"]; - 38 [label="Postponed enter to lambda"]; + 140 [label="Enter block"]; + 141 [label="Postponed enter to lambda"]; subgraph cluster_12 { color=blue - 45 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; + 148 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; subgraph cluster_13 { color=blue - 46 [label="Enter block"]; - 47 [label="Access variable R|/a|"]; - 48 [label="Smart cast: R|/a|"]; - 49 [label="Access variable R|kotlin/String.length|"]; - subgraph cluster_14 { - color=blue - 50 [label="Enter when"]; - subgraph cluster_15 { - color=blue - 51 [label="Enter when branch condition "]; - 52 [label="Access variable R|/b|"]; - 53 [label="Type operator: (R|/b| is R|kotlin/String|)"]; - 54 [label="Exit when branch condition"]; - } - subgraph cluster_16 { - color=blue - 55 [label="Enter when branch condition else"]; - 56 [label="Exit when branch condition"]; - } - 57 [label="Enter when branch result"]; - subgraph cluster_17 { - color=blue - 58 [label="Enter block"]; - 59 [label="Const: Int(1)"]; - 60 [label="Exit block"]; - } - 61 [label="Exit when branch result"]; - 62 [label="Enter when branch result"]; - subgraph cluster_18 { - color=blue - 63 [label="Enter block"]; - 64 [label="Access variable R|/b|"]; - 65 [label="Smart cast: R|/b|"]; - 66 [label="Access variable R|kotlin/String.length|"]; - 67 [label="Function call: this@R|/A|.R|/bar|()" style="filled" fillcolor=yellow]; - 68 [label="Exit block"]; - } - 69 [label="Exit when branch result"]; - 70 [label="Exit when"]; - } - 71 [label="Exit block"]; + 149 [label="Enter block"]; + 150 [label="Access variable R|/a|"]; + 151 [label="Smart cast: R|/a|"]; + 152 [label="Access variable R|kotlin/String.length|"]; + 153 [label="Access variable R|/b|"]; + 154 [label="Access variable #"]; + 155 [label="Function call: this@R|/|.R|/.baz|()" style="filled" fillcolor=yellow]; + 156 [label="Exit block"]; } - 72 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; + 157 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; } - 39 [label="Postponed exit from lambda"]; - 40 [label="Function call: R|/myRun|(...)" style="filled" fillcolor=yellow]; - 41 [label="Jump: ^foo R|/myRun|( = myRun@fun (): R|kotlin/Int| { + 142 [label="Postponed exit from lambda"]; + 143 [label="Function call: R|/myRun|(...)" style="filled" fillcolor=yellow]; + 144 [label="Jump: ^bar R|/myRun|( = myRun@fun (): R|kotlin/Int| { R|/a|.R|kotlin/String.length| - ^ when () { - (R|/b| is R|kotlin/String|) -> { - R|/b|.R|kotlin/String.length| - this@R|/A|.R|/bar|() - } - else -> { - Int(1) - } - } - -} -)"]; - 42 [label="Stub" style="filled" fillcolor=gray]; - 43 [label="Exit block" style="filled" fillcolor=gray]; - } - 44 [label="Exit function foo" style="filled" fillcolor=red]; - } - 36 -> {37}; - 37 -> {38}; - 38 -> {39 40 45}; - 38 -> {45} [style=dashed]; - 39 -> {40}; - 39 -> {38} [color=green style=dashed]; - 40 -> {41}; - 41 -> {44}; - 41 -> {42} [style=dotted]; - 42 -> {43} [style=dotted]; - 43 -> {44} [style=dotted]; - 45 -> {46}; - 46 -> {47}; - 47 -> {48}; - 48 -> {49}; - 49 -> {50}; - 50 -> {51}; - 51 -> {52}; - 52 -> {53}; - 53 -> {54}; - 54 -> {55 62}; - 55 -> {56}; - 56 -> {57}; - 57 -> {58}; - 58 -> {59}; - 59 -> {60}; - 60 -> {61}; - 61 -> {70}; - 62 -> {63}; - 63 -> {64}; - 64 -> {65}; - 65 -> {66}; - 66 -> {67}; - 67 -> {68}; - 68 -> {69}; - 69 -> {70}; - 70 -> {71}; - 71 -> {72}; - 72 -> {39}; - - subgraph cluster_19 { - color=red - 73 [label="Enter function bar" style="filled" fillcolor=red]; - subgraph cluster_20 { - color=blue - 74 [label="Enter block"]; - 75 [label="Postponed enter to lambda"]; - subgraph cluster_21 { - color=blue - 82 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; - subgraph cluster_22 { - color=blue - 83 [label="Enter block"]; - 84 [label="Access variable R|/b|"]; - 85 [label="Access variable #"]; - 86 [label="Access variable R|/a|"]; - 87 [label="Smart cast: R|/a|"]; - 88 [label="Access variable R|kotlin/String.length|"]; - 89 [label="Function call: this@R|/A|.R|/baz|()" style="filled" fillcolor=yellow]; - 90 [label="Exit block"]; - } - 91 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; - } - 76 [label="Postponed exit from lambda"]; - 77 [label="Function call: R|/myRun|(...)" style="filled" fillcolor=yellow]; - 78 [label="Jump: ^bar R|/myRun|( = myRun@fun (): R|kotlin/Int| { R|/b|.# - R|/a|.R|kotlin/String.length| - ^ this@R|/A|.R|/baz|() + ^ this@R|/|.R|/.baz|() } )"]; - 79 [label="Stub" style="filled" fillcolor=gray]; - 80 [label="Exit block" style="filled" fillcolor=gray]; + 145 [label="Stub" style="filled" fillcolor=gray]; + 146 [label="Exit block" style="filled" fillcolor=gray]; } - 81 [label="Exit function bar" style="filled" fillcolor=red]; + 147 [label="Exit function bar" style="filled" fillcolor=red]; } - 73 -> {74}; - 74 -> {75}; - 75 -> {76 77 82}; - 75 -> {82} [style=dashed]; - 76 -> {77}; - 76 -> {75} [color=green style=dashed]; - 77 -> {78}; - 78 -> {81}; - 78 -> {79} [style=dotted]; - 79 -> {80} [style=dotted]; - 80 -> {81} [style=dotted]; - 82 -> {83}; - 83 -> {84}; - 84 -> {85}; - 85 -> {86}; - 86 -> {87}; - 87 -> {88}; - 88 -> {89}; - 89 -> {90}; - 90 -> {91}; - 91 -> {76}; - - subgraph cluster_23 { - color=red - 92 [label="Enter function baz" style="filled" fillcolor=red]; - subgraph cluster_24 { - color=blue - 93 [label="Enter block"]; - 94 [label="Const: Int(1)"]; - 95 [label="Jump: ^baz Int(1)"]; - 96 [label="Stub" style="filled" fillcolor=gray]; - 97 [label="Exit block" style="filled" fillcolor=gray]; - } - 98 [label="Exit function baz" style="filled" fillcolor=red]; - } - 92 -> {93}; - 93 -> {94}; - 94 -> {95}; - 95 -> {98}; - 95 -> {96} [style=dotted]; - 96 -> {97} [style=dotted]; - 97 -> {98} [style=dotted]; - - subgraph cluster_25 { - color=red - 99 [label="Enter function " style="filled" fillcolor=red]; - 100 [label="Delegated constructor call: super()" style="filled" fillcolor=yellow]; - 101 [label="Exit function " style="filled" fillcolor=red]; - } - 99 -> {100}; - 100 -> {101}; - - subgraph cluster_26 { - color=red + subgraph cluster_14 { + color=blue 102 [label="Enter function foo" style="filled" fillcolor=red]; - subgraph cluster_27 { + subgraph cluster_15 { color=blue 103 [label="Enter block"]; 104 [label="Postponed enter to lambda"]; - subgraph cluster_28 { + subgraph cluster_16 { color=blue 111 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; - subgraph cluster_29 { + subgraph cluster_17 { color=blue 112 [label="Enter block"]; 113 [label="Access variable R|/a|"]; 114 [label="Smart cast: R|/a|"]; 115 [label="Access variable R|kotlin/String.length|"]; - subgraph cluster_30 { + subgraph cluster_18 { color=blue 116 [label="Enter when"]; - subgraph cluster_31 { + subgraph cluster_19 { color=blue 117 [label="Enter when branch condition "]; 118 [label="Access variable R|/b|"]; 119 [label="Type operator: (R|/b| is R|kotlin/String|)"]; 120 [label="Exit when branch condition"]; } - subgraph cluster_32 { + subgraph cluster_20 { color=blue 121 [label="Enter when branch condition else"]; 122 [label="Exit when branch condition"]; } 123 [label="Enter when branch result"]; - subgraph cluster_33 { + subgraph cluster_21 { color=blue 124 [label="Enter block"]; 125 [label="Const: Int(1)"]; @@ -359,7 +155,7 @@ digraph localClassesWithImplicit_kt { } 127 [label="Exit when branch result"]; 128 [label="Enter when branch result"]; - subgraph cluster_34 { + subgraph cluster_22 { color=blue 129 [label="Enter block"]; 130 [label="Access variable R|/b|"]; @@ -396,6 +192,253 @@ digraph localClassesWithImplicit_kt { } 110 [label="Exit function foo" style="filled" fillcolor=red]; } + subgraph cluster_23 { + color=blue + 99 [label="Enter function " style="filled" fillcolor=red]; + 100 [label="Delegated constructor call: super()" style="filled" fillcolor=yellow]; + 101 [label="Exit function " style="filled" fillcolor=red]; + } + subgraph cluster_24 { + color=blue + 29 [label="Enter class A" style="filled" fillcolor=red]; + 30 [label="Exit class A" style="filled" fillcolor=red]; + } + subgraph cluster_25 { + color=blue + 90 [label="Enter function baz" style="filled" fillcolor=red]; + subgraph cluster_26 { + color=blue + 91 [label="Enter block"]; + 92 [label="Const: Int(1)"]; + 93 [label="Jump: ^baz Int(1)"]; + 94 [label="Stub" style="filled" fillcolor=gray]; + 95 [label="Exit block" style="filled" fillcolor=gray]; + } + 96 [label="Exit function baz" style="filled" fillcolor=red]; + } + subgraph cluster_27 { + color=blue + 71 [label="Enter function bar" style="filled" fillcolor=red]; + subgraph cluster_28 { + color=blue + 72 [label="Enter block"]; + 73 [label="Postponed enter to lambda"]; + subgraph cluster_29 { + color=blue + 80 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; + subgraph cluster_30 { + color=blue + 81 [label="Enter block"]; + 82 [label="Access variable R|/b|"]; + 83 [label="Access variable #"]; + 84 [label="Access variable R|/a|"]; + 85 [label="Smart cast: R|/a|"]; + 86 [label="Access variable R|kotlin/String.length|"]; + 87 [label="Function call: this@R|/A|.R|/baz|()" style="filled" fillcolor=yellow]; + 88 [label="Exit block"]; + } + 89 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; + } + 74 [label="Postponed exit from lambda"]; + 75 [label="Function call: R|/myRun|(...)" style="filled" fillcolor=yellow]; + 76 [label="Jump: ^bar R|/myRun|( = myRun@fun (): R|kotlin/Int| { + R|/b|.# + R|/a|.R|kotlin/String.length| + ^ this@R|/A|.R|/baz|() +} +)"]; + 77 [label="Stub" style="filled" fillcolor=gray]; + 78 [label="Exit block" style="filled" fillcolor=gray]; + } + 79 [label="Exit function bar" style="filled" fillcolor=red]; + } + subgraph cluster_31 { + color=blue + 34 [label="Enter function foo" style="filled" fillcolor=red]; + subgraph cluster_32 { + color=blue + 35 [label="Enter block"]; + 36 [label="Postponed enter to lambda"]; + subgraph cluster_33 { + color=blue + 43 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; + subgraph cluster_34 { + color=blue + 44 [label="Enter block"]; + 45 [label="Access variable R|/a|"]; + 46 [label="Smart cast: R|/a|"]; + 47 [label="Access variable R|kotlin/String.length|"]; + subgraph cluster_35 { + color=blue + 48 [label="Enter when"]; + subgraph cluster_36 { + color=blue + 49 [label="Enter when branch condition "]; + 50 [label="Access variable R|/b|"]; + 51 [label="Type operator: (R|/b| is R|kotlin/String|)"]; + 52 [label="Exit when branch condition"]; + } + subgraph cluster_37 { + color=blue + 53 [label="Enter when branch condition else"]; + 54 [label="Exit when branch condition"]; + } + 55 [label="Enter when branch result"]; + subgraph cluster_38 { + color=blue + 56 [label="Enter block"]; + 57 [label="Const: Int(1)"]; + 58 [label="Exit block"]; + } + 59 [label="Exit when branch result"]; + 60 [label="Enter when branch result"]; + subgraph cluster_39 { + color=blue + 61 [label="Enter block"]; + 62 [label="Access variable R|/b|"]; + 63 [label="Smart cast: R|/b|"]; + 64 [label="Access variable R|kotlin/String.length|"]; + 65 [label="Function call: this@R|/A|.R|/bar|()" style="filled" fillcolor=yellow]; + 66 [label="Exit block"]; + } + 67 [label="Exit when branch result"]; + 68 [label="Exit when"]; + } + 69 [label="Exit block"]; + } + 70 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; + } + 37 [label="Postponed exit from lambda"]; + 38 [label="Function call: R|/myRun|(...)" style="filled" fillcolor=yellow]; + 39 [label="Jump: ^foo R|/myRun|( = myRun@fun (): R|kotlin/Int| { + R|/a|.R|kotlin/String.length| + ^ when () { + (R|/b| is R|kotlin/String|) -> { + R|/b|.R|kotlin/String.length| + this@R|/A|.R|/bar|() + } + else -> { + Int(1) + } + } + +} +)"]; + 40 [label="Stub" style="filled" fillcolor=gray]; + 41 [label="Exit block" style="filled" fillcolor=gray]; + } + 42 [label="Exit function foo" style="filled" fillcolor=red]; + } + subgraph cluster_40 { + color=blue + 31 [label="Enter function " style="filled" fillcolor=red]; + 32 [label="Delegated constructor call: super()" style="filled" fillcolor=yellow]; + 33 [label="Exit function " style="filled" fillcolor=red]; + } + 7 -> {8}; + 8 -> {9}; + 9 -> {10}; + 10 -> {11}; + 11 -> {12}; + 12 -> {13}; + 13 -> {14 15}; + 14 -> {21}; + 15 -> {16}; + 16 -> {17}; + 17 -> {28}; + 17 -> {18} [style=dotted]; + 18 -> {19} [style=dotted]; + 19 -> {20} [style=dotted]; + 20 -> {21} [style=dotted]; + 21 -> {22}; + 21 -> {31 34 71 90} [color=red]; + 22 -> {23}; + 22 -> {29 31 34 71 90} [color=green]; + 22 -> {99 102 139 158} [color=red]; + 22 -> {29 31 34 71 90} [style=dashed]; + 23 -> {97} [color=green]; + 23 -> {24} [color=red]; + 23 -> {97} [style=dashed]; + 24 -> {25}; + 24 -> {99 102 139 158} [color=green]; + 24 -> {99 102 139 158} [style=dashed]; + 25 -> {26}; + 26 -> {27}; + 27 -> {28}; + 29 -> {30} [color=green]; + 31 -> {32}; + 32 -> {33}; + 34 -> {35}; + 35 -> {36}; + 36 -> {37 38 43}; + 36 -> {43} [style=dashed]; + 37 -> {38}; + 37 -> {36} [color=green style=dashed]; + 38 -> {39}; + 39 -> {42}; + 39 -> {40} [style=dotted]; + 40 -> {41} [style=dotted]; + 41 -> {42} [style=dotted]; + 43 -> {44}; + 44 -> {45}; + 45 -> {46}; + 46 -> {47}; + 47 -> {48}; + 48 -> {49}; + 49 -> {50}; + 50 -> {51}; + 51 -> {52}; + 52 -> {53 60}; + 53 -> {54}; + 54 -> {55}; + 55 -> {56}; + 56 -> {57}; + 57 -> {58}; + 58 -> {59}; + 59 -> {68}; + 60 -> {61}; + 61 -> {62}; + 62 -> {63}; + 63 -> {64}; + 64 -> {65}; + 65 -> {66}; + 66 -> {67}; + 67 -> {68}; + 68 -> {69}; + 69 -> {70}; + 70 -> {37}; + 71 -> {72}; + 72 -> {73}; + 73 -> {74 75 80}; + 73 -> {80} [style=dashed]; + 74 -> {75}; + 74 -> {73} [color=green style=dashed]; + 75 -> {76}; + 76 -> {79}; + 76 -> {77} [style=dotted]; + 77 -> {78} [style=dotted]; + 78 -> {79} [style=dotted]; + 80 -> {81}; + 81 -> {82}; + 82 -> {83}; + 83 -> {84}; + 84 -> {85}; + 85 -> {86}; + 86 -> {87}; + 87 -> {88}; + 88 -> {89}; + 89 -> {74}; + 90 -> {91}; + 91 -> {92}; + 92 -> {93}; + 93 -> {96}; + 93 -> {94} [style=dotted]; + 94 -> {95} [style=dotted]; + 95 -> {96} [style=dotted]; + 97 -> {98} [color=green]; + 98 -> {24} [color=green]; + 99 -> {100}; + 100 -> {101}; 102 -> {103}; 103 -> {104}; 104 -> {105 106 111}; @@ -435,43 +478,6 @@ digraph localClassesWithImplicit_kt { 136 -> {137}; 137 -> {138}; 138 -> {105}; - - subgraph cluster_35 { - color=red - 139 [label="Enter function bar" style="filled" fillcolor=red]; - subgraph cluster_36 { - color=blue - 140 [label="Enter block"]; - 141 [label="Postponed enter to lambda"]; - subgraph cluster_37 { - color=blue - 148 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; - subgraph cluster_38 { - color=blue - 149 [label="Enter block"]; - 150 [label="Access variable R|/a|"]; - 151 [label="Smart cast: R|/a|"]; - 152 [label="Access variable R|kotlin/String.length|"]; - 153 [label="Access variable R|/b|"]; - 154 [label="Access variable #"]; - 155 [label="Function call: this@R|/|.R|/.baz|()" style="filled" fillcolor=yellow]; - 156 [label="Exit block"]; - } - 157 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; - } - 142 [label="Postponed exit from lambda"]; - 143 [label="Function call: R|/myRun|(...)" style="filled" fillcolor=yellow]; - 144 [label="Jump: ^bar R|/myRun|( = myRun@fun (): R|kotlin/Int| { - R|/a|.R|kotlin/String.length| - R|/b|.# - ^ this@R|/|.R|/.baz|() -} -)"]; - 145 [label="Stub" style="filled" fillcolor=gray]; - 146 [label="Exit block" style="filled" fillcolor=gray]; - } - 147 [label="Exit function bar" style="filled" fillcolor=red]; - } 139 -> {140}; 140 -> {141}; 141 -> {142 143 148}; @@ -493,20 +499,6 @@ digraph localClassesWithImplicit_kt { 155 -> {156}; 156 -> {157}; 157 -> {142}; - - subgraph cluster_39 { - color=red - 158 [label="Enter function baz" style="filled" fillcolor=red]; - subgraph cluster_40 { - color=blue - 159 [label="Enter block"]; - 160 [label="Const: Int(1)"]; - 161 [label="Jump: ^baz Int(1)"]; - 162 [label="Stub" style="filled" fillcolor=gray]; - 163 [label="Exit block" style="filled" fillcolor=gray]; - } - 164 [label="Exit function baz" style="filled" fillcolor=red]; - } 158 -> {159}; 159 -> {160}; 160 -> {161}; diff --git a/compiler/fir/analysis-tests/testData/resolve/cfg/postponedLambdaInConstructor.dot b/compiler/fir/analysis-tests/testData/resolve/cfg/postponedLambdaInConstructor.dot index 3194f02f844..8be3092512c 100644 --- a/compiler/fir/analysis-tests/testData/resolve/cfg/postponedLambdaInConstructor.dot +++ b/compiler/fir/analysis-tests/testData/resolve/cfg/postponedLambdaInConstructor.dot @@ -72,19 +72,9 @@ digraph postponedLambdaInConstructor_kt { 20 -> {21}; subgraph cluster_7 { - color=red - 22 [label="Enter property" style="filled" fillcolor=red]; - 23 [label="Access variable R|/s|"]; - 24 [label="Exit property" style="filled" fillcolor=red]; - } - 22 -> {23}; - 23 -> {24}; - 24 -> {32} [color=green]; - - subgraph cluster_8 { color=red 25 [label="Enter function foo" style="filled" fillcolor=red]; - subgraph cluster_9 { + subgraph cluster_8 { color=blue 26 [label="Enter block"]; 27 [label="Function call: this@R|/B|.R|/B.foo|()" style="filled" fillcolor=yellow]; @@ -97,15 +87,24 @@ digraph postponedLambdaInConstructor_kt { 27 -> {28}; 28 -> {29}; - subgraph cluster_10 { + subgraph cluster_9 { color=red 30 [label="Enter class B" style="filled" fillcolor=red]; 31 [label="Part of class initialization"]; + subgraph cluster_10 { + color=blue + 22 [label="Enter property" style="filled" fillcolor=red]; + 23 [label="Access variable R|/s|"]; + 24 [label="Exit property" style="filled" fillcolor=red]; + } 32 [label="Exit class B" style="filled" fillcolor=red]; } 30 -> {31} [color=green]; 31 -> {22} [color=green]; 31 -> {32} [style=dotted]; 31 -> {22} [style=dashed]; + 22 -> {23}; + 23 -> {24}; + 24 -> {32} [color=green]; } diff --git a/compiler/fir/analysis-tests/testData/resolve/cfg/propertiesAndInitBlocks.dot b/compiler/fir/analysis-tests/testData/resolve/cfg/propertiesAndInitBlocks.dot index 060c441d79a..5274ed40eb6 100644 --- a/compiler/fir/analysis-tests/testData/resolve/cfg/propertiesAndInitBlocks.dot +++ b/compiler/fir/analysis-tests/testData/resolve/cfg/propertiesAndInitBlocks.dot @@ -78,68 +78,36 @@ digraph propertiesAndInitBlocks_kt { subgraph cluster_8 { color=red - 35 [label="Enter function foo" style="filled" fillcolor=red]; + 46 [label="Enter function foo" style="filled" fillcolor=red]; subgraph cluster_9 { color=blue - 36 [label="Enter block"]; - 37 [label="Const: Int(1)"]; - 38 [label="Const: Int(1)"]; - 39 [label="Function call: Int(1).R|kotlin/Int.plus|(...)" style="filled" fillcolor=yellow]; - 40 [label="Variable declaration: lval c: R|kotlin/Int|"]; - 41 [label="Function call: R|java/lang/Exception.Exception|()" style="filled" fillcolor=yellow]; - 42 [label="Throw: throw R|java/lang/Exception.Exception|()"]; - 43 [label="Stub" style="filled" fillcolor=gray]; - 44 [label="Exit block" style="filled" fillcolor=gray]; + 47 [label="Enter block"]; + 48 [label="Const: Int(1)"]; + 49 [label="Const: Int(1)"]; + 50 [label="Function call: Int(1).R|kotlin/Int.plus|(...)" style="filled" fillcolor=yellow]; + 51 [label="Variable declaration: lval c: R|kotlin/Int|"]; + 52 [label="Function call: R|java/lang/Exception.Exception|()" style="filled" fillcolor=yellow]; + 53 [label="Throw: throw R|java/lang/Exception.Exception|()"]; + 54 [label="Stub" style="filled" fillcolor=gray]; + 55 [label="Exit block" style="filled" fillcolor=gray]; } - 45 [label="Exit function foo" style="filled" fillcolor=red style="filled" fillcolor=gray]; - } - 35 -> {36}; - 36 -> {37}; - 37 -> {38}; - 38 -> {39}; - 39 -> {40}; - 40 -> {41}; - 41 -> {42}; - 42 -> {43} [style=dotted]; - 43 -> {44} [style=dotted]; - 44 -> {45} [style=dotted]; - - subgraph cluster_10 { - color=red - 46 [label="Enter function " style="filled" fillcolor=red]; - 47 [label="Delegated constructor call: super()" style="filled" fillcolor=yellow]; - 48 [label="Exit function " style="filled" fillcolor=red]; + 56 [label="Exit function foo" style="filled" fillcolor=red style="filled" fillcolor=gray]; } 46 -> {47}; 47 -> {48}; - - subgraph cluster_11 { - color=red - 49 [label="Enter init block" style="filled" fillcolor=red]; - subgraph cluster_12 { - color=blue - 50 [label="Enter block"]; - 51 [label="Function call: R|java/lang/Exception.Exception|()" style="filled" fillcolor=yellow]; - 52 [label="Throw: throw R|java/lang/Exception.Exception|()"]; - 53 [label="Stub" style="filled" fillcolor=gray]; - 54 [label="Const: Int(1)" style="filled" fillcolor=gray]; - 55 [label="Exit block" style="filled" fillcolor=gray]; - } - 56 [label="Exit init block" style="filled" fillcolor=red style="filled" fillcolor=gray]; - } + 48 -> {49}; 49 -> {50}; 50 -> {51}; 51 -> {52}; - 52 -> {53} [style=dotted]; + 52 -> {53}; 53 -> {54} [style=dotted]; 54 -> {55} [style=dotted]; 55 -> {56} [style=dotted]; - 56 -> {34} [style=dotted]; - subgraph cluster_13 { + subgraph cluster_10 { color=red 57 [label="Enter function getter" style="filled" fillcolor=red]; - subgraph cluster_14 { + subgraph cluster_11 { color=blue 58 [label="Enter block"]; 59 [label="Exit local class "]; @@ -147,62 +115,60 @@ digraph propertiesAndInitBlocks_kt { } 61 [label="Exit function getter" style="filled" fillcolor=red]; } - subgraph cluster_15 { + subgraph cluster_12 { color=blue 62 [label="Enter class GetterLocalClass" style="filled" fillcolor=red]; 63 [label="Part of class initialization"]; + subgraph cluster_13 { + color=blue + 65 [label="Enter init block" style="filled" fillcolor=red]; + subgraph cluster_14 { + color=blue + 66 [label="Enter block"]; + 67 [label="Function call: R|java/lang/Exception.Exception|()" style="filled" fillcolor=yellow]; + 68 [label="Throw: throw R|java/lang/Exception.Exception|()"]; + 69 [label="Stub" style="filled" fillcolor=gray]; + 70 [label="Exit block" style="filled" fillcolor=gray]; + } + 71 [label="Exit init block" style="filled" fillcolor=red style="filled" fillcolor=gray]; + } 64 [label="Exit class GetterLocalClass" style="filled" fillcolor=red style="filled" fillcolor=gray]; } + subgraph cluster_15 { + color=blue + 72 [label="Enter function " style="filled" fillcolor=red]; + 73 [label="Delegated constructor call: super()" style="filled" fillcolor=yellow]; + 74 [label="Exit function " style="filled" fillcolor=red]; + } 57 -> {58}; 58 -> {59}; - 58 -> {65 68} [color=red]; + 58 -> {65 72} [color=red]; 59 -> {60}; - 59 -> {62 65} [color=green]; - 59 -> {62 65} [style=dashed]; + 59 -> {62 72} [color=green]; + 59 -> {62 72} [style=dashed]; 60 -> {61}; 62 -> {63} [color=green]; - 63 -> {68} [color=green]; + 63 -> {65} [color=green]; 63 -> {64} [style=dotted]; - 63 -> {68} [style=dashed]; + 63 -> {65} [style=dashed]; + 65 -> {66}; + 66 -> {67}; + 67 -> {68}; + 68 -> {69} [style=dotted]; + 69 -> {70} [style=dotted]; + 70 -> {71} [style=dotted]; + 71 -> {64} [style=dotted]; + 72 -> {73}; + 73 -> {74}; subgraph cluster_16 { - color=red - 65 [label="Enter function " style="filled" fillcolor=red]; - 66 [label="Delegated constructor call: super()" style="filled" fillcolor=yellow]; - 67 [label="Exit function " style="filled" fillcolor=red]; - } - 65 -> {66}; - 66 -> {67}; - - subgraph cluster_17 { - color=red - 68 [label="Enter init block" style="filled" fillcolor=red]; - subgraph cluster_18 { - color=blue - 69 [label="Enter block"]; - 70 [label="Function call: R|java/lang/Exception.Exception|()" style="filled" fillcolor=yellow]; - 71 [label="Throw: throw R|java/lang/Exception.Exception|()"]; - 72 [label="Stub" style="filled" fillcolor=gray]; - 73 [label="Exit block" style="filled" fillcolor=gray]; - } - 74 [label="Exit init block" style="filled" fillcolor=red style="filled" fillcolor=gray]; - } - 68 -> {69}; - 69 -> {70}; - 70 -> {71}; - 71 -> {72} [style=dotted]; - 72 -> {73} [style=dotted]; - 73 -> {74} [style=dotted]; - 74 -> {64} [style=dotted]; - - subgraph cluster_19 { color=red 75 [label="Enter property" style="filled" fillcolor=red]; 76 [label="Postponed enter to lambda"]; - subgraph cluster_20 { + subgraph cluster_17 { color=blue 24 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; - subgraph cluster_21 { + subgraph cluster_18 { color=blue 25 [label="Enter block"]; 26 [label="Exit local class "]; @@ -213,12 +179,32 @@ digraph propertiesAndInitBlocks_kt { } 31 [label="Exit function anonymousFunction" style="filled" fillcolor=red style="filled" fillcolor=gray]; } - subgraph cluster_22 { + subgraph cluster_19 { color=blue 32 [label="Enter class InitializerLocalClass" style="filled" fillcolor=red]; 33 [label="Part of class initialization"]; + subgraph cluster_20 { + color=blue + 35 [label="Enter init block" style="filled" fillcolor=red]; + subgraph cluster_21 { + color=blue + 36 [label="Enter block"]; + 37 [label="Function call: R|java/lang/Exception.Exception|()" style="filled" fillcolor=yellow]; + 38 [label="Throw: throw R|java/lang/Exception.Exception|()"]; + 39 [label="Stub" style="filled" fillcolor=gray]; + 40 [label="Const: Int(1)" style="filled" fillcolor=gray]; + 41 [label="Exit block" style="filled" fillcolor=gray]; + } + 42 [label="Exit init block" style="filled" fillcolor=red style="filled" fillcolor=gray]; + } 34 [label="Exit class InitializerLocalClass" style="filled" fillcolor=red style="filled" fillcolor=gray]; } + subgraph cluster_22 { + color=blue + 43 [label="Enter function " style="filled" fillcolor=red]; + 44 [label="Delegated constructor call: super()" style="filled" fillcolor=yellow]; + 45 [label="Exit function " style="filled" fillcolor=red]; + } 77 [label="Postponed exit from lambda"]; 78 [label="Function call: R|/run|(...)" style="filled" fillcolor=yellow]; 79 [label="Exit property" style="filled" fillcolor=red]; @@ -231,19 +217,29 @@ digraph propertiesAndInitBlocks_kt { 78 -> {79}; 24 -> {25}; 25 -> {26}; - 25 -> {35 46 49} [color=red]; + 25 -> {35 43 46} [color=red]; 26 -> {27}; - 26 -> {32 46} [color=green]; - 26 -> {32 46} [style=dashed]; + 26 -> {32 43} [color=green]; + 26 -> {32 43} [style=dashed]; 27 -> {28}; 28 -> {29} [style=dotted]; 29 -> {30} [style=dotted]; 30 -> {31} [style=dotted]; 31 -> {77} [style=dotted]; 32 -> {33} [color=green]; - 33 -> {49} [color=green]; + 33 -> {35} [color=green]; 33 -> {34} [style=dotted]; - 33 -> {49} [style=dashed]; + 33 -> {35} [style=dashed]; + 35 -> {36}; + 36 -> {37}; + 37 -> {38}; + 38 -> {39} [style=dotted]; + 39 -> {40} [style=dotted]; + 40 -> {41} [style=dotted]; + 41 -> {42} [style=dotted]; + 42 -> {34} [style=dotted]; + 43 -> {44}; + 44 -> {45}; subgraph cluster_23 { color=red diff --git a/compiler/fir/analysis-tests/testData/resolve/problems/secondaryConstructorCfg.dot b/compiler/fir/analysis-tests/testData/resolve/problems/secondaryConstructorCfg.dot index 3cd7f9640f1..a74202a9081 100644 --- a/compiler/fir/analysis-tests/testData/resolve/problems/secondaryConstructorCfg.dot +++ b/compiler/fir/analysis-tests/testData/resolve/problems/secondaryConstructorCfg.dot @@ -13,33 +13,11 @@ digraph secondaryConstructorCfg_kt { 1 -> {2}; subgraph cluster_1 { - color=red - 3 [label="Enter property" style="filled" fillcolor=red]; - 4 [label="Access variable R|/p0|"]; - 5 [label="Exit property" style="filled" fillcolor=red]; - } - 3 -> {4}; - 4 -> {5}; - 5 -> {29} [color=green]; - - subgraph cluster_2 { - color=red - 6 [label="Enter property" style="filled" fillcolor=red]; - 7 [label="Access variable R|/p0|"]; - 8 [label="Access variable R|kotlin/String.length|"]; - 9 [label="Exit property" style="filled" fillcolor=red]; - } - 6 -> {7}; - 7 -> {8}; - 8 -> {9}; - 9 -> {30} [color=green]; - - subgraph cluster_3 { color=red 10 [label="Enter function " style="filled" fillcolor=red]; 11 [label="Access variable R|/p0|"]; 12 [label="Delegated constructor call: this(...)" style="filled" fillcolor=yellow]; - subgraph cluster_4 { + subgraph cluster_2 { color=blue 13 [label="Enter block"]; 14 [label="Access variable R|/p1|"]; @@ -56,37 +34,40 @@ digraph secondaryConstructorCfg_kt { 15 -> {16}; 16 -> {17}; - subgraph cluster_5 { - color=red - 18 [label="Enter init block" style="filled" fillcolor=red]; - subgraph cluster_6 { - color=blue - 19 [label="Enter block"]; - 20 [label="Access variable R|/p0|"]; - 21 [label="Access variable R|kotlin/String.length|"]; - 22 [label="Assignment: R|/B.p1|"]; - 23 [label="Const: String()"]; - 24 [label="Assignment: R|/B.p3|"]; - 25 [label="Exit block"]; - } - 26 [label="Exit init block" style="filled" fillcolor=red]; - } - 18 -> {19}; - 19 -> {20}; - 20 -> {21}; - 21 -> {22}; - 22 -> {23}; - 23 -> {24}; - 24 -> {25}; - 25 -> {26}; - 26 -> {31} [color=green]; - - subgraph cluster_7 { + subgraph cluster_3 { color=red 27 [label="Enter class B" style="filled" fillcolor=red]; 28 [label="Part of class initialization"]; + subgraph cluster_4 { + color=blue + 3 [label="Enter property" style="filled" fillcolor=red]; + 4 [label="Access variable R|/p0|"]; + 5 [label="Exit property" style="filled" fillcolor=red]; + } 29 [label="Part of class initialization"]; + subgraph cluster_5 { + color=blue + 6 [label="Enter property" style="filled" fillcolor=red]; + 7 [label="Access variable R|/p0|"]; + 8 [label="Access variable R|kotlin/String.length|"]; + 9 [label="Exit property" style="filled" fillcolor=red]; + } 30 [label="Part of class initialization"]; + subgraph cluster_6 { + color=blue + 18 [label="Enter init block" style="filled" fillcolor=red]; + subgraph cluster_7 { + color=blue + 19 [label="Enter block"]; + 20 [label="Access variable R|/p0|"]; + 21 [label="Access variable R|kotlin/String.length|"]; + 22 [label="Assignment: R|/B.p1|"]; + 23 [label="Const: String()"]; + 24 [label="Assignment: R|/B.p3|"]; + 25 [label="Exit block"]; + } + 26 [label="Exit init block" style="filled" fillcolor=red]; + } 31 [label="Exit class B" style="filled" fillcolor=red]; } 27 -> {28} [color=green]; @@ -99,5 +80,21 @@ digraph secondaryConstructorCfg_kt { 30 -> {18} [color=green]; 30 -> {31} [style=dotted]; 30 -> {18} [style=dashed]; + 3 -> {4}; + 4 -> {5}; + 5 -> {29} [color=green]; + 6 -> {7}; + 7 -> {8}; + 8 -> {9}; + 9 -> {30} [color=green]; + 18 -> {19}; + 19 -> {20}; + 20 -> {21}; + 21 -> {22}; + 22 -> {23}; + 23 -> {24}; + 24 -> {25}; + 25 -> {26}; + 26 -> {31} [color=green]; } diff --git a/compiler/fir/analysis-tests/testData/resolve/smartcasts/boundSmartcasts/boundSmartcasts.dot b/compiler/fir/analysis-tests/testData/resolve/smartcasts/boundSmartcasts/boundSmartcasts.dot index e842ea045bc..5d781d22500 100644 --- a/compiler/fir/analysis-tests/testData/resolve/smartcasts/boundSmartcasts/boundSmartcasts.dot +++ b/compiler/fir/analysis-tests/testData/resolve/smartcasts/boundSmartcasts/boundSmartcasts.dot @@ -344,25 +344,24 @@ digraph boundSmartcasts_kt { 126 -> {127}; subgraph cluster_28 { - color=red - 128 [label="Enter property" style="filled" fillcolor=red]; - 129 [label="Access variable R|/any|"]; - 130 [label="Exit property" style="filled" fillcolor=red]; - } - 128 -> {129}; - 129 -> {130}; - 130 -> {133} [color=green]; - - subgraph cluster_29 { color=red 131 [label="Enter class D" style="filled" fillcolor=red]; 132 [label="Part of class initialization"]; + subgraph cluster_29 { + color=blue + 128 [label="Enter property" style="filled" fillcolor=red]; + 129 [label="Access variable R|/any|"]; + 130 [label="Exit property" style="filled" fillcolor=red]; + } 133 [label="Exit class D" style="filled" fillcolor=red]; } 131 -> {132} [color=green]; 132 -> {128} [color=green]; 132 -> {133} [style=dotted]; 132 -> {128} [style=dashed]; + 128 -> {129}; + 129 -> {130}; + 130 -> {133} [color=green]; subgraph cluster_30 { color=red diff --git a/compiler/fir/analysis-tests/testData/resolve/smartcasts/boundSmartcasts/boundSmartcastsInBranches.dot b/compiler/fir/analysis-tests/testData/resolve/smartcasts/boundSmartcasts/boundSmartcastsInBranches.dot index acbacb096f4..3287af23d76 100644 --- a/compiler/fir/analysis-tests/testData/resolve/smartcasts/boundSmartcasts/boundSmartcastsInBranches.dot +++ b/compiler/fir/analysis-tests/testData/resolve/smartcasts/boundSmartcasts/boundSmartcastsInBranches.dot @@ -13,25 +13,24 @@ digraph boundSmartcastsInBranches_kt { 1 -> {2}; subgraph cluster_1 { - color=red - 3 [label="Enter property" style="filled" fillcolor=red]; - 4 [label="Const: String()"]; - 5 [label="Exit property" style="filled" fillcolor=red]; - } - 3 -> {4}; - 4 -> {5}; - 5 -> {8} [color=green]; - - subgraph cluster_2 { color=red 6 [label="Enter class A" style="filled" fillcolor=red]; 7 [label="Part of class initialization"]; + subgraph cluster_2 { + color=blue + 3 [label="Enter property" style="filled" fillcolor=red]; + 4 [label="Const: String()"]; + 5 [label="Exit property" style="filled" fillcolor=red]; + } 8 [label="Exit class A" style="filled" fillcolor=red]; } 6 -> {7} [color=green]; 7 -> {3} [color=green]; 7 -> {8} [style=dotted]; 7 -> {3} [style=dashed]; + 3 -> {4}; + 4 -> {5}; + 5 -> {8} [color=green]; subgraph cluster_3 { color=red diff --git a/compiler/fir/analysis-tests/testData/resolve/smartcasts/boundSmartcasts/functionCallBound.dot b/compiler/fir/analysis-tests/testData/resolve/smartcasts/boundSmartcasts/functionCallBound.dot index e1a245f3fd0..e410b753796 100644 --- a/compiler/fir/analysis-tests/testData/resolve/smartcasts/boundSmartcasts/functionCallBound.dot +++ b/compiler/fir/analysis-tests/testData/resolve/smartcasts/boundSmartcasts/functionCallBound.dot @@ -29,25 +29,24 @@ digraph functionCallBound_kt { 6 -> {7}; subgraph cluster_3 { - color=red - 8 [label="Enter property" style="filled" fillcolor=red]; - 9 [label="Access variable R|/data|"]; - 10 [label="Exit property" style="filled" fillcolor=red]; - } - 8 -> {9}; - 9 -> {10}; - 10 -> {13} [color=green]; - - subgraph cluster_4 { color=red 11 [label="Enter class Sub" style="filled" fillcolor=red]; 12 [label="Part of class initialization"]; + subgraph cluster_4 { + color=blue + 8 [label="Enter property" style="filled" fillcolor=red]; + 9 [label="Access variable R|/data|"]; + 10 [label="Exit property" style="filled" fillcolor=red]; + } 13 [label="Exit class Sub" style="filled" fillcolor=red]; } 11 -> {12} [color=green]; 12 -> {8} [color=green]; 12 -> {13} [style=dotted]; 12 -> {8} [style=dashed]; + 8 -> {9}; + 9 -> {10}; + 10 -> {13} [color=green]; subgraph cluster_5 { color=red diff --git a/compiler/fir/analysis-tests/testData/resolve/smartcasts/lambdas/lambdaInWhenBranch.dot b/compiler/fir/analysis-tests/testData/resolve/smartcasts/lambdas/lambdaInWhenBranch.dot index 5e5345f9fd5..ed7d35fb551 100644 --- a/compiler/fir/analysis-tests/testData/resolve/smartcasts/lambdas/lambdaInWhenBranch.dot +++ b/compiler/fir/analysis-tests/testData/resolve/smartcasts/lambdas/lambdaInWhenBranch.dot @@ -29,26 +29,16 @@ digraph lambdaInWhenBranch_kt { 6 -> {7}; subgraph cluster_3 { - color=red - 8 [label="Enter property" style="filled" fillcolor=red]; - 9 [label="Access variable R|/t|"]; - 10 [label="Exit property" style="filled" fillcolor=red]; - } - 8 -> {9}; - 9 -> {10}; - 10 -> {20} [color=green]; - - subgraph cluster_4 { color=red 11 [label="Enter function component1" style="filled" fillcolor=red]; 12 [label="Exit function component1" style="filled" fillcolor=red]; } 11 -> {12}; - subgraph cluster_5 { + subgraph cluster_4 { color=red 13 [label="Enter function copy" style="filled" fillcolor=red]; - subgraph cluster_6 { + subgraph cluster_5 { color=blue 15 [label="Enter default value of t" style="filled" fillcolor=red]; 16 [label="Access variable R|/SubClass1.t|"]; @@ -61,16 +51,25 @@ digraph lambdaInWhenBranch_kt { 15 -> {15} [style=dashed]; 16 -> {17}; - subgraph cluster_7 { + subgraph cluster_6 { color=red 18 [label="Enter class SubClass1" style="filled" fillcolor=red]; 19 [label="Part of class initialization"]; + subgraph cluster_7 { + color=blue + 8 [label="Enter property" style="filled" fillcolor=red]; + 9 [label="Access variable R|/t|"]; + 10 [label="Exit property" style="filled" fillcolor=red]; + } 20 [label="Exit class SubClass1" style="filled" fillcolor=red]; } 18 -> {19} [color=green]; 19 -> {8} [color=green]; 19 -> {20} [style=dotted]; 19 -> {8} [style=dashed]; + 8 -> {9}; + 9 -> {10}; + 10 -> {20} [color=green]; subgraph cluster_8 { color=red diff --git a/compiler/fir/analysis-tests/testData/resolve/smartcasts/nullability.dot b/compiler/fir/analysis-tests/testData/resolve/smartcasts/nullability.dot index 9592fce5624..66b6311854c 100644 --- a/compiler/fir/analysis-tests/testData/resolve/smartcasts/nullability.dot +++ b/compiler/fir/analysis-tests/testData/resolve/smartcasts/nullability.dot @@ -62,19 +62,9 @@ digraph nullability_kt { 15 -> {16}; subgraph cluster_8 { - color=red - 17 [label="Enter property" style="filled" fillcolor=red]; - 18 [label="Access variable R|/data|"]; - 19 [label="Exit property" style="filled" fillcolor=red]; - } - 17 -> {18}; - 18 -> {19}; - 19 -> {29} [color=green]; - - subgraph cluster_9 { color=red 20 [label="Enter function fdata" style="filled" fillcolor=red]; - subgraph cluster_10 { + subgraph cluster_9 { color=blue 21 [label="Enter block"]; 22 [label="Const: Null(null)"]; @@ -92,16 +82,25 @@ digraph nullability_kt { 24 -> {25} [style=dotted]; 25 -> {26} [style=dotted]; - subgraph cluster_11 { + subgraph cluster_10 { color=red 27 [label="Enter class QImpl" style="filled" fillcolor=red]; 28 [label="Part of class initialization"]; + subgraph cluster_11 { + color=blue + 17 [label="Enter property" style="filled" fillcolor=red]; + 18 [label="Access variable R|/data|"]; + 19 [label="Exit property" style="filled" fillcolor=red]; + } 29 [label="Exit class QImpl" style="filled" fillcolor=red]; } 27 -> {28} [color=green]; 28 -> {17} [color=green]; 28 -> {29} [style=dotted]; 28 -> {17} [style=dashed]; + 17 -> {18}; + 18 -> {19}; + 19 -> {29} [color=green]; subgraph cluster_12 { color=red @@ -113,19 +112,9 @@ digraph nullability_kt { 31 -> {32}; subgraph cluster_13 { - color=red - 33 [label="Enter property" style="filled" fillcolor=red]; - 34 [label="Access variable R|/data|"]; - 35 [label="Exit property" style="filled" fillcolor=red]; - } - 33 -> {34}; - 34 -> {35}; - 35 -> {45} [color=green]; - - subgraph cluster_14 { color=red 36 [label="Enter function fdata" style="filled" fillcolor=red]; - subgraph cluster_15 { + subgraph cluster_14 { color=blue 37 [label="Enter block"]; 38 [label="Const: Null(null)"]; @@ -143,16 +132,25 @@ digraph nullability_kt { 40 -> {41} [style=dotted]; 41 -> {42} [style=dotted]; - subgraph cluster_16 { + subgraph cluster_15 { color=red 43 [label="Enter class QImplMutable" style="filled" fillcolor=red]; 44 [label="Part of class initialization"]; + subgraph cluster_16 { + color=blue + 33 [label="Enter property" style="filled" fillcolor=red]; + 34 [label="Access variable R|/data|"]; + 35 [label="Exit property" style="filled" fillcolor=red]; + } 45 [label="Exit class QImplMutable" style="filled" fillcolor=red]; } 43 -> {44} [color=green]; 44 -> {33} [color=green]; 44 -> {45} [style=dotted]; 44 -> {33} [style=dashed]; + 33 -> {34}; + 34 -> {35}; + 35 -> {45} [color=green]; subgraph cluster_17 { color=red diff --git a/compiler/fir/analysis-tests/testData/resolve/smartcasts/safeCalls/assignSafeCall.dot b/compiler/fir/analysis-tests/testData/resolve/smartcasts/safeCalls/assignSafeCall.dot index 59165faaf7f..21d83868481 100644 --- a/compiler/fir/analysis-tests/testData/resolve/smartcasts/safeCalls/assignSafeCall.dot +++ b/compiler/fir/analysis-tests/testData/resolve/smartcasts/safeCalls/assignSafeCall.dot @@ -34,19 +34,9 @@ digraph assignSafeCall_kt { 8 -> {9} [style=dotted]; subgraph cluster_3 { - color=red - 10 [label="Enter property" style="filled" fillcolor=red]; - 11 [label="Const: Int(1)"]; - 12 [label="Exit property" style="filled" fillcolor=red]; - } - 10 -> {11}; - 11 -> {12}; - 12 -> {19} [color=green]; - - subgraph cluster_4 { color=red 13 [label="Enter function bar" style="filled" fillcolor=red]; - subgraph cluster_5 { + subgraph cluster_4 { color=blue 14 [label="Enter block"]; 15 [label="Exit block"]; @@ -57,16 +47,25 @@ digraph assignSafeCall_kt { 14 -> {15}; 15 -> {16}; - subgraph cluster_6 { + subgraph cluster_5 { color=red 17 [label="Enter class A" style="filled" fillcolor=red]; 18 [label="Part of class initialization"]; + subgraph cluster_6 { + color=blue + 10 [label="Enter property" style="filled" fillcolor=red]; + 11 [label="Const: Int(1)"]; + 12 [label="Exit property" style="filled" fillcolor=red]; + } 19 [label="Exit class A" style="filled" fillcolor=red]; } 17 -> {18} [color=green]; 18 -> {10} [color=green]; 18 -> {19} [style=dotted]; 18 -> {10} [style=dashed]; + 10 -> {11}; + 11 -> {12}; + 12 -> {19} [color=green]; subgraph cluster_7 { color=red diff --git a/compiler/fir/analysis-tests/testData/resolve/smartcasts/smartCastInInit.dot b/compiler/fir/analysis-tests/testData/resolve/smartcasts/smartCastInInit.dot index 5d34587a3a3..357bd9dde49 100644 --- a/compiler/fir/analysis-tests/testData/resolve/smartcasts/smartCastInInit.dot +++ b/compiler/fir/analysis-tests/testData/resolve/smartcasts/smartCastInInit.dot @@ -57,19 +57,29 @@ digraph smartCastInInit_kt { subgraph cluster_6 { color=red - 17 [label="Enter init block" style="filled" fillcolor=red]; + 26 [label="Enter class Main" style="filled" fillcolor=red]; + 27 [label="Part of class initialization"]; subgraph cluster_7 { color=blue - 18 [label="Enter block"]; - 19 [label="Function call: R|/s|()" style="filled" fillcolor=yellow]; - 20 [label="Assignment: R|/Main.x|"]; - 21 [label="Access variable R|/Main.x|"]; - 22 [label="Smart cast: this@R|/Main|.R|/Main.x|"]; - 23 [label="Function call: this@R|/Main|.R|/Main.x|.R|/S.foo|()" style="filled" fillcolor=yellow]; - 24 [label="Exit block"]; + 17 [label="Enter init block" style="filled" fillcolor=red]; + subgraph cluster_8 { + color=blue + 18 [label="Enter block"]; + 19 [label="Function call: R|/s|()" style="filled" fillcolor=yellow]; + 20 [label="Assignment: R|/Main.x|"]; + 21 [label="Access variable R|/Main.x|"]; + 22 [label="Smart cast: this@R|/Main|.R|/Main.x|"]; + 23 [label="Function call: this@R|/Main|.R|/Main.x|.R|/S.foo|()" style="filled" fillcolor=yellow]; + 24 [label="Exit block"]; + } + 25 [label="Exit init block" style="filled" fillcolor=red]; } - 25 [label="Exit init block" style="filled" fillcolor=red]; + 28 [label="Exit class Main" style="filled" fillcolor=red]; } + 26 -> {27} [color=green]; + 27 -> {17} [color=green]; + 27 -> {28} [style=dotted]; + 27 -> {17} [style=dashed]; 17 -> {18}; 18 -> {19}; 19 -> {20}; @@ -80,15 +90,4 @@ digraph smartCastInInit_kt { 24 -> {25}; 25 -> {28} [color=green]; - subgraph cluster_8 { - color=red - 26 [label="Enter class Main" style="filled" fillcolor=red]; - 27 [label="Part of class initialization"]; - 28 [label="Exit class Main" style="filled" fillcolor=red]; - } - 26 -> {27} [color=green]; - 27 -> {17} [color=green]; - 27 -> {28} [style=dotted]; - 27 -> {17} [style=dashed]; - } diff --git a/compiler/fir/analysis-tests/testData/resolve/smartcasts/smartcastInByClause.dot b/compiler/fir/analysis-tests/testData/resolve/smartcasts/smartcastInByClause.dot index f4a7027ae6c..fb2223cf49c 100644 --- a/compiler/fir/analysis-tests/testData/resolve/smartcasts/smartcastInByClause.dot +++ b/compiler/fir/analysis-tests/testData/resolve/smartcasts/smartcastInByClause.dot @@ -13,30 +13,22 @@ digraph smartcastInByClause_kt { 1 -> {2}; subgraph cluster_1 { - color=red - 3 [label="Enter property" style="filled" fillcolor=red]; - 4 [label="Access variable R|/path|"]; - 5 [label="Exit property" style="filled" fillcolor=red]; - } - 3 -> {4}; - 4 -> {5}; - 5 -> {11} [color=green]; - - subgraph cluster_2 { - color=red - 6 [label="Enter property" style="filled" fillcolor=red]; - 7 [label="Access variable R|/index|"]; - 8 [label="Exit property" style="filled" fillcolor=red]; - } - 6 -> {7}; - 7 -> {8}; - 8 -> {12} [color=green]; - - subgraph cluster_3 { color=red 9 [label="Enter class A" style="filled" fillcolor=red]; 10 [label="Part of class initialization"]; + subgraph cluster_2 { + color=blue + 3 [label="Enter property" style="filled" fillcolor=red]; + 4 [label="Access variable R|/path|"]; + 5 [label="Exit property" style="filled" fillcolor=red]; + } 11 [label="Part of class initialization"]; + subgraph cluster_3 { + color=blue + 6 [label="Enter property" style="filled" fillcolor=red]; + 7 [label="Access variable R|/index|"]; + 8 [label="Exit property" style="filled" fillcolor=red]; + } 12 [label="Exit class A" style="filled" fillcolor=red]; } 9 -> {10} [color=green]; @@ -46,6 +38,12 @@ digraph smartcastInByClause_kt { 11 -> {6} [color=green]; 11 -> {12} [style=dotted]; 11 -> {6} [style=dashed]; + 3 -> {4}; + 4 -> {5}; + 5 -> {11} [color=green]; + 6 -> {7}; + 7 -> {8}; + 8 -> {12} [color=green]; subgraph cluster_4 { color=red @@ -64,25 +62,24 @@ digraph smartcastInByClause_kt { 16 -> {17}; subgraph cluster_6 { - color=red - 18 [label="Enter property" style="filled" fillcolor=red]; - 19 [label="Access variable R|/index|"]; - 20 [label="Exit property" style="filled" fillcolor=red]; - } - 18 -> {19}; - 19 -> {20}; - 20 -> {23} [color=green]; - - subgraph cluster_7 { color=red 21 [label="Enter class Derived" style="filled" fillcolor=red]; 22 [label="Part of class initialization"]; + subgraph cluster_7 { + color=blue + 18 [label="Enter property" style="filled" fillcolor=red]; + 19 [label="Access variable R|/index|"]; + 20 [label="Exit property" style="filled" fillcolor=red]; + } 23 [label="Exit class Derived" style="filled" fillcolor=red]; } 21 -> {22} [color=green]; 22 -> {18} [color=green]; 22 -> {23} [style=dotted]; 22 -> {18} [style=dashed]; + 18 -> {19}; + 19 -> {20}; + 20 -> {23} [color=green]; subgraph cluster_8 { color=red @@ -111,7 +108,24 @@ digraph smartcastInByClause_kt { color=blue 49 [label="Enter class " style="filled" fillcolor=red]; 50 [label="Part of class initialization"]; + subgraph cluster_11 { + color=blue + 53 [label="Enter field" style="filled" fillcolor=red]; + 54 [label="Access variable R|/a|"]; + 55 [label="Smart cast: R|/a|"]; + 56 [label="Access variable R|/A.index|"]; + 57 [label="Function call: R|/Derived.Derived|(...)" style="filled" fillcolor=yellow]; + 58 [label="Exit field" style="filled" fillcolor=red]; + } 51 [label="Part of class initialization"]; + subgraph cluster_12 { + color=blue + 59 [label="Enter property" style="filled" fillcolor=red]; + 60 [label="Access variable R|/a|"]; + 61 [label="Smart cast: R|/a|"]; + 62 [label="Access variable R|/A.index|"]; + 63 [label="Exit property" style="filled" fillcolor=red]; + } 52 [label="Exit class " style="filled" fillcolor=red]; } 43 [label="Exit anonymous object"]; @@ -137,6 +151,26 @@ digraph smartcastInByClause_kt { } 48 [label="Exit function test" style="filled" fillcolor=red]; } + subgraph cluster_13 { + color=blue + 67 [label="Enter function foo" style="filled" fillcolor=red]; + subgraph cluster_14 { + color=blue + 68 [label="Enter block"]; + 69 [label="Access variable R|/a|"]; + 70 [label="Smart cast: R|/a|"]; + 71 [label="Access variable R|/A.index|"]; + 72 [label="Function call: R|/takeInt|(...)" style="filled" fillcolor=yellow]; + 73 [label="Exit block"]; + } + 74 [label="Exit function foo" style="filled" fillcolor=red]; + } + subgraph cluster_15 { + color=blue + 64 [label="Enter function " style="filled" fillcolor=red]; + 65 [label="Delegated constructor call: super()" style="filled" fillcolor=yellow]; + 66 [label="Exit function " style="filled" fillcolor=red]; + } 24 -> {25}; 25 -> {26}; 26 -> {27 31}; @@ -156,80 +190,39 @@ digraph smartcastInByClause_kt { 39 -> {40}; 40 -> {41}; 41 -> {42}; - 41 -> {53 56 62 67} [color=red]; + 41 -> {53 59 64 67} [color=red]; 42 -> {49} [color=green]; 42 -> {43} [color=red]; 42 -> {49} [style=dashed]; 43 -> {44}; - 43 -> {53 67} [color=green]; - 43 -> {53 67} [style=dashed]; + 43 -> {64 67} [color=green]; + 43 -> {64 67} [style=dashed]; 44 -> {45}; 45 -> {48}; 45 -> {46} [style=dotted]; 46 -> {47} [style=dotted]; 47 -> {48} [style=dotted]; 49 -> {50} [color=green]; - 50 -> {56} [color=green]; + 50 -> {53} [color=green]; 50 -> {51} [style=dotted]; - 50 -> {56} [style=dashed]; - 51 -> {62} [color=green]; + 50 -> {53} [style=dashed]; + 51 -> {59} [color=green]; 51 -> {52} [style=dotted]; - 51 -> {62} [style=dashed]; + 51 -> {59} [style=dashed]; 52 -> {43} [color=green]; - - subgraph cluster_11 { - color=red - 53 [label="Enter function " style="filled" fillcolor=red]; - 54 [label="Delegated constructor call: super()" style="filled" fillcolor=yellow]; - 55 [label="Exit function " style="filled" fillcolor=red]; - } 53 -> {54}; 54 -> {55}; - - subgraph cluster_12 { - color=red - 56 [label="Enter field" style="filled" fillcolor=red]; - 57 [label="Access variable R|/a|"]; - 58 [label="Smart cast: R|/a|"]; - 59 [label="Access variable R|/A.index|"]; - 60 [label="Function call: R|/Derived.Derived|(...)" style="filled" fillcolor=yellow]; - 61 [label="Exit field" style="filled" fillcolor=red]; - } + 55 -> {56}; 56 -> {57}; 57 -> {58}; - 58 -> {59}; + 58 -> {51} [color=green]; 59 -> {60}; 60 -> {61}; - 61 -> {51} [color=green]; - - subgraph cluster_13 { - color=red - 62 [label="Enter property" style="filled" fillcolor=red]; - 63 [label="Access variable R|/a|"]; - 64 [label="Smart cast: R|/a|"]; - 65 [label="Access variable R|/A.index|"]; - 66 [label="Exit property" style="filled" fillcolor=red]; - } + 61 -> {62}; 62 -> {63}; - 63 -> {64}; + 63 -> {52} [color=green]; 64 -> {65}; 65 -> {66}; - 66 -> {52} [color=green]; - - subgraph cluster_14 { - color=red - 67 [label="Enter function foo" style="filled" fillcolor=red]; - subgraph cluster_15 { - color=blue - 68 [label="Enter block"]; - 69 [label="Access variable R|/a|"]; - 70 [label="Smart cast: R|/a|"]; - 71 [label="Access variable R|/A.index|"]; - 72 [label="Function call: R|/takeInt|(...)" style="filled" fillcolor=yellow]; - 73 [label="Exit block"]; - } - 74 [label="Exit function foo" style="filled" fillcolor=red]; - } 67 -> {68}; 68 -> {69}; 69 -> {70}; diff --git a/compiler/fir/analysis-tests/testData/resolve/smartcasts/smartcastToNothing.dot b/compiler/fir/analysis-tests/testData/resolve/smartcasts/smartcastToNothing.dot index f175de45f4c..50a72e9edd4 100644 --- a/compiler/fir/analysis-tests/testData/resolve/smartcasts/smartcastToNothing.dot +++ b/compiler/fir/analysis-tests/testData/resolve/smartcasts/smartcastToNothing.dot @@ -124,30 +124,22 @@ digraph smartcastToNothing_kt { 40 -> {41}; subgraph cluster_11 { - color=red - 42 [label="Enter property" style="filled" fillcolor=red]; - 43 [label="Const: Int(1)"]; - 44 [label="Exit property" style="filled" fillcolor=red]; - } - 42 -> {43}; - 43 -> {44}; - 44 -> {50} [color=green]; - - subgraph cluster_12 { - color=red - 45 [label="Enter property" style="filled" fillcolor=red]; - 46 [label="Const: Boolean(true)"]; - 47 [label="Exit property" style="filled" fillcolor=red]; - } - 45 -> {46}; - 46 -> {47}; - 47 -> {51} [color=green]; - - subgraph cluster_13 { color=red 48 [label="Enter class A" style="filled" fillcolor=red]; 49 [label="Part of class initialization"]; + subgraph cluster_12 { + color=blue + 42 [label="Enter property" style="filled" fillcolor=red]; + 43 [label="Const: Int(1)"]; + 44 [label="Exit property" style="filled" fillcolor=red]; + } 50 [label="Part of class initialization"]; + subgraph cluster_13 { + color=blue + 45 [label="Enter property" style="filled" fillcolor=red]; + 46 [label="Const: Boolean(true)"]; + 47 [label="Exit property" style="filled" fillcolor=red]; + } 51 [label="Exit class A" style="filled" fillcolor=red]; } 48 -> {49} [color=green]; @@ -157,6 +149,12 @@ digraph smartcastToNothing_kt { 50 -> {45} [color=green]; 50 -> {51} [style=dotted]; 50 -> {45} [style=dashed]; + 42 -> {43}; + 43 -> {44}; + 44 -> {50} [color=green]; + 45 -> {46}; + 46 -> {47}; + 47 -> {51} [color=green]; subgraph cluster_14 { color=red diff --git a/compiler/fir/analysis-tests/testData/resolve/smartcasts/stability/overridenOpenVal.dot b/compiler/fir/analysis-tests/testData/resolve/smartcasts/stability/overridenOpenVal.dot index 2adce9b06fa..5babd342796 100644 --- a/compiler/fir/analysis-tests/testData/resolve/smartcasts/stability/overridenOpenVal.dot +++ b/compiler/fir/analysis-tests/testData/resolve/smartcasts/stability/overridenOpenVal.dot @@ -13,25 +13,24 @@ digraph overridenOpenVal_kt { 1 -> {2}; subgraph cluster_1 { - color=red - 3 [label="Enter property" style="filled" fillcolor=red]; - 4 [label="Access variable R|/x|"]; - 5 [label="Exit property" style="filled" fillcolor=red]; - } - 3 -> {4}; - 4 -> {5}; - 5 -> {8} [color=green]; - - subgraph cluster_2 { color=red 6 [label="Enter class A" style="filled" fillcolor=red]; 7 [label="Part of class initialization"]; + subgraph cluster_2 { + color=blue + 3 [label="Enter property" style="filled" fillcolor=red]; + 4 [label="Access variable R|/x|"]; + 5 [label="Exit property" style="filled" fillcolor=red]; + } 8 [label="Exit class A" style="filled" fillcolor=red]; } 6 -> {7} [color=green]; 7 -> {3} [color=green]; 7 -> {8} [style=dotted]; 7 -> {3} [style=dashed]; + 3 -> {4}; + 4 -> {5}; + 5 -> {8} [color=green]; subgraph cluster_3 { color=red diff --git a/compiler/fir/analysis-tests/testData/resolveWithStdlib/contracts/fromSource/bad/callsInPlace/inAnonymousObject.dot b/compiler/fir/analysis-tests/testData/resolveWithStdlib/contracts/fromSource/bad/callsInPlace/inAnonymousObject.dot index f7681b40c92..163bccae457 100644 --- a/compiler/fir/analysis-tests/testData/resolveWithStdlib/contracts/fromSource/bad/callsInPlace/inAnonymousObject.dot +++ b/compiler/fir/analysis-tests/testData/resolveWithStdlib/contracts/fromSource/bad/callsInPlace/inAnonymousObject.dot @@ -19,7 +19,25 @@ digraph inAnonymousObject_kt { color=blue 13 [label="Enter class " style="filled" fillcolor=red]; 14 [label="Part of class initialization"]; + subgraph cluster_4 { + color=blue + 17 [label="Enter property" style="filled" fillcolor=red]; + 18 [label="Access variable R|/a|"]; + 19 [label="Exit property" style="filled" fillcolor=red]; + } 15 [label="Part of class initialization"]; + subgraph cluster_5 { + color=blue + 20 [label="Enter init block" style="filled" fillcolor=red]; + subgraph cluster_6 { + color=blue + 21 [label="Enter block"]; + 22 [label="Access variable R|/b|"]; + 23 [label="Assignment: R|/.leaked|"]; + 24 [label="Exit block"]; + } + 25 [label="Exit init block" style="filled" fillcolor=red]; + } 16 [label="Exit class " style="filled" fillcolor=red]; } 5 [label="Exit anonymous object"]; @@ -32,17 +50,34 @@ digraph inAnonymousObject_kt { } 12 [label="Exit function foo" style="filled" fillcolor=red]; } + subgraph cluster_7 { + color=blue + 29 [label="Enter function run" style="filled" fillcolor=red]; + subgraph cluster_8 { + color=blue + 30 [label="Enter block"]; + 31 [label="Function call: R|/c|.R|SubstitutionOverride|()" style="filled" fillcolor=yellow]; + 32 [label="Exit block"]; + } + 33 [label="Exit function run" style="filled" fillcolor=red]; + } + subgraph cluster_9 { + color=blue + 26 [label="Enter function " style="filled" fillcolor=red]; + 27 [label="Delegated constructor call: super()" style="filled" fillcolor=yellow]; + 28 [label="Exit function " style="filled" fillcolor=red]; + } 0 -> {1}; 1 -> {2}; 2 -> {3}; 3 -> {4}; - 3 -> {37 40 43 49} [color=red]; + 3 -> {17 20 26 29} [color=red]; 4 -> {13} [color=green]; 4 -> {5} [color=red]; 4 -> {13} [style=dashed]; 5 -> {6}; - 5 -> {37 49} [color=green]; - 5 -> {37 49} [style=dashed]; + 5 -> {26 29} [color=green]; + 5 -> {26 29} [style=dashed]; 6 -> {7}; 7 -> {8}; 8 -> {9}; @@ -50,66 +85,27 @@ digraph inAnonymousObject_kt { 10 -> {11}; 11 -> {12}; 13 -> {14} [color=green]; - 14 -> {40} [color=green]; + 14 -> {17} [color=green]; 14 -> {15} [style=dotted]; - 14 -> {40} [style=dashed]; - 15 -> {43} [color=green]; + 14 -> {17} [style=dashed]; + 15 -> {20} [color=green]; 15 -> {16} [style=dotted]; - 15 -> {43} [style=dashed]; + 15 -> {20} [style=dashed]; 16 -> {5} [color=green]; - - subgraph cluster_4 { - color=red - 37 [label="Enter function " style="filled" fillcolor=red]; - 38 [label="Delegated constructor call: super()" style="filled" fillcolor=yellow]; - 39 [label="Exit function " style="filled" fillcolor=red]; - } - 37 -> {38}; - 38 -> {39}; - - subgraph cluster_5 { - color=red - 40 [label="Enter property" style="filled" fillcolor=red]; - 41 [label="Access variable R|/a|"]; - 42 [label="Exit property" style="filled" fillcolor=red]; - } - 40 -> {41}; - 41 -> {42}; - 42 -> {15} [color=green]; - - subgraph cluster_6 { - color=red - 43 [label="Enter init block" style="filled" fillcolor=red]; - subgraph cluster_7 { - color=blue - 44 [label="Enter block"]; - 45 [label="Access variable R|/b|"]; - 46 [label="Assignment: R|/.leaked|"]; - 47 [label="Exit block"]; - } - 48 [label="Exit init block" style="filled" fillcolor=red]; - } - 43 -> {44}; - 44 -> {45}; - 45 -> {46}; - 46 -> {47}; - 47 -> {48}; - 48 -> {16} [color=green]; - - subgraph cluster_8 { - color=red - 49 [label="Enter function run" style="filled" fillcolor=red]; - subgraph cluster_9 { - color=blue - 50 [label="Enter block"]; - 51 [label="Function call: R|/c|.R|SubstitutionOverride|()" style="filled" fillcolor=yellow]; - 52 [label="Exit block"]; - } - 53 [label="Exit function run" style="filled" fillcolor=red]; - } - 49 -> {50}; - 50 -> {51}; - 51 -> {52}; - 52 -> {53}; + 17 -> {18}; + 18 -> {19}; + 19 -> {15} [color=green]; + 20 -> {21}; + 21 -> {22}; + 22 -> {23}; + 23 -> {24}; + 24 -> {25}; + 25 -> {16} [color=green]; + 26 -> {27}; + 27 -> {28}; + 29 -> {30}; + 30 -> {31}; + 31 -> {32}; + 32 -> {33}; } diff --git a/compiler/fir/analysis-tests/testData/resolveWithStdlib/contracts/fromSource/bad/callsInPlace/inLocalClass.dot b/compiler/fir/analysis-tests/testData/resolveWithStdlib/contracts/fromSource/bad/callsInPlace/inLocalClass.dot index 654fa6019a7..e23e9716b1c 100644 --- a/compiler/fir/analysis-tests/testData/resolveWithStdlib/contracts/fromSource/bad/callsInPlace/inLocalClass.dot +++ b/compiler/fir/analysis-tests/testData/resolveWithStdlib/contracts/fromSource/bad/callsInPlace/inLocalClass.dot @@ -26,90 +26,86 @@ digraph inLocalClass_kt { color=blue 10 [label="Enter class LocalClass" style="filled" fillcolor=red]; 11 [label="Part of class initialization"]; + subgraph cluster_4 { + color=blue + 29 [label="Enter function run" style="filled" fillcolor=red]; + subgraph cluster_5 { + color=blue + 30 [label="Enter block"]; + 31 [label="Function call: R|/d|.R|SubstitutionOverride|()" style="filled" fillcolor=yellow]; + 32 [label="Exit block"]; + } + 33 [label="Exit function run" style="filled" fillcolor=red]; + } + subgraph cluster_6 { + color=blue + 23 [label="Enter function " style="filled" fillcolor=red]; + 24 [label="Delegated constructor call: super()" style="filled" fillcolor=yellow]; + subgraph cluster_7 { + color=blue + 25 [label="Enter block"]; + 26 [label="Function call: R|/b|.R|SubstitutionOverride|()" style="filled" fillcolor=yellow]; + 27 [label="Exit block"]; + } + 28 [label="Exit function " style="filled" fillcolor=red]; + } + subgraph cluster_8 { + color=blue + 14 [label="Enter property" style="filled" fillcolor=red]; + 15 [label="Access variable R|/a|"]; + 16 [label="Exit property" style="filled" fillcolor=red]; + } 12 [label="Part of class initialization"]; + subgraph cluster_9 { + color=blue + 17 [label="Enter init block" style="filled" fillcolor=red]; + subgraph cluster_10 { + color=blue + 18 [label="Enter block"]; + 19 [label="Access variable R|/c|"]; + 20 [label="Assignment: R|/leaked|"]; + 21 [label="Exit block"]; + } + 22 [label="Exit init block" style="filled" fillcolor=red]; + } 13 [label="Exit class LocalClass" style="filled" fillcolor=red]; } 0 -> {1}; 1 -> {2}; 2 -> {3}; 3 -> {4}; - 3 -> {38 41 47 53} [color=red]; + 3 -> {14 17 23 29} [color=red]; 4 -> {5}; - 4 -> {10 41 53} [color=green]; - 4 -> {10 41 53} [style=dashed]; + 4 -> {10 23 29} [color=green]; + 4 -> {10 23 29} [style=dashed]; 5 -> {6}; 6 -> {7}; 7 -> {8}; 8 -> {9}; 10 -> {11} [color=green]; - 11 -> {38} [color=green]; + 11 -> {14} [color=green]; 11 -> {12} [style=dotted]; - 11 -> {38} [style=dashed]; - 12 -> {47} [color=green]; + 11 -> {14} [style=dashed]; + 12 -> {17} [color=green]; 12 -> {13} [style=dotted]; - 12 -> {47} [style=dashed]; - - subgraph cluster_4 { - color=red - 38 [label="Enter property" style="filled" fillcolor=red]; - 39 [label="Access variable R|/a|"]; - 40 [label="Exit property" style="filled" fillcolor=red]; - } - 38 -> {39}; - 39 -> {40}; - 40 -> {12} [color=green]; - - subgraph cluster_5 { - color=red - 41 [label="Enter function " style="filled" fillcolor=red]; - 42 [label="Delegated constructor call: super()" style="filled" fillcolor=yellow]; - subgraph cluster_6 { - color=blue - 43 [label="Enter block"]; - 44 [label="Function call: R|/b|.R|SubstitutionOverride|()" style="filled" fillcolor=yellow]; - 45 [label="Exit block"]; - } - 46 [label="Exit function " style="filled" fillcolor=red]; - } - 41 -> {42}; - 42 -> {43}; - 43 -> {44}; - 44 -> {45}; - 45 -> {46}; - - subgraph cluster_7 { - color=red - 47 [label="Enter init block" style="filled" fillcolor=red]; - subgraph cluster_8 { - color=blue - 48 [label="Enter block"]; - 49 [label="Access variable R|/c|"]; - 50 [label="Assignment: R|/leaked|"]; - 51 [label="Exit block"]; - } - 52 [label="Exit init block" style="filled" fillcolor=red]; - } - 47 -> {48}; - 48 -> {49}; - 49 -> {50}; - 50 -> {51}; - 51 -> {52}; - 52 -> {13} [color=green]; - - subgraph cluster_9 { - color=red - 53 [label="Enter function run" style="filled" fillcolor=red]; - subgraph cluster_10 { - color=blue - 54 [label="Enter block"]; - 55 [label="Function call: R|/d|.R|SubstitutionOverride|()" style="filled" fillcolor=yellow]; - 56 [label="Exit block"]; - } - 57 [label="Exit function run" style="filled" fillcolor=red]; - } - 53 -> {54}; - 54 -> {55}; - 55 -> {56}; - 56 -> {57}; + 12 -> {17} [style=dashed]; + 14 -> {15}; + 15 -> {16}; + 16 -> {12} [color=green]; + 17 -> {18}; + 18 -> {19}; + 19 -> {20}; + 20 -> {21}; + 21 -> {22}; + 22 -> {13} [color=green]; + 23 -> {24}; + 24 -> {25}; + 25 -> {26}; + 26 -> {27}; + 27 -> {28}; + 29 -> {30}; + 30 -> {31}; + 31 -> {32}; + 32 -> {33}; } diff --git a/compiler/fir/analysis-tests/testData/resolveWithStdlib/delegates/delegateWithAnonymousObject.dot b/compiler/fir/analysis-tests/testData/resolveWithStdlib/delegates/delegateWithAnonymousObject.dot index 543a2064e3c..77e080ce427 100644 --- a/compiler/fir/analysis-tests/testData/resolveWithStdlib/delegates/delegateWithAnonymousObject.dot +++ b/compiler/fir/analysis-tests/testData/resolveWithStdlib/delegates/delegateWithAnonymousObject.dot @@ -83,64 +83,9 @@ digraph delegateWithAnonymousObject_kt { 24 -> {25}; subgraph cluster_9 { - color=red - 35 [label="Enter function " style="filled" fillcolor=red]; - 36 [label="Delegated constructor call: super()" style="filled" fillcolor=yellow]; - 37 [label="Exit function " style="filled" fillcolor=red]; - } - 35 -> {36}; - 36 -> {37}; - - subgraph cluster_10 { - color=red - 38 [label="Enter function getValue" style="filled" fillcolor=red]; - subgraph cluster_11 { - color=blue - 39 [label="Enter block"]; - 40 [label="Function call: R|/IssueListView.IssueListView|()" style="filled" fillcolor=yellow]; - 41 [label="Jump: ^getValue R|/IssueListView.IssueListView|()"]; - 42 [label="Stub" style="filled" fillcolor=gray]; - 43 [label="Exit block" style="filled" fillcolor=gray]; - } - 44 [label="Exit function getValue" style="filled" fillcolor=red]; - } - 38 -> {39}; - 39 -> {40}; - 40 -> {41}; - 41 -> {44}; - 41 -> {42} [style=dotted]; - 42 -> {43} [style=dotted]; - 43 -> {44} [style=dotted]; - - subgraph cluster_12 { - color=red - 45 [label="Enter function setValue" style="filled" fillcolor=red]; - subgraph cluster_13 { - color=blue - 46 [label="Enter block"]; - 47 [label="Function call: R|/IssueListView.IssueListView|()" style="filled" fillcolor=yellow]; - 48 [label="Access variable R|/value|"]; - 49 [label="Function call: R|/IssueListView.IssueListView|().R|/IssueListView.updateFrom|(...)" style="filled" fillcolor=yellow]; - 50 [label="Jump: ^setValue R|/IssueListView.IssueListView|().R|/IssueListView.updateFrom|(R|/value|)"]; - 51 [label="Stub" style="filled" fillcolor=gray]; - 52 [label="Exit block" style="filled" fillcolor=gray]; - } - 53 [label="Exit function setValue" style="filled" fillcolor=red]; - } - 45 -> {46}; - 46 -> {47}; - 47 -> {48}; - 48 -> {49}; - 49 -> {50}; - 50 -> {53}; - 50 -> {51} [style=dotted]; - 51 -> {52} [style=dotted]; - 52 -> {53} [style=dotted]; - - subgraph cluster_14 { color=red 54 [label="Enter function getter" style="filled" fillcolor=red]; - subgraph cluster_15 { + subgraph cluster_10 { color=blue 55 [label="Enter block"]; 56 [label="Access variable D|/IssuesListUserProfile.issueListView|"]; @@ -162,10 +107,10 @@ digraph delegateWithAnonymousObject_kt { 60 -> {61} [style=dotted]; 61 -> {62} [style=dotted]; - subgraph cluster_16 { + subgraph cluster_11 { color=red 63 [label="Enter function setter" style="filled" fillcolor=red]; - subgraph cluster_17 { + subgraph cluster_12 { color=blue 64 [label="Enter block"]; 65 [label="Access variable D|/IssuesListUserProfile.issueListView|"]; @@ -184,35 +129,79 @@ digraph delegateWithAnonymousObject_kt { 68 -> {69}; 69 -> {70}; - subgraph cluster_18 { + subgraph cluster_13 { color=red - 71 [label="Enter property" style="filled" fillcolor=red]; - 72 [label="Postponed enter to lambda"]; - subgraph cluster_19 { + 79 [label="Enter class IssuesListUserProfile" style="filled" fillcolor=red]; + 80 [label="Part of class initialization"]; + subgraph cluster_14 { color=blue - 26 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; + 71 [label="Enter property" style="filled" fillcolor=red]; + 72 [label="Postponed enter to lambda"]; + subgraph cluster_15 { + color=blue + 26 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; + subgraph cluster_16 { + color=blue + 27 [label="Enter block"]; + 28 [label="Enter anonymous object"]; + subgraph cluster_17 { + color=blue + 33 [label="Enter class " style="filled" fillcolor=red]; + 34 [label="Exit class " style="filled" fillcolor=red]; + } + 29 [label="Exit anonymous object"]; + 30 [label="Exit anonymous object expression"]; + 31 [label="Exit block"]; + } + 32 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; + } + subgraph cluster_18 { + color=blue + 45 [label="Enter function setValue" style="filled" fillcolor=red]; + subgraph cluster_19 { + color=blue + 46 [label="Enter block"]; + 47 [label="Function call: R|/IssueListView.IssueListView|()" style="filled" fillcolor=yellow]; + 48 [label="Access variable R|/value|"]; + 49 [label="Function call: R|/IssueListView.IssueListView|().R|/IssueListView.updateFrom|(...)" style="filled" fillcolor=yellow]; + 50 [label="Jump: ^setValue R|/IssueListView.IssueListView|().R|/IssueListView.updateFrom|(R|/value|)"]; + 51 [label="Stub" style="filled" fillcolor=gray]; + 52 [label="Exit block" style="filled" fillcolor=gray]; + } + 53 [label="Exit function setValue" style="filled" fillcolor=red]; + } subgraph cluster_20 { color=blue - 27 [label="Enter block"]; - 28 [label="Enter anonymous object"]; + 38 [label="Enter function getValue" style="filled" fillcolor=red]; subgraph cluster_21 { color=blue - 33 [label="Enter class " style="filled" fillcolor=red]; - 34 [label="Exit class " style="filled" fillcolor=red]; + 39 [label="Enter block"]; + 40 [label="Function call: R|/IssueListView.IssueListView|()" style="filled" fillcolor=yellow]; + 41 [label="Jump: ^getValue R|/IssueListView.IssueListView|()"]; + 42 [label="Stub" style="filled" fillcolor=gray]; + 43 [label="Exit block" style="filled" fillcolor=gray]; } - 29 [label="Exit anonymous object"]; - 30 [label="Exit anonymous object expression"]; - 31 [label="Exit block"]; + 44 [label="Exit function getValue" style="filled" fillcolor=red]; } - 32 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; + subgraph cluster_22 { + color=blue + 35 [label="Enter function " style="filled" fillcolor=red]; + 36 [label="Delegated constructor call: super()" style="filled" fillcolor=yellow]; + 37 [label="Exit function " style="filled" fillcolor=red]; + } + 73 [label="Postponed exit from lambda"]; + 74 [label="Function call: this@R|/IssuesListUserProfile|.R|/delegate|(...)" style="filled" fillcolor=yellow]; + 75 [label="Access variable this@R|/IssuesListUserProfile|"]; + 76 [label="Function call: this@R|/IssuesListUserProfile|.R|/delegate|(...).#(...)" style="filled" fillcolor=yellow]; + 77 [label="Exit property delegate" style="filled" fillcolor=yellow]; + 78 [label="Exit property" style="filled" fillcolor=red]; } - 73 [label="Postponed exit from lambda"]; - 74 [label="Function call: this@R|/IssuesListUserProfile|.R|/delegate|(...)" style="filled" fillcolor=yellow]; - 75 [label="Access variable this@R|/IssuesListUserProfile|"]; - 76 [label="Function call: this@R|/IssuesListUserProfile|.R|/delegate|(...).#(...)" style="filled" fillcolor=yellow]; - 77 [label="Exit property delegate" style="filled" fillcolor=yellow]; - 78 [label="Exit property" style="filled" fillcolor=red]; + 81 [label="Exit class IssuesListUserProfile" style="filled" fillcolor=red]; } + 79 -> {80} [color=green]; + 80 -> {71} [color=green]; + 80 -> {81} [style=dotted]; + 80 -> {71} [style=dashed]; 71 -> {72}; 72 -> {26 73 74}; 72 -> {26} [style=dashed]; @@ -236,16 +225,23 @@ digraph delegateWithAnonymousObject_kt { 31 -> {32}; 33 -> {34} [color=green]; 34 -> {29} [color=green]; - - subgraph cluster_22 { - color=red - 79 [label="Enter class IssuesListUserProfile" style="filled" fillcolor=red]; - 80 [label="Part of class initialization"]; - 81 [label="Exit class IssuesListUserProfile" style="filled" fillcolor=red]; - } - 79 -> {80} [color=green]; - 80 -> {71} [color=green]; - 80 -> {81} [style=dotted]; - 80 -> {71} [style=dashed]; + 35 -> {36}; + 36 -> {37}; + 38 -> {39}; + 39 -> {40}; + 40 -> {41}; + 41 -> {44}; + 41 -> {42} [style=dotted]; + 42 -> {43} [style=dotted]; + 43 -> {44} [style=dotted]; + 45 -> {46}; + 46 -> {47}; + 47 -> {48}; + 48 -> {49}; + 49 -> {50}; + 50 -> {53}; + 50 -> {51} [style=dotted]; + 51 -> {52} [style=dotted]; + 52 -> {53} [style=dotted]; } diff --git a/compiler/fir/analysis-tests/testData/resolveWithStdlib/inference/plusAssignWithLambdaInRhs.dot b/compiler/fir/analysis-tests/testData/resolveWithStdlib/inference/plusAssignWithLambdaInRhs.dot index e84d6a209dc..b89a00e9046 100644 --- a/compiler/fir/analysis-tests/testData/resolveWithStdlib/inference/plusAssignWithLambdaInRhs.dot +++ b/compiler/fir/analysis-tests/testData/resolveWithStdlib/inference/plusAssignWithLambdaInRhs.dot @@ -59,25 +59,24 @@ digraph plusAssignWithLambdaInRhs_kt { 18 -> {19}; subgraph cluster_5 { - color=red - 20 [label="Enter property" style="filled" fillcolor=red]; - 21 [label="Access variable R|/executor|"]; - 22 [label="Exit property" style="filled" fillcolor=red]; - } - 20 -> {21}; - 21 -> {22}; - 22 -> {25} [color=green]; - - subgraph cluster_6 { color=red 23 [label="Enter class A" style="filled" fillcolor=red]; 24 [label="Part of class initialization"]; + subgraph cluster_6 { + color=blue + 20 [label="Enter property" style="filled" fillcolor=red]; + 21 [label="Access variable R|/executor|"]; + 22 [label="Exit property" style="filled" fillcolor=red]; + } 25 [label="Exit class A" style="filled" fillcolor=red]; } 23 -> {24} [color=green]; 24 -> {20} [color=green]; 24 -> {25} [style=dotted]; 24 -> {20} [style=dashed]; + 20 -> {21}; + 21 -> {22}; + 22 -> {25} [color=green]; subgraph cluster_7 { color=red diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/cfa/AbstractFirPropertyInitializationChecker.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/cfa/AbstractFirPropertyInitializationChecker.kt index 7eac2525e6b..29fcc187ef3 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/cfa/AbstractFirPropertyInitializationChecker.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/cfa/AbstractFirPropertyInitializationChecker.kt @@ -6,6 +6,7 @@ package org.jetbrains.kotlin.fir.analysis.cfa import org.jetbrains.kotlin.diagnostics.DiagnosticReporter +import org.jetbrains.kotlin.fir.analysis.cfa.util.PropertyInitializationInfoData import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext import org.jetbrains.kotlin.fir.expressions.FirVariableAssignment import org.jetbrains.kotlin.fir.resolve.dfa.cfg.ControlFlowGraph diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/cfa/FirCallsEffectAnalyzer.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/cfa/FirCallsEffectAnalyzer.kt index 8d529e63db9..1dff1665bc3 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/cfa/FirCallsEffectAnalyzer.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/cfa/FirCallsEffectAnalyzer.kt @@ -17,8 +17,8 @@ import org.jetbrains.kotlin.fir.analysis.checkers.cfa.FirControlFlowChecker import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors import org.jetbrains.kotlin.fir.contracts.FirContractDescription -import org.jetbrains.kotlin.fir.contracts.coneEffects import org.jetbrains.kotlin.fir.contracts.description.ConeCallsEffectDeclaration +import org.jetbrains.kotlin.fir.contracts.effects import org.jetbrains.kotlin.fir.declarations.FirAnonymousFunction import org.jetbrains.kotlin.fir.declarations.FirContractDescriptionOwner import org.jetbrains.kotlin.fir.declarations.FirFunction @@ -43,10 +43,15 @@ import kotlin.contracts.contract object FirCallsEffectAnalyzer : FirControlFlowChecker() { override fun analyze(graph: ControlFlowGraph, reporter: DiagnosticReporter, context: CheckerContext) { + // TODO: this is quadratic due to `graph.traverse`, surely there is a better way? + for (subGraph in graph.subGraphs) { + analyze(subGraph, reporter, context) + } + val session = context.session val function = (graph.declaration as? FirFunction) ?: return if (function !is FirContractDescriptionOwner) return - if (function.contractDescription.coneEffects?.any { it is ConeCallsEffectDeclaration } != true) return + if (function.contractDescription.effects?.any { it.effect is ConeCallsEffectDeclaration } != true) return val functionalTypeEffects = mutableMapOf, ConeCallsEffectDeclaration>() @@ -298,7 +303,7 @@ object FirCallsEffectAnalyzer : FirControlFlowChecker() { } private fun FirContractDescription?.getParameterCallsEffectDeclaration(index: Int): ConeCallsEffectDeclaration? { - val effects = this?.coneEffects + val effects = this?.effects?.map { it.effect } val callsEffect = effects?.find { it is ConeCallsEffectDeclaration && it.valueParameterReference.parameterIndex == index } return callsEffect as? ConeCallsEffectDeclaration? } diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/cfa/FirControlFlowAnalyzer.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/cfa/FirControlFlowAnalyzer.kt deleted file mode 100644 index 9926aa44723..00000000000 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/cfa/FirControlFlowAnalyzer.kt +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.fir.analysis.cfa - -import org.jetbrains.kotlin.fir.FirSession -import org.jetbrains.kotlin.fir.analysis.cfa.util.LocalPropertyAndCapturedWriteCollector -import org.jetbrains.kotlin.fir.analysis.cfa.util.PropertyInitializationInfoCollector -import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext -import org.jetbrains.kotlin.fir.analysis.checkers.declaration.DeclarationCheckers -import org.jetbrains.kotlin.fir.analysis.checkersComponent -import org.jetbrains.kotlin.diagnostics.DiagnosticReporter -import org.jetbrains.kotlin.fir.analysis.cfa.util.PathAwarePropertyInitializationInfo -import org.jetbrains.kotlin.fir.declarations.FirClass -import org.jetbrains.kotlin.fir.declarations.FirFunction -import org.jetbrains.kotlin.fir.declarations.FirProperty -import org.jetbrains.kotlin.fir.declarations.FirPropertyAccessor -import org.jetbrains.kotlin.fir.resolve.dfa.cfg.CFGNode -import org.jetbrains.kotlin.fir.resolve.dfa.cfg.ControlFlowGraph -import org.jetbrains.kotlin.fir.symbols.impl.FirPropertySymbol - -class FirControlFlowAnalyzer( - session: FirSession, - declarationCheckers: DeclarationCheckers = session.checkersComponent.declarationCheckers -) { - private val cfaCheckers = declarationCheckers.controlFlowAnalyserCheckers - private val variableAssignmentCheckers = declarationCheckers.variableAssignmentCfaBasedCheckers - - // Currently declaration in analyzeXXX is not used, but it may be useful in future - @Suppress("UNUSED_PARAMETER") - fun analyzeClassInitializer(klass: FirClass, graph: ControlFlowGraph, context: CheckerContext, reporter: DiagnosticReporter) { - if (graph.owner != null) return - cfaCheckers.forEach { it.analyze(graph, reporter, context) } - } - - @Suppress("UNUSED_PARAMETER") - fun analyzeFunction(function: FirFunction, graph: ControlFlowGraph, context: CheckerContext, reporter: DiagnosticReporter) { - if (graph.owner != null) return - - cfaCheckers.forEach { it.analyze(graph, reporter, context) } - if (context.containingDeclarations.any { it is FirProperty || it is FirFunction }) return - runAssignmentCfaCheckers(graph, reporter, context) - } - - @Suppress("UNUSED_PARAMETER") - fun analyzePropertyInitializer(property: FirProperty, graph: ControlFlowGraph, context: CheckerContext, reporter: DiagnosticReporter) { - if (graph.owner != null) return - - cfaCheckers.forEach { it.analyze(graph, reporter, context) } - runAssignmentCfaCheckers(graph, reporter, context) - } - - @Suppress("UNUSED_PARAMETER") - fun analyzePropertyAccessor( - accessor: FirPropertyAccessor, - graph: ControlFlowGraph, - context: CheckerContext, - reporter: DiagnosticReporter - ) { - if (graph.owner != null) return - - cfaCheckers.forEach { it.analyze(graph, reporter, context) } - runAssignmentCfaCheckers(graph, reporter, context) - } - - private fun runAssignmentCfaCheckers(graph: ControlFlowGraph, reporter: DiagnosticReporter, context: CheckerContext) { - val (properties, capturedWrites) = LocalPropertyAndCapturedWriteCollector.collect(graph) - if (properties.isEmpty()) return - val data = PropertyInitializationInfoData(properties, graph) - variableAssignmentCheckers.forEach { it.analyze(graph, reporter, data, properties, capturedWrites, context) } - } -} - -class PropertyInitializationInfoData(properties: Set, graph: ControlFlowGraph) { - private val data by lazy(LazyThreadSafetyMode.NONE) { - PropertyInitializationInfoCollector(properties).getData(graph) - } - - fun getValue(node: CFGNode<*>): PathAwarePropertyInitializationInfo { - return data.getValue(node) - } -} - diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/cfa/FirPropertyInitializationAnalyzer.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/cfa/FirPropertyInitializationAnalyzer.kt index 7683375c156..465ad7dd74b 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/cfa/FirPropertyInitializationAnalyzer.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/cfa/FirPropertyInitializationAnalyzer.kt @@ -10,6 +10,7 @@ import org.jetbrains.kotlin.contracts.description.isDefinitelyVisited import org.jetbrains.kotlin.diagnostics.DiagnosticReporter import org.jetbrains.kotlin.diagnostics.reportOn import org.jetbrains.kotlin.fir.analysis.cfa.util.PathAwarePropertyInitializationInfo +import org.jetbrains.kotlin.fir.analysis.cfa.util.PropertyInitializationInfoData import org.jetbrains.kotlin.fir.analysis.cfa.util.TraverseDirection import org.jetbrains.kotlin.fir.analysis.cfa.util.traverse import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/cfa/FirReturnsImpliesAnalyzer.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/cfa/FirReturnsImpliesAnalyzer.kt index 3ca661f8414..0042c9f3142 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/cfa/FirReturnsImpliesAnalyzer.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/cfa/FirReturnsImpliesAnalyzer.kt @@ -12,9 +12,8 @@ import org.jetbrains.kotlin.fir.analysis.cfa.util.previousCfgNodes import org.jetbrains.kotlin.fir.analysis.checkers.cfa.FirControlFlowChecker import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors -import org.jetbrains.kotlin.fir.contracts.FirResolvedContractDescription -import org.jetbrains.kotlin.fir.contracts.coneEffects import org.jetbrains.kotlin.fir.contracts.description.* +import org.jetbrains.kotlin.fir.contracts.effects import org.jetbrains.kotlin.fir.declarations.FirContractDescriptionOwner import org.jetbrains.kotlin.fir.declarations.FirFunction import org.jetbrains.kotlin.fir.declarations.FirProperty @@ -34,27 +33,32 @@ import org.jetbrains.kotlin.types.AbstractTypeChecker object FirReturnsImpliesAnalyzer : FirControlFlowChecker() { override fun analyze(graph: ControlFlowGraph, reporter: DiagnosticReporter, context: CheckerContext) { - val function = graph.declaration as? FirFunction ?: return - val graphRef = function.controlFlowGraphReference as FirControlFlowGraphReferenceImpl - val dataFlowInfo = graphRef.dataFlowInfo - if (function !is FirContractDescriptionOwner || dataFlowInfo == null) return - - val effects = (function.contractDescription as? FirResolvedContractDescription)?.coneEffects - ?.filter { it is ConeConditionalEffectDeclaration && it.effect is ConeReturnsEffectDeclaration } - - if (effects.isNullOrEmpty()) return - val logicSystem = object : LogicSystem(context.session.typeContext) { override val variableStorage: VariableStorageImpl get() = throw IllegalStateException("shouldn't be called") } + analyze(graph, reporter, context, logicSystem) + } - effects.forEach { effect -> + private fun analyze(graph: ControlFlowGraph, reporter: DiagnosticReporter, context: CheckerContext, logicSystem: LogicSystem) { + // Not quadratic since we don't traverse the graph, we only care about (declaration, exit node) pairs. + for (subGraph in graph.subGraphs) { + analyze(subGraph, reporter, context) + } + + val function = graph.declaration as? FirFunction ?: return + if (function !is FirContractDescriptionOwner) return + val effects = function.contractDescription.effects ?: return + val dataFlowInfo = function.controlFlowGraphReference?.dataFlowInfo ?: return + for (firEffect in effects) { + // TODO: why is *everything* an "effect"? Something's not right with this terminology. + val coneEffect = firEffect.effect as? ConeConditionalEffectDeclaration ?: continue + val returnValue = coneEffect.effect as? ConeReturnsEffectDeclaration ?: continue val wrongCondition = graph.exitNode.previousCfgNodes.any { - isWrongConditionOnNode(it, effect as ConeConditionalEffectDeclaration, function, logicSystem, dataFlowInfo, context) + isWrongConditionOnNode(it, coneEffect, returnValue, function, logicSystem, dataFlowInfo, context) } - if (wrongCondition) { + // TODO: reportOn(firEffect.source, ...) reporter.reportOn(function.contractDescription.source, FirErrors.WRONG_IMPLIES_CONDITION, context) } } @@ -63,12 +67,12 @@ object FirReturnsImpliesAnalyzer : FirControlFlowChecker() { private fun isWrongConditionOnNode( node: CFGNode<*>, effectDeclaration: ConeConditionalEffectDeclaration, + effect: ConeReturnsEffectDeclaration, function: FirFunction, logicSystem: LogicSystem, dataFlowInfo: DataFlowInfo, context: CheckerContext ): Boolean { - val effect = effectDeclaration.effect as ConeReturnsEffectDeclaration val builtinTypes = context.session.builtinTypes val typeContext = context.session.typeContext @@ -80,7 +84,7 @@ object FirReturnsImpliesAnalyzer : FirControlFlowChecker() { if (isReturn && resultExpression is FirWhenExpression) { return node.collectBranchExits().any { - isWrongConditionOnNode(it, effectDeclaration, function, logicSystem, dataFlowInfo, context) + isWrongConditionOnNode(it, effectDeclaration, effect, function, logicSystem, dataFlowInfo, context) } } @@ -106,6 +110,7 @@ object FirReturnsImpliesAnalyzer : FirControlFlowChecker() { // TODO: if this is not a top-level function, `FirDataFlowAnalyzer` has erased its value parameters // from `dataFlowInfo.variableStorage` for some reason, so its `getLocalVariable` doesn't work. val knownVariables = flow.knownVariables.associateBy { it.identifier } + // TODO: these should be the same on all return paths, so maybe don't recompute them every time? val argumentVariables = Array(function.valueParameters.size + 1) { i -> val parameterSymbol = if (i > 0) { function.valueParameters[i - 1].symbol diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/cfa/util/PropertyInitializationInfoCollector.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/cfa/util/PropertyInitializationInfoCollector.kt index a289c41842f..5b9e23f3d37 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/cfa/util/PropertyInitializationInfoCollector.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/cfa/util/PropertyInitializationInfoCollector.kt @@ -13,6 +13,16 @@ import org.jetbrains.kotlin.fir.references.toResolvedPropertySymbol import org.jetbrains.kotlin.fir.resolve.dfa.cfg.* import org.jetbrains.kotlin.fir.symbols.impl.FirPropertySymbol +class PropertyInitializationInfoData(properties: Set, graph: ControlFlowGraph) { + private val data by lazy(LazyThreadSafetyMode.NONE) { + PropertyInitializationInfoCollector(properties).getData(graph) + } + + fun getValue(node: CFGNode<*>): PathAwarePropertyInitializationInfo { + return data.getValue(node) + } +} + class PropertyInitializationInfoCollector( private val localProperties: Set, private val declaredVariableCollector: DeclaredVariableCollector = DeclaredVariableCollector(), diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/ExtendedDeclarationCheckers.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/ExtendedDeclarationCheckers.kt index c28f8272c9d..749478b60a2 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/ExtendedDeclarationCheckers.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/ExtendedDeclarationCheckers.kt @@ -30,11 +30,11 @@ object ExtendedDeclarationCheckers : DeclarationCheckers() { override val variableAssignmentCfaBasedCheckers: Set get() = setOf( CanBeValChecker, + UnusedChecker, ) override val controlFlowAnalyserCheckers: Set get() = setOf( - UnusedChecker, UnreachableCodeChecker, ) diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/extended/CanBeValChecker.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/extended/CanBeValChecker.kt index b8bb330e80d..a45d8b40088 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/extended/CanBeValChecker.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/extended/CanBeValChecker.kt @@ -17,7 +17,7 @@ import org.jetbrains.kotlin.fir.analysis.cfa.util.traverse import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext import org.jetbrains.kotlin.fir.analysis.checkers.getChildren import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors -import org.jetbrains.kotlin.fir.analysis.cfa.PropertyInitializationInfoData +import org.jetbrains.kotlin.fir.analysis.cfa.util.PropertyInitializationInfoData import org.jetbrains.kotlin.fir.expressions.FirVariableAssignment import org.jetbrains.kotlin.fir.references.toResolvedPropertySymbol import org.jetbrains.kotlin.fir.resolve.dfa.cfg.* diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/extended/UnusedChecker.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/extended/UnusedChecker.kt index a623b495456..a5e40472d82 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/extended/UnusedChecker.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/extended/UnusedChecker.kt @@ -12,18 +12,13 @@ import org.jetbrains.kotlin.KtNodeTypes import org.jetbrains.kotlin.diagnostics.DiagnosticReporter import org.jetbrains.kotlin.diagnostics.reportOn import org.jetbrains.kotlin.fir.* +import org.jetbrains.kotlin.fir.analysis.cfa.AbstractFirPropertyInitializationChecker import org.jetbrains.kotlin.fir.analysis.cfa.util.* -import org.jetbrains.kotlin.fir.analysis.checkers.cfa.FirControlFlowChecker import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext -import org.jetbrains.kotlin.fir.analysis.checkers.getContainingClassSymbol import org.jetbrains.kotlin.fir.analysis.checkers.isIterator import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors import org.jetbrains.kotlin.fir.declarations.FirResolvePhase -import org.jetbrains.kotlin.fir.declarations.utils.isLocal -import org.jetbrains.kotlin.fir.expressions.FirAnnotation -import org.jetbrains.kotlin.fir.expressions.FirAnnotationCall -import org.jetbrains.kotlin.fir.expressions.FirFunctionCall -import org.jetbrains.kotlin.fir.expressions.FirQualifiedAccess +import org.jetbrains.kotlin.fir.expressions.* import org.jetbrains.kotlin.fir.references.resolved import org.jetbrains.kotlin.fir.references.toResolvedPropertySymbol import org.jetbrains.kotlin.fir.resolve.dfa.cfg.* @@ -34,14 +29,17 @@ import org.jetbrains.kotlin.fir.symbols.lazyResolveToPhase import org.jetbrains.kotlin.fir.types.coneType import org.jetbrains.kotlin.fir.types.isFunctionalType -object UnusedChecker : FirControlFlowChecker() { - override fun analyze(graph: ControlFlowGraph, reporter: DiagnosticReporter, context: CheckerContext) { - if (graph.declaration?.getContainingClassSymbol(context.session)?.takeIf { !it.isLocal } != null) return - val (properties, _) = LocalPropertyAndCapturedWriteCollector.collect(graph) - if (properties.isEmpty()) return - - val data = ValueWritesWithoutReading(context.session, properties).getData(graph) - graph.traverse(TraverseDirection.Backward, CfaVisitor(data, reporter, context)) +object UnusedChecker : AbstractFirPropertyInitializationChecker() { + override fun analyze( + graph: ControlFlowGraph, + reporter: DiagnosticReporter, + data: PropertyInitializationInfoData, + properties: Set, + capturedWrites: Set, + context: CheckerContext + ) { + val ownData = ValueWritesWithoutReading(context.session, properties).getData(graph) + graph.traverse(TraverseDirection.Backward, CfaVisitor(ownData, reporter, context)) } class CfaVisitor( diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/collectors/components/ControlFlowAnalysisDiagnosticComponent.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/collectors/components/ControlFlowAnalysisDiagnosticComponent.kt index 0e79b009009..46ac55b74b8 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/collectors/components/ControlFlowAnalysisDiagnosticComponent.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/collectors/components/ControlFlowAnalysisDiagnosticComponent.kt @@ -6,13 +6,13 @@ package org.jetbrains.kotlin.fir.analysis.collectors.components import org.jetbrains.kotlin.fir.FirSession -import org.jetbrains.kotlin.fir.analysis.cfa.FirControlFlowAnalyzer import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext import org.jetbrains.kotlin.fir.analysis.checkers.declaration.DeclarationCheckers import org.jetbrains.kotlin.fir.analysis.checkersComponent import org.jetbrains.kotlin.diagnostics.DiagnosticReporter +import org.jetbrains.kotlin.fir.analysis.cfa.util.LocalPropertyAndCapturedWriteCollector +import org.jetbrains.kotlin.fir.analysis.cfa.util.PropertyInitializationInfoData import org.jetbrains.kotlin.fir.declarations.* -import org.jetbrains.kotlin.fir.references.FirControlFlowGraphReference import org.jetbrains.kotlin.fir.resolve.dfa.controlFlowGraph class ControlFlowAnalysisDiagnosticComponent( @@ -20,52 +20,52 @@ class ControlFlowAnalysisDiagnosticComponent( reporter: DiagnosticReporter, declarationCheckers: DeclarationCheckers = session.checkersComponent.declarationCheckers, ) : AbstractDiagnosticCollectorComponent(session, reporter) { - private val controlFlowAnalyzer = FirControlFlowAnalyzer(session, declarationCheckers) + private val cfaCheckers = declarationCheckers.controlFlowAnalyserCheckers + private val variableAssignmentCheckers = declarationCheckers.variableAssignmentCfaBasedCheckers + + private fun analyze(declaration: FirControlFlowGraphOwner, context: CheckerContext) { + val graph = declaration.controlFlowGraphReference?.controlFlowGraph ?: return + if (graph.owner != null) return + cfaCheckers.forEach { it.analyze(graph, reporter, context) } + + val (properties, capturedWrites) = LocalPropertyAndCapturedWriteCollector.collect(graph) + if (properties.isNotEmpty()) { + val data = PropertyInitializationInfoData(properties, graph) + variableAssignmentCheckers.forEach { it.analyze(graph, reporter, data, properties, capturedWrites, context) } + } + } // ------------------------------- Class initializer ------------------------------- override fun visitRegularClass(regularClass: FirRegularClass, data: CheckerContext) { - visitClass(regularClass, regularClass.controlFlowGraphReference, data) + analyze(regularClass, data) } override fun visitAnonymousObject(anonymousObject: FirAnonymousObject, data: CheckerContext) { - visitClass(anonymousObject, anonymousObject.controlFlowGraphReference, data) - } - - private fun visitClass( - klass: FirClass, - controlFlowGraphReference: FirControlFlowGraphReference?, - data: CheckerContext - ) { - val graph = controlFlowGraphReference?.controlFlowGraph ?: return - controlFlowAnalyzer.analyzeClassInitializer(klass, graph, data, reporter) + analyze(anonymousObject, data) } // ------------------------------- Property initializer ------------------------------- + override fun visitProperty(property: FirProperty, data: CheckerContext) { - val graph = property.controlFlowGraphReference?.controlFlowGraph ?: return - controlFlowAnalyzer.analyzePropertyInitializer(property, graph, data, reporter) + analyze(property, data) } // ------------------------------- Function ------------------------------- override fun visitFunction(function: FirFunction, data: CheckerContext) { - val graph = function.controlFlowGraphReference?.controlFlowGraph ?: return - - controlFlowAnalyzer.analyzeFunction(function, graph, data, reporter) + analyze(function, data) } override fun visitSimpleFunction(simpleFunction: FirSimpleFunction, data: CheckerContext) { - visitFunction(simpleFunction, data) + analyze(simpleFunction, data) } override fun visitPropertyAccessor(propertyAccessor: FirPropertyAccessor, data: CheckerContext) { - val graph = propertyAccessor.controlFlowGraphReference?.controlFlowGraph ?: return - - controlFlowAnalyzer.analyzePropertyAccessor(propertyAccessor, graph, data, reporter) + analyze(propertyAccessor, data) } override fun visitConstructor(constructor: FirConstructor, data: CheckerContext) { - visitFunction(constructor, data) + analyze(constructor, data) } } diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/dfa/cfg/ControlFlowGraphBuilder.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/dfa/cfg/ControlFlowGraphBuilder.kt index 2445647fb60..c47df0532a0 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/dfa/cfg/ControlFlowGraphBuilder.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/dfa/cfg/ControlFlowGraphBuilder.kt @@ -433,6 +433,7 @@ class ControlFlowGraphBuilder { } ?: continue createPartOfClassInitializationNode(declaration as FirControlFlowGraphOwner).also { + currentGraph.addSubGraph(graph) addEdge(node, it, preferredKind = EdgeKind.CfgForward) addEdge(it, graph.enterNode, preferredKind = EdgeKind.CfgForward) node = graph.exitNode @@ -537,6 +538,7 @@ class ControlFlowGraphBuilder { if (functionGraph != null && functionGraph.owner == null) { addEdge(node, functionGraph.enterNode, preferredKind = EdgeKind.CfgForward) node.addSubGraph(functionGraph) + currentGraph.addSubGraph(functionGraph) } } } diff --git a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/contracts/ContractUtils.kt b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/contracts/ContractUtils.kt index df7a168dd85..b9cd2f87776 100644 --- a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/contracts/ContractUtils.kt +++ b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/contracts/ContractUtils.kt @@ -12,9 +12,6 @@ import org.jetbrains.kotlin.fir.contracts.description.ConeEffectDeclaration val FirContractDescription.effects: List? get() = (this as? FirResolvedContractDescription)?.effects -val FirContractDescription.coneEffects: List? - get() = effects?.map { it.effect } - fun ConeEffectDeclaration.toFirEffectDeclaration(source: KtSourceElement? = null): FirEffectDeclaration = buildEffectDeclaration { if (source != null) { diff --git a/compiler/testData/codegen/box/smartCasts/kt44814.dot b/compiler/testData/codegen/box/smartCasts/kt44814.dot index 15866e0877d..3e69fcea035 100644 --- a/compiler/testData/codegen/box/smartCasts/kt44814.dot +++ b/compiler/testData/codegen/box/smartCasts/kt44814.dot @@ -45,41 +45,29 @@ digraph kt44814_kt { 11 -> {12}; subgraph cluster_5 { - color=red - 13 [label="Enter property [2]" style="filled" fillcolor=red]; - 14 [label="Access variable R|/psi| [2]"]; - 15 [label="Exit property [2]" style="filled" fillcolor=red]; - } - 13 -> {14}; - 14 -> {15}; - 15 -> {24} [color=green]; - - subgraph cluster_6 { - color=red - 16 [label="Enter property [2]" style="filled" fillcolor=red]; - 17 [label="Access variable R|/lighterASTNode| [2]"]; - 18 [label="Exit property [2]" style="filled" fillcolor=red]; - } - 16 -> {17}; - 17 -> {18}; - 18 -> {25} [color=green]; - - subgraph cluster_7 { - color=red - 19 [label="Enter property [2]" style="filled" fillcolor=red]; - 20 [label="Access variable R|/treeStructure| [2]"]; - 21 [label="Exit property [2]" style="filled" fillcolor=red]; - } - 19 -> {20}; - 20 -> {21}; - 21 -> {26} [color=green]; - - subgraph cluster_8 { color=red 22 [label="Enter class FirPsiSourceElement [1]" style="filled" fillcolor=red]; 23 [label="Part of class initialization [1]"]; + subgraph cluster_6 { + color=blue + 13 [label="Enter property [2]" style="filled" fillcolor=red]; + 14 [label="Access variable R|/psi| [2]"]; + 15 [label="Exit property [2]" style="filled" fillcolor=red]; + } 24 [label="Part of class initialization [1]"]; + subgraph cluster_7 { + color=blue + 16 [label="Enter property [2]" style="filled" fillcolor=red]; + 17 [label="Access variable R|/lighterASTNode| [2]"]; + 18 [label="Exit property [2]" style="filled" fillcolor=red]; + } 25 [label="Part of class initialization [1]"]; + subgraph cluster_8 { + color=blue + 19 [label="Enter property [2]" style="filled" fillcolor=red]; + 20 [label="Access variable R|/treeStructure| [2]"]; + 21 [label="Exit property [2]" style="filled" fillcolor=red]; + } 26 [label="Exit class FirPsiSourceElement [1]" style="filled" fillcolor=red]; } 22 -> {23} [color=green]; @@ -92,6 +80,15 @@ digraph kt44814_kt { 25 -> {19} [color=green]; 25 -> {26} [style=dotted]; 25 -> {19} [style=dashed]; + 13 -> {14}; + 14 -> {15}; + 15 -> {24} [color=green]; + 16 -> {17}; + 17 -> {18}; + 18 -> {25} [color=green]; + 19 -> {20}; + 20 -> {21}; + 21 -> {26} [color=green]; subgraph cluster_9 { color=red @@ -103,30 +100,22 @@ digraph kt44814_kt { 28 -> {29}; subgraph cluster_10 { - color=red - 30 [label="Enter property [2]" style="filled" fillcolor=red]; - 31 [label="Access variable R|/lighterASTNode| [2]"]; - 32 [label="Exit property [2]" style="filled" fillcolor=red]; - } - 30 -> {31}; - 31 -> {32}; - 32 -> {38} [color=green]; - - subgraph cluster_11 { - color=red - 33 [label="Enter property [2]" style="filled" fillcolor=red]; - 34 [label="Access variable R|/treeStructure| [2]"]; - 35 [label="Exit property [2]" style="filled" fillcolor=red]; - } - 33 -> {34}; - 34 -> {35}; - 35 -> {39} [color=green]; - - subgraph cluster_12 { color=red 36 [label="Enter class FirLightSourceElement [1]" style="filled" fillcolor=red]; 37 [label="Part of class initialization [1]"]; + subgraph cluster_11 { + color=blue + 30 [label="Enter property [2]" style="filled" fillcolor=red]; + 31 [label="Access variable R|/lighterASTNode| [2]"]; + 32 [label="Exit property [2]" style="filled" fillcolor=red]; + } 38 [label="Part of class initialization [1]"]; + subgraph cluster_12 { + color=blue + 33 [label="Enter property [2]" style="filled" fillcolor=red]; + 34 [label="Access variable R|/treeStructure| [2]"]; + 35 [label="Exit property [2]" style="filled" fillcolor=red]; + } 39 [label="Exit class FirLightSourceElement [1]" style="filled" fillcolor=red]; } 36 -> {37} [color=green]; @@ -136,6 +125,12 @@ digraph kt44814_kt { 38 -> {33} [color=green]; 38 -> {39} [style=dotted]; 38 -> {33} [style=dashed]; + 30 -> {31}; + 31 -> {32}; + 32 -> {38} [color=green]; + 33 -> {34}; + 34 -> {35}; + 35 -> {39} [color=green]; subgraph cluster_13 { color=red @@ -188,19 +183,9 @@ digraph kt44814_kt { 54 -> {55}; subgraph cluster_19 { - color=red - 56 [label="Enter property [2]" style="filled" fillcolor=red]; - 57 [label="Access variable R|/_children| [2]"]; - 58 [label="Exit property [2]" style="filled" fillcolor=red]; - } - 56 -> {57}; - 57 -> {58}; - 58 -> {72} [color=green]; - - subgraph cluster_20 { color=red 59 [label="Enter function getChildren [2]" style="filled" fillcolor=red]; - subgraph cluster_21 { + subgraph cluster_20 { color=blue 60 [label="Enter block [2]"]; 61 [label="Access variable R|/LighterASTNode._children| [2]"]; @@ -218,23 +203,24 @@ digraph kt44814_kt { 63 -> {64} [style=dotted]; 64 -> {65} [style=dotted]; - subgraph cluster_22 { - color=red - 66 [label="Enter property [2]" style="filled" fillcolor=red]; - 67 [label="Access qualifier /TokenType [2]"]; - 68 [label="Access variable R|/TokenType.Companion.MODIFIER_LIST| [2]"]; - 69 [label="Exit property [2]" style="filled" fillcolor=red]; - } - 66 -> {67}; - 67 -> {68}; - 68 -> {69}; - 69 -> {73} [color=green]; - - subgraph cluster_23 { + subgraph cluster_21 { color=red 70 [label="Enter class LighterASTNode [1]" style="filled" fillcolor=red]; 71 [label="Part of class initialization [1]"]; + subgraph cluster_22 { + color=blue + 56 [label="Enter property [2]" style="filled" fillcolor=red]; + 57 [label="Access variable R|/_children| [2]"]; + 58 [label="Exit property [2]" style="filled" fillcolor=red]; + } 72 [label="Part of class initialization [1]"]; + subgraph cluster_23 { + color=blue + 66 [label="Enter property [2]" style="filled" fillcolor=red]; + 67 [label="Access qualifier /TokenType [2]"]; + 68 [label="Access variable R|/TokenType.Companion.MODIFIER_LIST| [2]"]; + 69 [label="Exit property [2]" style="filled" fillcolor=red]; + } 73 [label="Exit class LighterASTNode [1]" style="filled" fillcolor=red]; } 70 -> {71} [color=green]; @@ -244,6 +230,13 @@ digraph kt44814_kt { 72 -> {66} [color=green]; 72 -> {73} [style=dotted]; 72 -> {66} [style=dashed]; + 56 -> {57}; + 57 -> {58}; + 58 -> {72} [color=green]; + 66 -> {67}; + 67 -> {68}; + 68 -> {69}; + 69 -> {73} [color=green]; subgraph cluster_24 { color=red @@ -264,25 +257,24 @@ digraph kt44814_kt { 78 -> {79}; subgraph cluster_26 { - color=red - 80 [label="Enter property [3]" style="filled" fillcolor=red]; - 81 [label="Function call: R|/TokenType.TokenType|() [3]" style="filled" fillcolor=yellow]; - 82 [label="Exit property [3]" style="filled" fillcolor=red]; - } - 80 -> {81}; - 81 -> {82}; - 82 -> {85} [color=green]; - - subgraph cluster_27 { color=red 83 [label="Enter class Companion [2]" style="filled" fillcolor=red]; 84 [label="Part of class initialization [2]"]; + subgraph cluster_27 { + color=blue + 80 [label="Enter property [3]" style="filled" fillcolor=red]; + 81 [label="Function call: R|/TokenType.TokenType|() [3]" style="filled" fillcolor=yellow]; + 82 [label="Exit property [3]" style="filled" fillcolor=red]; + } 85 [label="Exit class Companion [2]" style="filled" fillcolor=red]; } 83 -> {84} [color=green]; 84 -> {80} [color=green]; 84 -> {85} [style=dotted]; 84 -> {80} [style=dashed]; + 80 -> {81}; + 81 -> {82}; + 82 -> {85} [color=green]; subgraph cluster_28 { color=red @@ -333,25 +325,24 @@ digraph kt44814_kt { 99 -> {100}; subgraph cluster_34 { - color=red - 101 [label="Enter property [2]" style="filled" fillcolor=red]; - 102 [label="Function call: R|/KtModifierList.KtModifierList|() [2]" style="filled" fillcolor=yellow]; - 103 [label="Exit property [2]" style="filled" fillcolor=red]; - } - 101 -> {102}; - 102 -> {103}; - 103 -> {106} [color=green]; - - subgraph cluster_35 { color=red 104 [label="Enter class KtModifierListOwner [1]" style="filled" fillcolor=red]; 105 [label="Part of class initialization [1]"]; + subgraph cluster_35 { + color=blue + 101 [label="Enter property [2]" style="filled" fillcolor=red]; + 102 [label="Function call: R|/KtModifierList.KtModifierList|() [2]" style="filled" fillcolor=yellow]; + 103 [label="Exit property [2]" style="filled" fillcolor=red]; + } 106 [label="Exit class KtModifierListOwner [1]" style="filled" fillcolor=red]; } 104 -> {105} [color=green]; 105 -> {101} [color=green]; 105 -> {106} [style=dotted]; 105 -> {101} [style=dashed]; + 101 -> {102}; + 102 -> {103}; + 103 -> {106} [color=green]; subgraph cluster_36 { color=red @@ -363,26 +354,6 @@ digraph kt44814_kt { 108 -> {109}; subgraph cluster_37 { - color=red - 110 [label="Enter property [2]" style="filled" fillcolor=red]; - 111 [label="Access variable R|/node| [2]"]; - 112 [label="Exit property [2]" style="filled" fillcolor=red]; - } - 110 -> {111}; - 111 -> {112}; - 112 -> {136} [color=green]; - - subgraph cluster_38 { - color=red - 113 [label="Enter property [2]" style="filled" fillcolor=red]; - 114 [label="Access variable R|/token| [2]"]; - 115 [label="Exit property [2]" style="filled" fillcolor=red]; - } - 113 -> {114}; - 114 -> {115}; - 115 -> {137} [color=green]; - - subgraph cluster_39 { color=red 116 [label="Enter function [3]" style="filled" fillcolor=red]; 117 [label="Access variable R|/node| [4]"]; @@ -395,14 +366,14 @@ digraph kt44814_kt { 118 -> {119}; 119 -> {120}; - subgraph cluster_40 { + subgraph cluster_38 { color=red 121 [label="Enter class FirPsiModifier [2]" style="filled" fillcolor=red]; 122 [label="Exit class FirPsiModifier [2]" style="filled" fillcolor=red]; } 121 -> {122} [color=green]; - subgraph cluster_41 { + subgraph cluster_39 { color=red 123 [label="Enter function [3]" style="filled" fillcolor=red]; 124 [label="Access variable R|/node| [4]"]; @@ -415,32 +386,43 @@ digraph kt44814_kt { 125 -> {126}; 126 -> {127}; - subgraph cluster_42 { - color=red - 128 [label="Enter property [3]" style="filled" fillcolor=red]; - 129 [label="Access variable R|/tree| [3]"]; - 130 [label="Exit property [3]" style="filled" fillcolor=red]; - } - 128 -> {129}; - 129 -> {130}; - 130 -> {133} [color=green]; - - subgraph cluster_43 { + subgraph cluster_40 { color=red 131 [label="Enter class FirLightModifier [2]" style="filled" fillcolor=red]; 132 [label="Part of class initialization [2]"]; + subgraph cluster_41 { + color=blue + 128 [label="Enter property [3]" style="filled" fillcolor=red]; + 129 [label="Access variable R|/tree| [3]"]; + 130 [label="Exit property [3]" style="filled" fillcolor=red]; + } 133 [label="Exit class FirLightModifier [2]" style="filled" fillcolor=red]; } 131 -> {132} [color=green]; 132 -> {128} [color=green]; 132 -> {133} [style=dotted]; 132 -> {128} [style=dashed]; + 128 -> {129}; + 129 -> {130}; + 130 -> {133} [color=green]; - subgraph cluster_44 { + subgraph cluster_42 { color=red 134 [label="Enter class FirModifier [1]" style="filled" fillcolor=red]; 135 [label="Part of class initialization [1]"]; + subgraph cluster_43 { + color=blue + 110 [label="Enter property [2]" style="filled" fillcolor=red]; + 111 [label="Access variable R|/node| [2]"]; + 112 [label="Exit property [2]" style="filled" fillcolor=red]; + } 136 [label="Part of class initialization [1]"]; + subgraph cluster_44 { + color=blue + 113 [label="Enter property [2]" style="filled" fillcolor=red]; + 114 [label="Access variable R|/token| [2]"]; + 115 [label="Exit property [2]" style="filled" fillcolor=red]; + } 137 [label="Exit class FirModifier [1]" style="filled" fillcolor=red]; } 134 -> {135} [color=green]; @@ -450,6 +432,12 @@ digraph kt44814_kt { 136 -> {113} [color=green]; 136 -> {137} [style=dotted]; 136 -> {113} [style=dashed]; + 110 -> {111}; + 111 -> {112}; + 112 -> {136} [color=green]; + 113 -> {114}; + 114 -> {115}; + 115 -> {137} [color=green]; subgraph cluster_45 { color=red @@ -461,16 +449,6 @@ digraph kt44814_kt { 139 -> {140}; subgraph cluster_46 { - color=red - 141 [label="Enter property [2]" style="filled" fillcolor=red]; - 142 [label="Function call: R|kotlin/collections/emptyList||>() [2]" style="filled" fillcolor=yellow]; - 143 [label="Exit property [2]" style="filled" fillcolor=red]; - } - 141 -> {142}; - 142 -> {143}; - 143 -> {286} [color=green]; - - subgraph cluster_47 { color=red 144 [label="Enter function [3]" style="filled" fillcolor=red]; 145 [label="Delegated constructor call: super() [3]" style="filled" fillcolor=yellow]; @@ -479,28 +457,27 @@ digraph kt44814_kt { 144 -> {145}; 145 -> {146}; - subgraph cluster_48 { - color=red - 147 [label="Enter property [3]" style="filled" fillcolor=red]; - 148 [label="Access variable R|/modifierList| [3]"]; - 149 [label="Exit property [3]" style="filled" fillcolor=red]; - } - 147 -> {148}; - 148 -> {149}; - 149 -> {152} [color=green]; - - subgraph cluster_49 { + subgraph cluster_47 { color=red 150 [label="Enter class FirPsiModifierList [2]" style="filled" fillcolor=red]; 151 [label="Part of class initialization [2]"]; + subgraph cluster_48 { + color=blue + 147 [label="Enter property [3]" style="filled" fillcolor=red]; + 148 [label="Access variable R|/modifierList| [3]"]; + 149 [label="Exit property [3]" style="filled" fillcolor=red]; + } 152 [label="Exit class FirPsiModifierList [2]" style="filled" fillcolor=red]; } 150 -> {151} [color=green]; 151 -> {147} [color=green]; 151 -> {152} [style=dotted]; 151 -> {147} [style=dashed]; + 147 -> {148}; + 148 -> {149}; + 149 -> {152} [color=green]; - subgraph cluster_50 { + subgraph cluster_49 { color=red 153 [label="Enter function [3]" style="filled" fillcolor=red]; 154 [label="Delegated constructor call: super() [3]" style="filled" fillcolor=yellow]; @@ -509,31 +486,23 @@ digraph kt44814_kt { 153 -> {154}; 154 -> {155}; - subgraph cluster_51 { - color=red - 156 [label="Enter property [3]" style="filled" fillcolor=red]; - 157 [label="Access variable R|/modifierList| [3]"]; - 158 [label="Exit property [3]" style="filled" fillcolor=red]; - } - 156 -> {157}; - 157 -> {158}; - 158 -> {164} [color=green]; - - subgraph cluster_52 { - color=red - 159 [label="Enter property [3]" style="filled" fillcolor=red]; - 160 [label="Access variable R|/tree| [3]"]; - 161 [label="Exit property [3]" style="filled" fillcolor=red]; - } - 159 -> {160}; - 160 -> {161}; - 161 -> {165} [color=green]; - - subgraph cluster_53 { + subgraph cluster_50 { color=red 162 [label="Enter class FirLightModifierList [2]" style="filled" fillcolor=red]; 163 [label="Part of class initialization [2]"]; + subgraph cluster_51 { + color=blue + 156 [label="Enter property [3]" style="filled" fillcolor=red]; + 157 [label="Access variable R|/modifierList| [3]"]; + 158 [label="Exit property [3]" style="filled" fillcolor=red]; + } 164 [label="Part of class initialization [2]"]; + subgraph cluster_52 { + color=blue + 159 [label="Enter property [3]" style="filled" fillcolor=red]; + 160 [label="Access variable R|/tree| [3]"]; + 161 [label="Exit property [3]" style="filled" fillcolor=red]; + } 165 [label="Exit class FirLightModifierList [2]" style="filled" fillcolor=red]; } 162 -> {163} [color=green]; @@ -543,8 +512,14 @@ digraph kt44814_kt { 164 -> {159} [color=green]; 164 -> {165} [style=dotted]; 164 -> {159} [style=dashed]; + 156 -> {157}; + 157 -> {158}; + 158 -> {164} [color=green]; + 159 -> {160}; + 160 -> {161}; + 161 -> {165} [color=green]; - subgraph cluster_54 { + subgraph cluster_53 { color=red 166 [label="Enter function [3]" style="filled" fillcolor=red]; 167 [label="Delegated constructor call: super() [3]" style="filled" fillcolor=yellow]; @@ -553,17 +528,17 @@ digraph kt44814_kt { 166 -> {167}; 167 -> {168}; - subgraph cluster_55 { + subgraph cluster_54 { color=red 169 [label="Enter function getModifierList [3]" style="filled" fillcolor=red]; - subgraph cluster_56 { + subgraph cluster_55 { color=blue 170 [label="Enter block [3]"]; - subgraph cluster_57 { + subgraph cluster_56 { color=blue 171 [label="Enter when [3]"]; 172 [label="Access variable this@R|/FirModifierList.Companion.getModifierList| [4]"]; - subgraph cluster_58 { + subgraph cluster_57 { color=blue 173 [label="Enter when branch condition [4]"]; 174 [label="Exit $subj [5]"]; @@ -571,14 +546,14 @@ digraph kt44814_kt { 176 [label="Equality operator == [5]"]; 177 [label="Exit when branch condition [4]"]; } - subgraph cluster_59 { + subgraph cluster_58 { color=blue 178 [label="Enter when branch condition [5]"]; 179 [label="Exit $subj [6]"]; 180 [label="Type operator: ($subj$ is R|FirPsiSourceElement|) [6]"]; 181 [label="Exit when branch condition [5]"]; } - subgraph cluster_60 { + subgraph cluster_59 { color=blue 182 [label="Enter when branch condition [6]"]; 183 [label="Exit $subj [7]"]; @@ -586,17 +561,17 @@ digraph kt44814_kt { 185 [label="Exit when branch condition [6]"]; } 186 [label="Enter when branch result [7]"]; - subgraph cluster_61 { + subgraph cluster_60 { color=blue 187 [label="Enter block [7]"]; 188 [label="Access variable R|/FirLightSourceElement.lighterASTNode| [9]"]; 189 [label="Access variable R|/FirLightSourceElement.treeStructure| [9]"]; 190 [label="Function call: this@R|/FirModifierList.Companion.getModifierList|.R|/FirLightSourceElement.lighterASTNode|.R|/LighterASTNode.getChildren|(...) [8]" style="filled" fillcolor=yellow]; 191 [label="Postponed enter to lambda [8]"]; - subgraph cluster_62 { + subgraph cluster_61 { color=blue 238 [label="Enter function anonymousFunction [9]" style="filled" fillcolor=red]; - subgraph cluster_63 { + subgraph cluster_62 { color=blue 239 [label="Enter block [9]"]; 240 [label="Access variable R|/it| [9]"]; @@ -627,7 +602,7 @@ digraph kt44814_kt { } 206 [label="Exit when branch result [6]"]; 207 [label="Enter when branch result [6]"]; - subgraph cluster_64 { + subgraph cluster_63 { color=blue 208 [label="Enter block [6]"]; 209 [label="Access variable R|/FirPsiSourceElement.psi| [6]"]; @@ -636,10 +611,10 @@ digraph kt44814_kt { 212 [label="Access variable R|/KtModifierListOwner.modifierList| [6]"]; 213 [label="Enter safe call [6]"]; 214 [label="Postponed enter to lambda [7]"]; - subgraph cluster_65 { + subgraph cluster_64 { color=blue 232 [label="Enter function anonymousFunction [8]" style="filled" fillcolor=red]; - subgraph cluster_66 { + subgraph cluster_65 { color=blue 233 [label="Enter block [8]"]; 234 [label="Access variable R|/it| [9]"]; @@ -657,7 +632,7 @@ digraph kt44814_kt { 220 [label="Exit when branch result [5]"]; 221 [label="Merge postponed lambda exits [6]"]; 222 [label="Enter when branch result [5]"]; - subgraph cluster_67 { + subgraph cluster_66 { color=blue 223 [label="Enter block [5]"]; 224 [label="Const: Null(null) [5]"]; @@ -777,10 +752,10 @@ digraph kt44814_kt { 247 -> {248}; 248 -> {192}; - subgraph cluster_68 { + subgraph cluster_67 { color=red 249 [label="Enter function boxImpl [3]" style="filled" fillcolor=red]; - subgraph cluster_69 { + subgraph cluster_68 { color=blue 250 [label="Enter block [3]"]; 251 [label="Function call: R|/LighterASTNode.LighterASTNode|() [6]" style="filled" fillcolor=yellow]; @@ -792,23 +767,23 @@ digraph kt44814_kt { 257 [label="Access variable R|/sourceElement| [4]"]; 258 [label="Function call: (this@R|/FirModifierList.Companion|, R|/sourceElement|).R|/FirModifierList.Companion.getModifierList|() [3]" style="filled" fillcolor=yellow]; 259 [label="Variable declaration: lval result: R|FirModifierList?| [3]"]; - subgraph cluster_70 { + subgraph cluster_69 { color=blue 260 [label="Enter when [3]"]; - subgraph cluster_71 { + subgraph cluster_70 { color=blue 261 [label="Enter when branch condition [4]"]; 262 [label="Access variable R|/result| [5]"]; 263 [label="Type operator: (R|/result| is R|FirModifierList.FirLightModifierList|) [5]"]; 264 [label="Exit when branch condition [4]"]; } - subgraph cluster_72 { + subgraph cluster_71 { color=blue 265 [label="Enter when branch condition else [5]"]; 266 [label="Exit when branch condition [5]"]; } 267 [label="Enter when branch result [6]"]; - subgraph cluster_73 { + subgraph cluster_72 { color=blue 268 [label="Enter block [6]"]; 269 [label="Const: String(Fail) [6]"]; @@ -816,7 +791,7 @@ digraph kt44814_kt { } 271 [label="Exit when branch result [5]"]; 272 [label="Enter when branch result [5]"]; - subgraph cluster_74 { + subgraph cluster_73 { color=blue 273 [label="Enter block [5]"]; 274 [label="Const: String(OK) [5]"]; @@ -873,23 +848,32 @@ digraph kt44814_kt { 279 -> {280} [style=dotted]; 280 -> {281} [style=dotted]; - subgraph cluster_75 { + subgraph cluster_74 { color=red 282 [label="Enter class Companion [2]" style="filled" fillcolor=red]; 283 [label="Exit class Companion [2]" style="filled" fillcolor=red]; } 282 -> {283} [color=green]; - subgraph cluster_76 { + subgraph cluster_75 { color=red 284 [label="Enter class FirModifierList [1]" style="filled" fillcolor=red]; 285 [label="Part of class initialization [1]"]; + subgraph cluster_76 { + color=blue + 141 [label="Enter property [2]" style="filled" fillcolor=red]; + 142 [label="Function call: R|kotlin/collections/emptyList||>() [2]" style="filled" fillcolor=yellow]; + 143 [label="Exit property [2]" style="filled" fillcolor=red]; + } 286 [label="Exit class FirModifierList [1]" style="filled" fillcolor=red]; } 284 -> {285} [color=green]; 285 -> {141} [color=green]; 285 -> {286} [style=dotted]; 285 -> {141} [style=dashed]; + 141 -> {142}; + 142 -> {143}; + 143 -> {286} [color=green]; subgraph cluster_77 { color=red