Files
kotlin-fork/compiler/fir/analysis-tests/testData/resolve/smartcasts/safeCalls/assignSafeCall.dot
T
Brian Norman b55fda0c55 [FIR] Create CFG for files to track top-level property initialization
In order to properly analyze top-level property initialization, a
control-flow graph must be created for FirFiles. This change adds the
foundation for the file CFG and updates body resolve to create the CFG.
Checking the CFG for proper initialization is separated into a following
change to ease code review.

KT-56683
2023-08-31 12:50:52 +00:00

435 lines
14 KiB
Plaintext
Vendored

digraph assignSafeCall_kt {
graph [nodesep=3]
node [shape=box penwidth=2]
edge [penwidth=2]
subgraph cluster_0 {
color=red
0 [label="Enter file assignSafeCall.kt" style="filled" fillcolor=red];
1 [label="Exit file assignSafeCall.kt" style="filled" fillcolor=red];
}
0 -> {1} [color=green];
subgraph cluster_1 {
color=red
2 [label="Enter class A" style="filled" fillcolor=red];
subgraph cluster_2 {
color=blue
3 [label="Enter property" style="filled" fillcolor=red];
4 [label="Const: Int(1)"];
5 [label="Exit property" style="filled" fillcolor=red];
}
subgraph cluster_3 {
color=blue
6 [label="Enter function <init>" style="filled" fillcolor=red];
7 [label="Delegated constructor call: super<R|kotlin/Any|>()" style="filled" fillcolor=yellow];
8 [label="Exit function <init>" style="filled" fillcolor=red];
}
9 [label="Exit class A" style="filled" fillcolor=red];
}
2 -> {3} [color=green];
2 -> {9} [style=dotted];
2 -> {3 6} [style=dashed];
3 -> {4};
4 -> {5};
5 -> {6} [color=green];
6 -> {7};
7 -> {8};
8 -> {9} [color=green];
subgraph cluster_4 {
color=red
10 [label="Enter function foo" style="filled" fillcolor=red];
subgraph cluster_5 {
color=blue
11 [label="Enter block"];
12 [label="Const: Int(1)"];
13 [label="Jump: ^foo Int(1)"];
14 [label="Stub" style="filled" fillcolor=gray];
15 [label="Exit block" style="filled" fillcolor=gray];
}
16 [label="Exit function foo" style="filled" fillcolor=red];
}
10 -> {11};
11 -> {12};
12 -> {13};
13 -> {16};
13 -> {14} [style=dotted];
14 -> {15} [style=dotted];
15 -> {16} [style=dotted];
subgraph cluster_6 {
color=red
17 [label="Enter function bar" style="filled" fillcolor=red];
subgraph cluster_7 {
color=blue
18 [label="Enter block"];
19 [label="Exit block"];
}
20 [label="Exit function bar" style="filled" fillcolor=red];
}
17 -> {18};
18 -> {19};
19 -> {20};
subgraph cluster_8 {
color=red
21 [label="Enter function test_1" style="filled" fillcolor=red];
subgraph cluster_9 {
color=blue
22 [label="Enter block"];
23 [label="Access variable R|<local>/a|"];
24 [label="Enter safe call"];
25 [label="Access variable R|/A.x|"];
26 [label="Exit safe call"];
27 [label="Variable declaration: lval x: R|kotlin/Int?|"];
subgraph cluster_10 {
color=blue
28 [label="Enter when"];
subgraph cluster_11 {
color=blue
29 [label="Enter when branch condition "];
30 [label="Access variable R|<local>/x|"];
31 [label="Const: Null(null)"];
32 [label="Equality operator !="];
33 [label="Exit when branch condition"];
}
34 [label="Synthetic else branch"];
35 [label="Enter when branch result"];
subgraph cluster_12 {
color=blue
36 [label="Enter block"];
37 [label="Access variable R|<local>/a|"];
38 [label="Smart cast: R|<local>/a|"];
39 [label="Function call: R|<local>/a|.R|/A.bar|()" style="filled" fillcolor=yellow];
40 [label="Exit block"];
}
41 [label="Exit when branch result"];
42 [label="Exit when"];
}
43 [label="Exit block"];
}
44 [label="Exit function test_1" style="filled" fillcolor=red];
}
21 -> {22};
22 -> {23};
23 -> {24 26};
24 -> {25};
25 -> {26};
26 -> {27};
27 -> {28};
28 -> {29};
29 -> {30};
30 -> {31};
31 -> {32};
32 -> {33};
33 -> {34 35};
34 -> {42};
35 -> {36};
36 -> {37};
37 -> {38};
38 -> {39};
39 -> {40};
40 -> {41};
41 -> {42};
42 -> {43};
43 -> {44};
subgraph cluster_13 {
color=red
45 [label="Enter function test_2" style="filled" fillcolor=red];
subgraph cluster_14 {
color=blue
46 [label="Enter block"];
47 [label="Access variable R|<local>/a|"];
48 [label="Enter safe call"];
49 [label="Function call: $subj$.R|/A.foo|()" style="filled" fillcolor=yellow];
50 [label="Exit safe call"];
51 [label="Variable declaration: lval x: R|kotlin/Int?|"];
subgraph cluster_15 {
color=blue
52 [label="Enter when"];
subgraph cluster_16 {
color=blue
53 [label="Enter when branch condition "];
54 [label="Access variable R|<local>/x|"];
55 [label="Const: Null(null)"];
56 [label="Equality operator !="];
57 [label="Exit when branch condition"];
}
58 [label="Synthetic else branch"];
59 [label="Enter when branch result"];
subgraph cluster_17 {
color=blue
60 [label="Enter block"];
61 [label="Access variable R|<local>/a|"];
62 [label="Smart cast: R|<local>/a|"];
63 [label="Function call: R|<local>/a|.R|/A.bar|()" style="filled" fillcolor=yellow];
64 [label="Exit block"];
}
65 [label="Exit when branch result"];
66 [label="Exit when"];
}
67 [label="Exit block"];
}
68 [label="Exit function test_2" style="filled" fillcolor=red];
}
45 -> {46};
46 -> {47};
47 -> {48 50};
48 -> {49};
49 -> {50};
50 -> {51};
51 -> {52};
52 -> {53};
53 -> {54};
54 -> {55};
55 -> {56};
56 -> {57};
57 -> {58 59};
58 -> {66};
59 -> {60};
60 -> {61};
61 -> {62};
62 -> {63};
63 -> {64};
64 -> {65};
65 -> {66};
66 -> {67};
67 -> {68};
subgraph cluster_18 {
color=red
69 [label="Enter function test_3" style="filled" fillcolor=red];
subgraph cluster_19 {
color=blue
70 [label="Enter block"];
71 [label="Access variable R|<local>/x|"];
72 [label="Type operator: (R|<local>/x| as? R|A|)"];
73 [label="Exit lhs of ?:"];
74 [label="Enter rhs of ?:"];
75 [label="Jump: ^test_3 Unit"];
76 [label="Stub" style="filled" fillcolor=gray];
77 [label="Lhs of ?: is not null"];
78 [label="Exit ?:"];
79 [label="Variable declaration: lval a: R|A|"];
80 [label="Access variable R|<local>/a|"];
81 [label="Function call: R|<local>/a|.R|/A.foo|()" style="filled" fillcolor=yellow];
82 [label="Access variable R|<local>/x|"];
83 [label="Smart cast: R|<local>/x|"];
84 [label="Function call: R|<local>/x|.R|/A.foo|()" style="filled" fillcolor=yellow];
85 [label="Exit block"];
}
86 [label="Exit function test_3" style="filled" fillcolor=red];
}
69 -> {70};
70 -> {71};
71 -> {72};
72 -> {73};
73 -> {74 77};
74 -> {75};
75 -> {86};
75 -> {76} [style=dotted];
76 -> {78} [style=dotted];
77 -> {78};
78 -> {79};
79 -> {80};
80 -> {81};
81 -> {82};
82 -> {83};
83 -> {84};
84 -> {85};
85 -> {86};
subgraph cluster_20 {
color=red
87 [label="Enter class B" style="filled" fillcolor=red];
88 [label="Exit class B" style="filled" fillcolor=red];
}
87 -> {88} [color=green];
subgraph cluster_21 {
color=red
89 [label="Enter function foo" style="filled" fillcolor=red];
90 [label="Exit function foo" style="filled" fillcolor=red];
}
89 -> {90};
subgraph cluster_22 {
color=red
91 [label="Enter function bar" style="filled" fillcolor=red];
92 [label="Exit function bar" style="filled" fillcolor=red];
}
91 -> {92};
subgraph cluster_23 {
color=red
93 [label="Enter function test_1" style="filled" fillcolor=red];
subgraph cluster_24 {
color=blue
94 [label="Enter block"];
95 [label="Access variable R|<local>/a|"];
96 [label="Enter safe call"];
97 [label="Access variable R|/B.x|"];
98 [label="Exit safe call"];
99 [label="Variable declaration: lval x: R|kotlin/Int?|"];
subgraph cluster_25 {
color=blue
100 [label="Enter when"];
subgraph cluster_26 {
color=blue
101 [label="Enter when branch condition "];
102 [label="Access variable R|<local>/x|"];
103 [label="Const: Null(null)"];
104 [label="Equality operator !="];
105 [label="Exit when branch condition"];
}
106 [label="Synthetic else branch"];
107 [label="Enter when branch result"];
subgraph cluster_27 {
color=blue
108 [label="Enter block"];
109 [label="Access variable R|<local>/a|"];
110 [label="Smart cast: R|<local>/a|"];
111 [label="Function call: R|<local>/a|.R|/B.bar|()" style="filled" fillcolor=yellow];
112 [label="Exit block"];
}
113 [label="Exit when branch result"];
114 [label="Exit when"];
}
115 [label="Exit block"];
}
116 [label="Exit function test_1" style="filled" fillcolor=red];
}
93 -> {94};
94 -> {95};
95 -> {96 98};
96 -> {97};
97 -> {98};
98 -> {99};
99 -> {100};
100 -> {101};
101 -> {102};
102 -> {103};
103 -> {104};
104 -> {105};
105 -> {106 107};
106 -> {114};
107 -> {108};
108 -> {109};
109 -> {110};
110 -> {111};
111 -> {112};
112 -> {113};
113 -> {114};
114 -> {115};
115 -> {116};
subgraph cluster_28 {
color=red
117 [label="Enter function test_2" style="filled" fillcolor=red];
subgraph cluster_29 {
color=blue
118 [label="Enter block"];
119 [label="Access variable R|<local>/a|"];
120 [label="Enter safe call"];
121 [label="Function call: $subj$.R|/B.foo|()" style="filled" fillcolor=yellow];
122 [label="Exit safe call"];
123 [label="Variable declaration: lval x: R|kotlin/Int?|"];
subgraph cluster_30 {
color=blue
124 [label="Enter when"];
subgraph cluster_31 {
color=blue
125 [label="Enter when branch condition "];
126 [label="Access variable R|<local>/x|"];
127 [label="Const: Null(null)"];
128 [label="Equality operator !="];
129 [label="Exit when branch condition"];
}
130 [label="Synthetic else branch"];
131 [label="Enter when branch result"];
subgraph cluster_32 {
color=blue
132 [label="Enter block"];
133 [label="Access variable R|<local>/a|"];
134 [label="Smart cast: R|<local>/a|"];
135 [label="Function call: R|<local>/a|.R|/B.bar|()" style="filled" fillcolor=yellow];
136 [label="Exit block"];
}
137 [label="Exit when branch result"];
138 [label="Exit when"];
}
139 [label="Exit block"];
}
140 [label="Exit function test_2" style="filled" fillcolor=red];
}
117 -> {118};
118 -> {119};
119 -> {120 122};
120 -> {121};
121 -> {122};
122 -> {123};
123 -> {124};
124 -> {125};
125 -> {126};
126 -> {127};
127 -> {128};
128 -> {129};
129 -> {130 131};
130 -> {138};
131 -> {132};
132 -> {133};
133 -> {134};
134 -> {135};
135 -> {136};
136 -> {137};
137 -> {138};
138 -> {139};
139 -> {140};
subgraph cluster_33 {
color=red
141 [label="Enter function test_3" style="filled" fillcolor=red];
subgraph cluster_34 {
color=blue
142 [label="Enter block"];
143 [label="Access variable R|<local>/x|"];
144 [label="Type operator: (R|<local>/x| as? R|B|)"];
145 [label="Exit lhs of ?:"];
146 [label="Enter rhs of ?:"];
147 [label="Jump: ^test_3 Unit"];
148 [label="Stub" style="filled" fillcolor=gray];
149 [label="Lhs of ?: is not null"];
150 [label="Exit ?:"];
151 [label="Variable declaration: lval a: R|B|"];
152 [label="Access variable R|<local>/a|"];
153 [label="Function call: R|<local>/a|.R|/B.foo|()" style="filled" fillcolor=yellow];
154 [label="Access variable R|<local>/x|"];
155 [label="Smart cast: R|<local>/x|"];
156 [label="Function call: R|<local>/x|.R|/B.foo|()" style="filled" fillcolor=yellow];
157 [label="Exit block"];
}
158 [label="Exit function test_3" style="filled" fillcolor=red];
}
141 -> {142};
142 -> {143};
143 -> {144};
144 -> {145};
145 -> {146 149};
146 -> {147};
147 -> {158};
147 -> {148} [style=dotted];
148 -> {150} [style=dotted];
149 -> {150};
150 -> {151};
151 -> {152};
152 -> {153};
153 -> {154};
154 -> {155};
155 -> {156};
156 -> {157};
157 -> {158};
}