Files
kotlin-fork/compiler/fir/analysis-tests/testData/resolve/smartcasts/safeCalls/safeCalls.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

326 lines
11 KiB
Plaintext
Vendored

digraph safeCalls_kt {
graph [nodesep=3]
node [shape=box penwidth=2]
edge [penwidth=2]
subgraph cluster_0 {
color=red
0 [label="Enter file safeCalls.kt" style="filled" fillcolor=red];
1 [label="Exit file safeCalls.kt" style="filled" fillcolor=red];
}
0 -> {1} [color=green];
subgraph cluster_1 {
color=red
2 [label="Enter function foo" style="filled" fillcolor=red];
subgraph cluster_2 {
color=blue
3 [label="Enter block"];
4 [label="Const: String()"];
5 [label="Jump: ^foo String()"];
6 [label="Stub" style="filled" fillcolor=gray];
7 [label="Exit block" style="filled" fillcolor=gray];
}
8 [label="Exit function foo" style="filled" fillcolor=red];
}
2 -> {3};
3 -> {4};
4 -> {5};
5 -> {8};
5 -> {6} [style=dotted];
6 -> {7} [style=dotted];
7 -> {8} [style=dotted];
subgraph cluster_3 {
color=red
9 [label="Enter function let" style="filled" fillcolor=red];
subgraph cluster_4 {
color=blue
10 [label="Enter block"];
11 [label="Exit block"];
}
12 [label="Exit function let" style="filled" fillcolor=red];
}
9 -> {10};
10 -> {11};
11 -> {12};
subgraph cluster_5 {
color=red
13 [label="Enter function test" style="filled" fillcolor=red];
subgraph cluster_6 {
color=blue
14 [label="Enter block"];
15 [label="Access variable R|<local>/x|"];
16 [label="Enter safe call"];
17 [label="Access variable R|<local>/x|"];
18 [label="Smart cast: R|<local>/x|"];
19 [label="Access variable R|kotlin/String.length|"];
20 [label="Const: Int(1)"];
21 [label="Equality operator =="];
22 [label="Function call: $subj$.R|/foo|(...)" style="filled" fillcolor=yellow];
23 [label="Exit safe call"];
24 [label="Access variable R|<local>/x|"];
25 [label="Access variable R|kotlin/String.length<Inapplicable(UNSAFE_CALL): kotlin/String.length>#|"];
26 [label="Exit block"];
}
27 [label="Exit function test" style="filled" fillcolor=red];
}
13 -> {14};
14 -> {15};
15 -> {16 23};
16 -> {17};
17 -> {18};
18 -> {19};
19 -> {20};
20 -> {21};
21 -> {22};
22 -> {23};
23 -> {24};
24 -> {25};
25 -> {26};
26 -> {27};
subgraph cluster_7 {
color=red
28 [label="Enter class A" style="filled" fillcolor=red];
29 [label="Exit class A" style="filled" fillcolor=red];
}
28 -> {29} [color=green];
subgraph cluster_8 {
color=red
30 [label="Enter function bar" style="filled" fillcolor=red];
31 [label="Exit function bar" style="filled" fillcolor=red];
}
30 -> {31};
subgraph cluster_9 {
color=red
32 [label="Enter function bool" style="filled" fillcolor=red];
33 [label="Exit function bool" style="filled" fillcolor=red];
}
32 -> {33};
subgraph cluster_10 {
color=red
34 [label="Enter function id" style="filled" fillcolor=red];
35 [label="Exit function id" style="filled" fillcolor=red];
}
34 -> {35};
subgraph cluster_11 {
color=red
36 [label="Enter function test_2" style="filled" fillcolor=red];
subgraph cluster_12 {
color=blue
37 [label="Enter block"];
38 [label="Access variable R|<local>/x|"];
39 [label="Type operator: (R|<local>/x| as? R|A|)"];
40 [label="Enter safe call"];
41 [label="Access variable R|<local>/x|"];
42 [label="Smart cast: R|<local>/x|"];
43 [label="Function call: $subj$.R|/A.bar|(...)" style="filled" fillcolor=yellow];
44 [label="Exit safe call"];
45 [label="Exit block"];
}
46 [label="Exit function test_2" style="filled" fillcolor=red];
}
36 -> {37};
37 -> {38};
38 -> {39};
39 -> {40 44};
40 -> {41};
41 -> {42};
42 -> {43};
43 -> {44};
44 -> {45};
45 -> {46};
subgraph cluster_13 {
color=red
47 [label="Enter function test_3" style="filled" fillcolor=red];
subgraph cluster_14 {
color=blue
48 [label="Enter block"];
49 [label="Access variable R|<local>/x|"];
50 [label="Type operator: (R|<local>/x| as? R|A|)"];
51 [label="Enter safe call"];
52 [label="Access variable R|<local>/x|"];
53 [label="Smart cast: R|<local>/x|"];
54 [label="Function call: $subj$.R|/A.bar|(...)" style="filled" fillcolor=yellow];
55 [label="Enter safe call"];
56 [label="Access variable R|<local>/x|"];
57 [label="Smart cast: R|<local>/x|"];
58 [label="Function call: R|<local>/x|.R|/A.bool|()" style="filled" fillcolor=yellow];
59 [label="Function call: $subj$.R|/foo|(...)" style="filled" fillcolor=yellow];
60 [label="Enter safe call"];
61 [label="Postponed enter to lambda"];
subgraph cluster_15 {
color=blue
62 [label="Enter function <anonymous>" style="filled" fillcolor=red];
subgraph cluster_16 {
color=blue
63 [label="Enter block"];
64 [label="Access variable R|<local>/x|"];
65 [label="Smart cast: R|<local>/x|"];
66 [label="Function call: R|<local>/x|.R|/A.bool|()" style="filled" fillcolor=yellow];
67 [label="Exit block"];
}
68 [label="Exit function <anonymous>" style="filled" fillcolor=red];
}
69 [label="Postponed exit from lambda"];
70 [label="Function call: $subj$.R|/let|(...)" style="filled" fillcolor=yellow];
71 [label="Exit safe call"];
72 [label="Exit safe call"];
73 [label="Exit safe call"];
74 [label="Access variable R|<local>/x|"];
75 [label="Function call: R|<local>/x|.<Unresolved name: bool>#()" style="filled" fillcolor=yellow];
76 [label="Exit block"];
}
77 [label="Exit function test_3" style="filled" fillcolor=red];
}
47 -> {48};
48 -> {49};
49 -> {50};
50 -> {51 71};
51 -> {52};
52 -> {53};
53 -> {54};
54 -> {55 71};
55 -> {56};
56 -> {57};
57 -> {58};
58 -> {59};
59 -> {60 72};
60 -> {61};
61 -> {62 69 70};
61 -> {62} [style=dashed];
62 -> {63};
63 -> {64};
64 -> {65};
65 -> {66};
66 -> {67};
67 -> {68};
69 -> {70};
70 -> {73};
71 -> {72};
72 -> {73};
73 -> {74};
74 -> {75};
75 -> {76};
76 -> {77};
subgraph cluster_17 {
color=red
78 [label="Enter function test_4" style="filled" fillcolor=red];
subgraph cluster_18 {
color=blue
79 [label="Enter block"];
80 [label="Access variable R|<local>/x|"];
81 [label="Enter safe call"];
82 [label="Function call: $subj$.R|/A.id|()" style="filled" fillcolor=yellow];
83 [label="Enter safe call"];
84 [label="Function call: $subj$.R|/A.bool|()" style="filled" fillcolor=yellow];
85 [label="Exit safe call"];
86 [label="Exit safe call"];
87 [label="Access variable R|<local>/x|"];
88 [label="Function call: R|<local>/x|.R|/A.id<Inapplicable(UNSAFE_CALL): /A.id>#|()" style="filled" fillcolor=yellow];
89 [label="Exit block"];
}
90 [label="Exit function test_4" style="filled" fillcolor=red];
}
78 -> {79};
79 -> {80};
80 -> {81 85};
81 -> {82};
82 -> {83 85};
83 -> {84};
84 -> {86};
85 -> {86};
86 -> {87};
87 -> {88};
88 -> {89};
89 -> {90};
subgraph cluster_19 {
color=red
91 [label="Enter function boo" style="filled" fillcolor=red];
subgraph cluster_20 {
color=blue
92 [label="Enter block"];
93 [label="Exit block"];
}
94 [label="Exit function boo" style="filled" fillcolor=red];
}
91 -> {92};
92 -> {93};
93 -> {94};
subgraph cluster_21 {
color=red
95 [label="Enter function test_5" style="filled" fillcolor=red];
subgraph cluster_22 {
color=blue
96 [label="Enter block"];
97 [label="Access variable R|<local>/x|"];
98 [label="Enter safe call"];
99 [label="Postponed enter to lambda"];
subgraph cluster_23 {
color=blue
100 [label="Enter function <anonymous>" style="filled" fillcolor=red];
subgraph cluster_24 {
color=blue
101 [label="Enter block"];
102 [label="Jump: ^test_5 Unit"];
103 [label="Stub" style="filled" fillcolor=gray];
104 [label="Exit block" style="filled" fillcolor=gray];
}
105 [label="Exit function <anonymous>" style="filled" fillcolor=gray];
}
106 [label="Postponed exit from lambda" style="filled" fillcolor=gray];
107 [label="Function call: $subj$.R|kotlin/let|<R|A|, R|kotlin/Nothing|>(...)" style="filled" fillcolor=gray];
108 [label="Stub" style="filled" fillcolor=gray];
109 [label="Enter safe call" style="filled" fillcolor=gray];
110 [label="Access variable R|<local>/x|" style="filled" fillcolor=gray];
111 [label="Smart cast: R|<local>/x|" style="filled" fillcolor=gray];
112 [label="Function call: R|<local>/x|.R|/A.bool|()" style="filled" fillcolor=gray];
113 [label="Function call: $subj$.R|/boo|(...)" style="filled" fillcolor=gray];
114 [label="Exit safe call"];
115 [label="Exit safe call"];
116 [label="Access variable R|<local>/x|"];
117 [label="Function call: R|<local>/x|.R|/A.id<Inapplicable(UNSAFE_CALL): /A.id>#|()" style="filled" fillcolor=yellow];
118 [label="Exit block"];
}
119 [label="Exit function test_5" style="filled" fillcolor=red];
}
95 -> {96};
96 -> {97};
97 -> {98 114};
98 -> {99};
99 -> {100};
99 -> {106 107} [style=dotted];
99 -> {100} [style=dashed];
100 -> {101};
101 -> {102};
102 -> {119};
102 -> {103} [style=dotted];
103 -> {104} [style=dotted];
104 -> {105} [style=dotted];
105 -> {106} [style=dotted];
106 -> {107} [style=dotted];
107 -> {108} [style=dotted];
108 -> {109 114} [style=dotted];
109 -> {110} [style=dotted];
110 -> {111} [style=dotted];
111 -> {112} [style=dotted];
112 -> {113} [style=dotted];
113 -> {115} [style=dotted];
114 -> {115};
115 -> {116};
116 -> {117};
117 -> {118};
118 -> {119};
}