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

179 lines
5.8 KiB
Plaintext
Vendored

digraph functionCallBound_kt {
graph [nodesep=3]
node [shape=box penwidth=2]
edge [penwidth=2]
subgraph cluster_0 {
color=red
0 [label="Enter file functionCallBound.kt" style="filled" fillcolor=red];
1 [label="Exit file functionCallBound.kt" style="filled" fillcolor=red];
}
0 -> {1} [color=green];
subgraph cluster_1 {
color=red
2 [label="Enter class Base" style="filled" fillcolor=red];
subgraph cluster_2 {
color=blue
3 [label="Enter function <init>" style="filled" fillcolor=red];
4 [label="Delegated constructor call: super<R|kotlin/Any|>()" style="filled" fillcolor=yellow];
5 [label="Exit function <init>" style="filled" fillcolor=red];
}
6 [label="Exit class Base" style="filled" fillcolor=red];
}
2 -> {3} [color=green];
2 -> {6} [style=dotted];
2 -> {3} [style=dashed];
3 -> {4};
4 -> {5};
5 -> {6} [color=green];
subgraph cluster_3 {
color=red
7 [label="Enter class Sub" style="filled" fillcolor=red];
subgraph cluster_4 {
color=blue
8 [label="Enter function <init>" style="filled" fillcolor=red];
9 [label="Delegated constructor call: super<R|Base|>()" style="filled" fillcolor=yellow];
10 [label="Exit function <init>" style="filled" fillcolor=red];
}
subgraph cluster_5 {
color=blue
11 [label="Enter property" style="filled" fillcolor=red];
12 [label="Access variable R|<local>/data|"];
13 [label="Exit property" style="filled" fillcolor=red];
}
14 [label="Exit class Sub" style="filled" fillcolor=red];
}
7 -> {8} [color=green];
7 -> {14} [style=dotted];
7 -> {8 11} [style=dashed];
8 -> {9};
9 -> {10};
10 -> {11} [color=green];
11 -> {12};
12 -> {13};
13 -> {14} [color=green];
subgraph cluster_6 {
color=red
15 [label="Enter function isOk" style="filled" fillcolor=red];
subgraph cluster_7 {
color=blue
16 [label="Enter block"];
17 [label="Const: Boolean(true)"];
18 [label="Jump: ^isOk Boolean(true)"];
19 [label="Stub" style="filled" fillcolor=gray];
20 [label="Exit block" style="filled" fillcolor=gray];
}
21 [label="Exit function isOk" style="filled" fillcolor=red];
}
15 -> {16};
16 -> {17};
17 -> {18};
18 -> {21};
18 -> {19} [style=dotted];
19 -> {20} [style=dotted];
20 -> {21} [style=dotted];
subgraph cluster_8 {
color=red
22 [label="Enter function check" style="filled" fillcolor=red];
subgraph cluster_9 {
color=blue
23 [label="Enter block"];
subgraph cluster_10 {
color=blue
24 [label="Enter when"];
subgraph cluster_11 {
color=blue
25 [label="Enter when branch condition "];
26 [label="Access variable R|<local>/base|"];
27 [label="Type operator: (R|<local>/base| as? R|Sub|)"];
28 [label="Enter safe call"];
subgraph cluster_12 {
color=blue
29 [label="Function call arguments enter"];
30 [label="Function call arguments exit"];
}
31 [label="Function call: $subj$.R|/isOk|()" style="filled" fillcolor=yellow];
32 [label="Exit safe call"];
33 [label="Const: Boolean(true)"];
34 [label="Equality operator =="];
35 [label="Exit when branch condition"];
}
subgraph cluster_13 {
color=blue
36 [label="Enter when branch condition else"];
37 [label="Exit when branch condition"];
}
38 [label="Enter when branch result"];
subgraph cluster_14 {
color=blue
39 [label="Enter block"];
40 [label="Access variable R|<local>/base|"];
41 [label="Exit block"];
}
42 [label="Exit when branch result"];
43 [label="Enter when branch result"];
subgraph cluster_15 {
color=blue
44 [label="Enter block"];
45 [label="Access variable R|<local>/base|"];
46 [label="Smart cast: R|<local>/base|"];
47 [label="Access variable R|/Sub.data|"];
48 [label="Exit block"];
}
49 [label="Exit when branch result"];
50 [label="Exit when"];
}
51 [label="Jump: ^check when () {
==((R|<local>/base| as? R|Sub|)?.{ $subj$.R|/isOk|() }, Boolean(true)) -> {
R|<local>/base|.R|/Sub.data|
}
else -> {
R|<local>/base|
}
}
"];
52 [label="Stub" style="filled" fillcolor=gray];
53 [label="Exit block" style="filled" fillcolor=gray];
}
54 [label="Exit function check" style="filled" fillcolor=red];
}
22 -> {23};
23 -> {24};
24 -> {25};
25 -> {26};
26 -> {27};
27 -> {28 32};
28 -> {29};
29 -> {30};
30 -> {31};
31 -> {32};
32 -> {33};
33 -> {34};
34 -> {35};
35 -> {36 43};
36 -> {37};
37 -> {38};
38 -> {39};
39 -> {40};
40 -> {41};
41 -> {42};
42 -> {50};
43 -> {44};
44 -> {45};
45 -> {46};
46 -> {47};
47 -> {48};
48 -> {49};
49 -> {50};
50 -> {51};
51 -> {54};
51 -> {52} [style=dotted];
52 -> {53} [style=dotted];
53 -> {54} [style=dotted];
}