[FIR] Fix node ordering for delegating constructor graph
Inject delegated constructor and other in-place initializer sub-graphs after the delegated constructor call node. This ensures property initialization and use is calculated correctly when there are complex calculations for the arguments to the delegated constructor. #KT-59708 Fixed #KT-59832 Fixed
This commit is contained in:
+176
@@ -0,0 +1,176 @@
|
||||
digraph delegatedConstructorArguments_kt {
|
||||
graph [nodesep=3]
|
||||
node [shape=box penwidth=2]
|
||||
edge [penwidth=2]
|
||||
|
||||
subgraph cluster_0 {
|
||||
color=red
|
||||
0 [label="Enter class Test" style="filled" fillcolor=red];
|
||||
subgraph cluster_1 {
|
||||
color=blue
|
||||
1 [label="Enter function <init>" style="filled" fillcolor=red];
|
||||
2 [label="Access variable R|<local>/set|"];
|
||||
3 [label="Postponed enter to lambda"];
|
||||
subgraph cluster_2 {
|
||||
color=blue
|
||||
4 [label="Enter function <anonymous>" style="filled" fillcolor=red];
|
||||
subgraph cluster_3 {
|
||||
color=blue
|
||||
5 [label="Enter block"];
|
||||
6 [label="Access variable R|<local>/it|"];
|
||||
7 [label="Exit block"];
|
||||
}
|
||||
8 [label="Exit function <anonymous>" style="filled" fillcolor=red];
|
||||
}
|
||||
9 [label="Postponed exit from lambda"];
|
||||
10 [label="Function call: R|<local>/set|.R|kotlin/collections/map|<R|kotlin/String|, R|kotlin/String|>(...)" style="filled" fillcolor=yellow];
|
||||
11 [label="Delegated constructor call: this<R|Test|>(...)" style="filled" fillcolor=yellow];
|
||||
subgraph cluster_4 {
|
||||
color=blue
|
||||
12 [label="Enter function <init>" style="filled" fillcolor=red];
|
||||
13 [label="Access variable R|<local>/map|"];
|
||||
14 [label="Access variable R|SubstitutionOverride<kotlin/collections/Map.values: R|kotlin/collections/Collection<kotlin/String>|>|"];
|
||||
15 [label="Postponed enter to lambda"];
|
||||
subgraph cluster_5 {
|
||||
color=blue
|
||||
16 [label="Enter function <anonymous>" style="filled" fillcolor=red];
|
||||
subgraph cluster_6 {
|
||||
color=blue
|
||||
17 [label="Enter block"];
|
||||
18 [label="Access variable R|<local>/it|"];
|
||||
19 [label="Exit block"];
|
||||
}
|
||||
20 [label="Exit function <anonymous>" style="filled" fillcolor=red];
|
||||
}
|
||||
21 [label="Postponed exit from lambda"];
|
||||
22 [label="Function call: R|<local>/map|.R|SubstitutionOverride<kotlin/collections/Map.values: R|kotlin/collections/Collection<kotlin/String>|>|.R|kotlin/collections/map|<R|kotlin/String|, R|kotlin/String|>(...)" style="filled" fillcolor=yellow];
|
||||
23 [label="Delegated constructor call: this<R|Test|>(...)" style="filled" fillcolor=yellow];
|
||||
subgraph cluster_7 {
|
||||
color=blue
|
||||
24 [label="Enter init block" style="filled" fillcolor=red];
|
||||
subgraph cluster_8 {
|
||||
color=blue
|
||||
25 [label="Enter block"];
|
||||
26 [label="Access variable this@R|/Test|"];
|
||||
27 [label="Const: Int(0)"];
|
||||
28 [label="Assignment: R|/Test.size|"];
|
||||
29 [label="Exit block"];
|
||||
}
|
||||
30 [label="Exit init block" style="filled" fillcolor=red];
|
||||
}
|
||||
subgraph cluster_9 {
|
||||
color=blue
|
||||
31 [label="Enter function <init>" style="filled" fillcolor=red];
|
||||
32 [label="Delegated constructor call: super<R|kotlin/Any|>()" style="filled" fillcolor=yellow];
|
||||
subgraph cluster_10 {
|
||||
color=blue
|
||||
33 [label="Enter block"];
|
||||
34 [label="Access variable this@R|/Test|"];
|
||||
35 [label="Access variable R|<local>/list|"];
|
||||
36 [label="Assignment: R|/Test.values|"];
|
||||
37 [label="Exit block"];
|
||||
}
|
||||
38 [label="Exit function <init>" style="filled" fillcolor=red];
|
||||
}
|
||||
subgraph cluster_11 {
|
||||
color=blue
|
||||
39 [label="Enter block"];
|
||||
40 [label="Access variable this@R|/Test|"];
|
||||
41 [label="Access variable R|/Test.size|"];
|
||||
42 [label="Access variable this@R|/Test|"];
|
||||
43 [label="Access variable R|/Test.values|"];
|
||||
44 [label="Access variable R|SubstitutionOverride<kotlin/collections/List.size: R|kotlin/Int|>|"];
|
||||
45 [label="Function call: this@R|/Test|.R|/Test.size|.R|kotlin/Int.plus|(...)" style="filled" fillcolor=yellow];
|
||||
46 [label="Assignment: R|/Test.size|"];
|
||||
47 [label="Exit block"];
|
||||
}
|
||||
48 [label="Exit function <init>" style="filled" fillcolor=red];
|
||||
}
|
||||
subgraph cluster_12 {
|
||||
color=blue
|
||||
49 [label="Enter block"];
|
||||
50 [label="Access variable this@R|/Test|"];
|
||||
51 [label="Access variable R|/Test.size|"];
|
||||
52 [label="Access variable this@R|/Test|"];
|
||||
53 [label="Access variable R|/Test.values|"];
|
||||
54 [label="Access variable R|SubstitutionOverride<kotlin/collections/List.size: R|kotlin/Int|>|"];
|
||||
55 [label="Function call: this@R|/Test|.R|/Test.size|.R|kotlin/Int.plus|(...)" style="filled" fillcolor=yellow];
|
||||
56 [label="Assignment: R|/Test.size|"];
|
||||
57 [label="Exit block"];
|
||||
}
|
||||
58 [label="Exit function <init>" style="filled" fillcolor=red];
|
||||
}
|
||||
59 [label="Exit class Test" style="filled" fillcolor=red];
|
||||
}
|
||||
0 -> {1 12 24} [color=green];
|
||||
0 -> {59} [style=dotted];
|
||||
0 -> {1 12 24 31} [style=dashed];
|
||||
1 -> {2};
|
||||
2 -> {3};
|
||||
3 -> {4 9 10};
|
||||
3 -> {4} [style=dashed];
|
||||
4 -> {5};
|
||||
5 -> {6};
|
||||
6 -> {7};
|
||||
7 -> {8};
|
||||
8 -> {9};
|
||||
9 -> {3} [color=green style=dashed];
|
||||
9 -> {10} [color=green];
|
||||
9 -> {11} [color=red];
|
||||
10 -> {11};
|
||||
11 -> {24} [color=green label="return@/Test.Test"];
|
||||
11 -> {39} [color=red];
|
||||
12 -> {13};
|
||||
13 -> {14};
|
||||
14 -> {15};
|
||||
15 -> {16 21 22};
|
||||
15 -> {16} [style=dashed];
|
||||
16 -> {17};
|
||||
17 -> {18};
|
||||
18 -> {19};
|
||||
19 -> {20};
|
||||
20 -> {21};
|
||||
21 -> {15} [color=green style=dashed];
|
||||
21 -> {22} [color=green];
|
||||
21 -> {23} [color=red];
|
||||
22 -> {23};
|
||||
23 -> {24} [color=green label="return@/Test.Test"];
|
||||
23 -> {49} [color=red];
|
||||
24 -> {25};
|
||||
25 -> {26};
|
||||
26 -> {27};
|
||||
27 -> {28};
|
||||
28 -> {29};
|
||||
29 -> {30};
|
||||
30 -> {31} [color=green];
|
||||
31 -> {32};
|
||||
32 -> {33};
|
||||
33 -> {34};
|
||||
34 -> {35};
|
||||
35 -> {36};
|
||||
36 -> {37};
|
||||
37 -> {38};
|
||||
38 -> {39 49} [color=green label="return@/Test.Test"];
|
||||
38 -> {59} [color=green];
|
||||
39 -> {40};
|
||||
40 -> {41};
|
||||
41 -> {42};
|
||||
42 -> {43};
|
||||
43 -> {44};
|
||||
44 -> {45};
|
||||
45 -> {46};
|
||||
46 -> {47};
|
||||
47 -> {48};
|
||||
48 -> {59} [color=green];
|
||||
49 -> {50};
|
||||
50 -> {51};
|
||||
51 -> {52};
|
||||
52 -> {53};
|
||||
53 -> {54};
|
||||
54 -> {55};
|
||||
55 -> {56};
|
||||
56 -> {57};
|
||||
57 -> {58};
|
||||
58 -> {59} [color=green];
|
||||
|
||||
}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
// FIR_IDENTICAL
|
||||
// WITH_STDLIB
|
||||
// DUMP_CFG
|
||||
// ISSUE: KT-53898
|
||||
|
||||
class Test {
|
||||
private var size: Int
|
||||
private val values: List<String>
|
||||
|
||||
init {
|
||||
this.size = 0
|
||||
}
|
||||
|
||||
constructor(map: Map<String, String>) : this(map.values.map { it }) {
|
||||
this.size += this.values.size
|
||||
}
|
||||
|
||||
constructor(set: Set<String>) : this(set.map { it }) {
|
||||
this.size += this.values.size
|
||||
}
|
||||
|
||||
private constructor(list: List<String>) {
|
||||
this.values = list
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user