Files
kotlin-fork/compiler/fir/analysis-tests/testData/resolve/smartcasts/smartcastToNothing.dot
T
Brian Norman 17a1871b83 [FIR] Make sure the primary constructor is first in class CFG
The primary constructor of a class needs to be the first subgraph of the
class control-flow graph. Based on the Kotlin specification, class
initialization order goes first primary constructor, in-place
declarations (properties and init blocks), and then secondary
constructors. If the class doesn't have a primary constructor, then it
is just skipped in the order.

Unfortunately, the class control-flow graph had in-place declarations
first and then all constructors. Instead, we should treat the primary
constructor as the first in-place declaration, and then continue with
the existing processing as secondary constructors. This will guarantee
that super constructor calls have the correct property initialization
information.

^KT-65093 Fixed
2024-01-23 23:16:00 +00:00

445 lines
17 KiB
Plaintext
Vendored

digraph smartcastToNothing_kt {
graph [nodesep=3]
node [shape=box penwidth=2]
edge [penwidth=2]
subgraph cluster_0 {
color=red
0 [label="Enter file smartcastToNothing.kt" style="filled" fillcolor=red];
1 [label="Exit file smartcastToNothing.kt" style="filled" fillcolor=red];
}
0 -> {1} [color=green];
subgraph cluster_1 {
color=red
2 [label="Enter function getNothing" style="filled" fillcolor=red];
subgraph cluster_2 {
color=blue
3 [label="Enter block"];
subgraph cluster_3 {
color=blue
4 [label="Function call arguments enter"];
5 [label="Function call arguments exit"];
}
6 [label="Function call: R|java/lang/Exception.Exception|()" style="filled" fillcolor=yellow];
7 [label="Throw: throw R|java/lang/Exception.Exception|()"];
8 [label="Stub" style="filled" fillcolor=gray];
9 [label="Jump: ^getNothing throw R|java/lang/Exception.Exception|()" style="filled" fillcolor=gray];
10 [label="Stub" style="filled" fillcolor=gray];
11 [label="Exit block" style="filled" fillcolor=gray];
}
12 [label="Exit function getNothing" style="filled" fillcolor=gray];
}
2 -> {3};
3 -> {4};
4 -> {5};
5 -> {6};
6 -> {7};
7 -> {8} [style=dotted];
8 -> {9} [style=dotted];
9 -> {10 12} [style=dotted];
10 -> {11} [style=dotted];
11 -> {12} [style=dotted];
subgraph cluster_4 {
color=red
13 [label="Enter function getNullableNothing" style="filled" fillcolor=red];
subgraph cluster_5 {
color=blue
14 [label="Enter block"];
15 [label="Const: Null(null)"];
16 [label="Jump: ^getNullableNothing Null(null)"];
17 [label="Stub" style="filled" fillcolor=gray];
18 [label="Exit block" style="filled" fillcolor=gray];
}
19 [label="Exit function getNullableNothing" style="filled" fillcolor=red];
}
13 -> {14};
14 -> {15};
15 -> {16};
16 -> {19};
16 -> {17} [style=dotted];
17 -> {18} [style=dotted];
18 -> {19} [style=dotted];
subgraph cluster_6 {
color=red
20 [label="Enter function <getter>" style="filled" fillcolor=red];
subgraph cluster_7 {
color=blue
21 [label="Enter block"];
22 [label="Const: Int(1)"];
23 [label="Jump: ^ Int(1)"];
24 [label="Stub" style="filled" fillcolor=gray];
25 [label="Exit block" style="filled" fillcolor=gray];
}
26 [label="Exit function <getter>" style="filled" fillcolor=red];
}
20 -> {21};
21 -> {22};
22 -> {23};
23 -> {26};
23 -> {24} [style=dotted];
24 -> {25} [style=dotted];
25 -> {26} [style=dotted];
subgraph cluster_8 {
color=red
27 [label="Enter function <getter>" style="filled" fillcolor=red];
subgraph cluster_9 {
color=blue
28 [label="Enter block"];
29 [label="Const: Int(2)"];
30 [label="Jump: ^ Int(2)"];
31 [label="Stub" style="filled" fillcolor=gray];
32 [label="Exit block" style="filled" fillcolor=gray];
}
33 [label="Exit function <getter>" style="filled" fillcolor=red];
}
27 -> {28};
28 -> {29};
29 -> {30};
30 -> {33};
30 -> {31} [style=dotted];
31 -> {32} [style=dotted];
32 -> {33} [style=dotted];
subgraph cluster_10 {
color=red
34 [label="Enter function myListOf" style="filled" fillcolor=red];
subgraph cluster_11 {
color=blue
35 [label="Enter block"];
36 [label="Const: Null(null)"];
37 [label="Check not null: Null(null)!!" style="filled" fillcolor=yellow];
38 [label="Stub" style="filled" fillcolor=gray];
39 [label="Jump: ^myListOf Null(null)!!" style="filled" fillcolor=gray];
40 [label="Stub" style="filled" fillcolor=gray];
41 [label="Exit block" style="filled" fillcolor=gray];
}
42 [label="Exit function myListOf" style="filled" fillcolor=gray];
}
34 -> {35};
35 -> {36};
36 -> {37};
37 -> {38} [style=dotted];
38 -> {39} [style=dotted];
39 -> {40 42} [style=dotted];
40 -> {41} [style=dotted];
41 -> {42} [style=dotted];
subgraph cluster_12 {
color=red
43 [label="Enter class A" style="filled" fillcolor=red];
subgraph cluster_13 {
color=blue
44 [label="Enter function <init>" style="filled" fillcolor=red];
45 [label="Delegated constructor call: super<R|kotlin/Any|>()" style="filled" fillcolor=yellow];
46 [label="Exit function <init>" style="filled" fillcolor=red];
}
subgraph cluster_14 {
color=blue
47 [label="Enter property" style="filled" fillcolor=red];
48 [label="Const: Int(1)"];
49 [label="Exit property" style="filled" fillcolor=red];
}
subgraph cluster_15 {
color=blue
50 [label="Enter property" style="filled" fillcolor=red];
51 [label="Const: Boolean(true)"];
52 [label="Exit property" style="filled" fillcolor=red];
}
53 [label="Exit class A" style="filled" fillcolor=red];
}
43 -> {44} [color=green];
43 -> {53} [style=dotted];
43 -> {44 47 50} [style=dashed];
44 -> {45};
45 -> {46};
46 -> {47} [color=green];
47 -> {48};
48 -> {49};
49 -> {50} [color=green];
50 -> {51};
51 -> {52};
52 -> {53} [color=green];
subgraph cluster_16 {
color=red
54 [label="Enter function test_0" style="filled" fillcolor=red];
subgraph cluster_17 {
color=blue
55 [label="Enter block"];
56 [label="Const: Null(null)"];
57 [label="Variable declaration: lvar s: R|A?|"];
subgraph cluster_18 {
color=blue
58 [label="Enter block"];
subgraph cluster_19 {
color=blue
59 [label="Function call arguments enter"];
60 [label="Access variable R|<local>/results|"];
61 [label="Function call arguments exit"];
}
62 [label="Function call: R|<local>/results|.R|SubstitutionOverride<kotlin/collections/List.iterator: R|kotlin/collections/Iterator<kotlin/Nothing>|>|()" style="filled" fillcolor=yellow];
63 [label="Variable declaration: lval <iterator>: R|kotlin/collections/Iterator<kotlin/Nothing>|"];
subgraph cluster_20 {
color=blue
64 [label="Enter while loop"];
subgraph cluster_21 {
color=blue
65 [label="Enter loop condition"];
subgraph cluster_22 {
color=blue
66 [label="Function call arguments enter"];
67 [label="Access variable R|<local>/<iterator>|"];
68 [label="Function call arguments exit"];
}
69 [label="Function call: R|<local>/<iterator>|.R|SubstitutionOverride<kotlin/collections/Iterator.hasNext: R|kotlin/Boolean|>|()" style="filled" fillcolor=yellow];
70 [label="Exit loop condition"];
}
subgraph cluster_23 {
color=blue
71 [label="Enter loop block"];
subgraph cluster_24 {
color=blue
72 [label="Enter block"];
subgraph cluster_25 {
color=blue
73 [label="Function call arguments enter"];
74 [label="Access variable R|<local>/<iterator>|"];
75 [label="Function call arguments exit"];
}
76 [label="Function call: R|<local>/<iterator>|.R|SubstitutionOverride<kotlin/collections/Iterator.next: R|kotlin/Nothing|>|()" style="filled" fillcolor=yellow];
77 [label="Stub" style="filled" fillcolor=gray];
78 [label="Variable declaration: lval result: R|kotlin/Nothing|" style="filled" fillcolor=gray];
subgraph cluster_26 {
color=blue
79 [label="Enter block" style="filled" fillcolor=gray];
80 [label="Access variable R|<local>/result|" style="filled" fillcolor=gray];
81 [label="Stub" style="filled" fillcolor=gray];
82 [label="Assignment: R|<local>/s|" style="filled" fillcolor=gray];
subgraph cluster_27 {
color=blue
83 [label="Enter when" style="filled" fillcolor=gray];
subgraph cluster_28 {
color=blue
84 [label="Enter when branch condition " style="filled" fillcolor=gray];
85 [label="Access variable R|<local>/result|" style="filled" fillcolor=gray];
86 [label="Stub" style="filled" fillcolor=gray];
87 [label="Access variable <Unresolved name: b>#" style="filled" fillcolor=gray];
88 [label="Exit when branch condition" style="filled" fillcolor=gray];
}
89 [label="Synthetic else branch" style="filled" fillcolor=gray];
90 [label="Enter when branch result" style="filled" fillcolor=gray];
subgraph cluster_29 {
color=blue
91 [label="Enter block" style="filled" fillcolor=gray];
92 [label="Jump: break@@@[R|<local>/<iterator>|.R|SubstitutionOverride<kotlin/collections/Iterator.hasNext: R|kotlin/Boolean|>|()] " style="filled" fillcolor=gray];
93 [label="Stub" style="filled" fillcolor=gray];
94 [label="Exit block" style="filled" fillcolor=gray];
}
95 [label="Exit when branch result" style="filled" fillcolor=gray];
96 [label="Exit when" style="filled" fillcolor=gray];
}
97 [label="Exit block" style="filled" fillcolor=gray];
}
98 [label="Exit block" style="filled" fillcolor=gray];
}
99 [label="Exit loop block" style="filled" fillcolor=gray];
}
100 [label="Exit while loop"];
}
101 [label="Exit block"];
}
102 [label="Access variable R|<local>/s|"];
103 [label="Enter safe call"];
subgraph cluster_30 {
color=blue
104 [label="Function call arguments enter"];
105 [label="Postponed enter to lambda"];
subgraph cluster_31 {
color=blue
106 [label="Enter function <anonymous>" style="filled" fillcolor=red];
subgraph cluster_32 {
color=blue
107 [label="Enter block"];
108 [label="Access variable R|<local>/it|"];
109 [label="Access variable R|/A.a|"];
110 [label="Exit block"];
}
111 [label="Exit function <anonymous>" style="filled" fillcolor=red];
}
112 [label="Function call arguments exit"];
}
113 [label="Postponed exit from lambda"];
114 [label="Function call: $subj$.R|kotlin/let|<R|A|, R|kotlin/Int|>(...)" style="filled" fillcolor=yellow];
115 [label="Exit safe call"];
116 [label="Exit block"];
}
117 [label="Exit function test_0" style="filled" fillcolor=red];
}
54 -> {55};
55 -> {56};
56 -> {57};
57 -> {58};
58 -> {59};
59 -> {60};
60 -> {61};
61 -> {62};
62 -> {63};
63 -> {64};
64 -> {65};
65 -> {66};
66 -> {67};
67 -> {68};
68 -> {69};
69 -> {70};
70 -> {71 100};
71 -> {72};
72 -> {73};
73 -> {74};
74 -> {75};
75 -> {76};
76 -> {77} [style=dotted];
77 -> {78} [style=dotted];
78 -> {79} [style=dotted];
79 -> {80} [style=dotted];
80 -> {81} [style=dotted];
81 -> {82} [style=dotted];
82 -> {83} [style=dotted];
83 -> {84} [style=dotted];
84 -> {85} [style=dotted];
85 -> {86} [style=dotted];
86 -> {87} [style=dotted];
87 -> {88} [style=dotted];
88 -> {89 90} [style=dotted];
89 -> {96} [style=dotted];
90 -> {91} [style=dotted];
91 -> {92} [style=dotted];
92 -> {93 100} [style=dotted];
93 -> {94} [style=dotted];
94 -> {95} [style=dotted];
95 -> {96} [style=dotted];
96 -> {97} [style=dotted];
97 -> {98} [style=dotted];
98 -> {99} [style=dotted];
99 -> {65} [color=green style=dotted];
100 -> {101};
101 -> {102};
102 -> {103 115};
103 -> {104};
104 -> {105};
105 -> {106 112};
105 -> {113} [style=dotted];
105 -> {106} [style=dashed];
106 -> {107};
107 -> {108};
108 -> {109};
109 -> {110};
110 -> {111};
111 -> {113};
112 -> {114};
113 -> {114} [label="Postponed"];
114 -> {115};
115 -> {116};
116 -> {117};
subgraph cluster_33 {
color=red
118 [label="Enter function test_1" style="filled" fillcolor=red];
subgraph cluster_34 {
color=blue
119 [label="Enter block"];
subgraph cluster_35 {
color=blue
120 [label="Enter when"];
subgraph cluster_36 {
color=blue
121 [label="Enter when branch condition "];
122 [label="Access variable R|<local>/a|"];
123 [label="Type operator: (R|<local>/a| is R|kotlin/Nothing?|)"];
124 [label="Exit when branch condition"];
}
125 [label="Synthetic else branch"];
126 [label="Enter when branch result"];
subgraph cluster_37 {
color=blue
127 [label="Enter block"];
128 [label="Access variable R|<local>/a|"];
129 [label="Smart cast: R|<local>/a|"];
130 [label="Enter safe call"];
131 [label="Access variable R|kotlin/String.length|"];
132 [label="Exit safe call"];
133 [label="Variable declaration: lval b: R|kotlin/Int?|"];
134 [label="Exit block"];
}
135 [label="Exit when branch result"];
136 [label="Exit when"];
}
subgraph cluster_38 {
color=blue
137 [label="Enter when"];
subgraph cluster_39 {
color=blue
138 [label="Enter when branch condition "];
139 [label="Access variable R|<local>/a|"];
140 [label="Type operator: (R|<local>/a| is R|kotlin/Nothing|)"];
141 [label="Exit when branch condition"];
}
142 [label="Synthetic else branch"];
143 [label="Enter when branch result"];
subgraph cluster_40 {
color=blue
144 [label="Enter block"];
145 [label="Access variable R|<local>/a|"];
146 [label="Smart cast: R|<local>/a|"];
147 [label="Access variable R|kotlin/String.length|"];
148 [label="Variable declaration: lval b: R|kotlin/Int|"];
149 [label="Exit block"];
}
150 [label="Exit when branch result"];
151 [label="Exit when"];
}
152 [label="Exit block"];
}
153 [label="Exit function test_1" style="filled" fillcolor=red];
}
118 -> {119};
119 -> {120};
120 -> {121};
121 -> {122};
122 -> {123};
123 -> {124};
124 -> {125 126};
125 -> {136};
126 -> {127};
127 -> {128};
128 -> {129};
129 -> {130 132};
130 -> {131};
131 -> {132};
132 -> {133};
133 -> {134};
134 -> {135};
135 -> {136};
136 -> {137};
137 -> {138};
138 -> {139};
139 -> {140};
140 -> {141};
141 -> {142 143};
142 -> {151};
143 -> {144};
144 -> {145};
145 -> {146};
146 -> {147};
147 -> {148};
148 -> {149};
149 -> {150};
150 -> {151};
151 -> {152};
152 -> {153};
}