[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
This commit is contained in:
Vendored
+6
-6
@@ -423,15 +423,15 @@ digraph boundSmartcasts_kt {
|
||||
149 [label="Enter class D" style="filled" fillcolor=red];
|
||||
subgraph cluster_40 {
|
||||
color=blue
|
||||
150 [label="Enter property" style="filled" fillcolor=red];
|
||||
151 [label="Access variable R|<local>/any|"];
|
||||
152 [label="Exit property" style="filled" fillcolor=red];
|
||||
150 [label="Enter function <init>" style="filled" fillcolor=red];
|
||||
151 [label="Delegated constructor call: super<R|kotlin/Any|>()" style="filled" fillcolor=yellow];
|
||||
152 [label="Exit function <init>" style="filled" fillcolor=red];
|
||||
}
|
||||
subgraph cluster_41 {
|
||||
color=blue
|
||||
153 [label="Enter function <init>" style="filled" fillcolor=red];
|
||||
154 [label="Delegated constructor call: super<R|kotlin/Any|>()" style="filled" fillcolor=yellow];
|
||||
155 [label="Exit function <init>" style="filled" fillcolor=red];
|
||||
153 [label="Enter property" style="filled" fillcolor=red];
|
||||
154 [label="Access variable R|<local>/any|"];
|
||||
155 [label="Exit property" style="filled" fillcolor=red];
|
||||
}
|
||||
156 [label="Exit class D" style="filled" fillcolor=red];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user