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

120 lines
4.0 KiB
Plaintext
Vendored

digraph smartCastInInit_kt {
graph [nodesep=3]
node [shape=box penwidth=2]
edge [penwidth=2]
subgraph cluster_0 {
color=red
0 [label="Enter file smartCastInInit.kt" style="filled" fillcolor=red];
1 [label="Exit file smartCastInInit.kt" style="filled" fillcolor=red];
}
0 -> {1} [color=green];
subgraph cluster_1 {
color=red
2 [label="Enter class I" style="filled" fillcolor=red];
3 [label="Exit class I" style="filled" fillcolor=red];
}
2 -> {3} [color=green];
subgraph cluster_2 {
color=red
4 [label="Enter class S" style="filled" fillcolor=red];
5 [label="Exit class S" style="filled" fillcolor=red];
}
4 -> {5} [color=green];
subgraph cluster_3 {
color=red
6 [label="Enter function foo" style="filled" fillcolor=red];
7 [label="Exit function foo" style="filled" fillcolor=red];
}
6 -> {7};
subgraph cluster_4 {
color=red
8 [label="Enter function s" style="filled" fillcolor=red];
subgraph cluster_5 {
color=blue
9 [label="Enter block"];
subgraph cluster_6 {
color=blue
10 [label="Function call arguments enter"];
11 [label="Function call arguments exit"];
}
12 [label="Function call: R|kotlin/TODO|()" style="filled" fillcolor=yellow];
13 [label="Stub" style="filled" fillcolor=gray];
14 [label="Jump: ^s R|kotlin/TODO|()" style="filled" fillcolor=gray];
15 [label="Stub" style="filled" fillcolor=gray];
16 [label="Exit block" style="filled" fillcolor=gray];
}
17 [label="Exit function s" style="filled" fillcolor=gray];
}
8 -> {9};
9 -> {10};
10 -> {11};
11 -> {12};
12 -> {13} [style=dotted];
13 -> {14} [style=dotted];
14 -> {15 17} [style=dotted];
15 -> {16} [style=dotted];
16 -> {17} [style=dotted];
subgraph cluster_7 {
color=red
18 [label="Enter class Main" style="filled" fillcolor=red];
subgraph cluster_8 {
color=blue
19 [label="Enter function <init>" style="filled" fillcolor=red];
20 [label="Delegated constructor call: super<R|kotlin/Any|>()" style="filled" fillcolor=yellow];
21 [label="Exit function <init>" style="filled" fillcolor=red];
}
subgraph cluster_9 {
color=blue
22 [label="Enter init block" style="filled" fillcolor=red];
subgraph cluster_10 {
color=blue
23 [label="Enter block"];
subgraph cluster_11 {
color=blue
24 [label="Function call arguments enter"];
25 [label="Function call arguments exit"];
}
26 [label="Function call: R|/s|()" style="filled" fillcolor=yellow];
27 [label="Assignment: R|/Main.x|"];
subgraph cluster_12 {
color=blue
28 [label="Function call arguments enter"];
29 [label="Access variable R|/Main.x|"];
30 [label="Smart cast: this@R|/Main|.R|/Main.x|"];
31 [label="Function call arguments exit"];
}
32 [label="Function call: this@R|/Main|.R|/Main.x|.R|/S.foo|()" style="filled" fillcolor=yellow];
33 [label="Exit block"];
}
34 [label="Exit init block" style="filled" fillcolor=red];
}
35 [label="Exit class Main" style="filled" fillcolor=red];
}
18 -> {19} [color=green];
18 -> {35} [style=dotted];
18 -> {19 22} [style=dashed];
19 -> {20};
20 -> {21};
21 -> {22} [color=green];
22 -> {23};
23 -> {24};
24 -> {25};
25 -> {26};
26 -> {27};
27 -> {28};
28 -> {29};
29 -> {30};
30 -> {31};
31 -> {32};
32 -> {33};
33 -> {34};
34 -> {35} [color=green];
}