[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:
Brian Norman
2024-01-18 20:17:17 -06:00
committed by Space Team
parent c628172235
commit 17a1871b83
28 changed files with 732 additions and 900 deletions
@@ -15,33 +15,33 @@ digraph initBlock_kt {
2 [label="Enter class Foo" style="filled" fillcolor=red]; 2 [label="Enter class Foo" style="filled" fillcolor=red];
subgraph cluster_2 { subgraph cluster_2 {
color=blue color=blue
3 [label="Enter init block" style="filled" fillcolor=red]; 3 [label="Enter function <init>" style="filled" fillcolor=red];
subgraph cluster_3 { 4 [label="Delegated constructor call: super<R|kotlin/Any|>()" style="filled" fillcolor=yellow];
color=blue 5 [label="Exit function <init>" style="filled" fillcolor=red];
4 [label="Enter block"];
5 [label="Const: Int(1)"];
6 [label="Variable declaration: lval x: R|kotlin/Int|"];
7 [label="Exit block"];
}
8 [label="Exit init block" style="filled" fillcolor=red];
} }
subgraph cluster_4 { subgraph cluster_3 {
color=blue color=blue
9 [label="Enter function <init>" style="filled" fillcolor=red]; 6 [label="Enter init block" style="filled" fillcolor=red];
10 [label="Delegated constructor call: super<R|kotlin/Any|>()" style="filled" fillcolor=yellow]; subgraph cluster_4 {
11 [label="Exit function <init>" style="filled" fillcolor=red]; color=blue
7 [label="Enter block"];
8 [label="Const: Int(1)"];
9 [label="Variable declaration: lval x: R|kotlin/Int|"];
10 [label="Exit block"];
}
11 [label="Exit init block" style="filled" fillcolor=red];
} }
12 [label="Exit class Foo" style="filled" fillcolor=red]; 12 [label="Exit class Foo" style="filled" fillcolor=red];
} }
2 -> {3} [color=green]; 2 -> {3} [color=green];
2 -> {12} [style=dotted]; 2 -> {12} [style=dotted];
2 -> {3 9} [style=dashed]; 2 -> {3 6} [style=dashed];
3 -> {4}; 3 -> {4};
4 -> {5}; 4 -> {5};
5 -> {6}; 5 -> {6} [color=green];
6 -> {7}; 6 -> {7};
7 -> {8}; 7 -> {8};
8 -> {9} [color=green]; 8 -> {9};
9 -> {10}; 9 -> {10};
10 -> {11}; 10 -> {11};
11 -> {12} [color=green]; 11 -> {12} [color=green];
@@ -51,47 +51,47 @@ digraph initBlock_kt {
13 [label="Enter class Bar" style="filled" fillcolor=red]; 13 [label="Enter class Bar" style="filled" fillcolor=red];
subgraph cluster_6 { subgraph cluster_6 {
color=blue color=blue
14 [label="Enter init block" style="filled" fillcolor=red]; 14 [label="Enter function <init>" style="filled" fillcolor=red];
subgraph cluster_7 { 15 [label="Delegated constructor call: super<R|kotlin/Any|>()" style="filled" fillcolor=yellow];
color=blue 16 [label="Exit function <init>" style="filled" fillcolor=red];
15 [label="Enter block"];
16 [label="Const: Int(1)"];
17 [label="Variable declaration: lval x: R|kotlin/Int|"];
subgraph cluster_8 {
color=blue
18 [label="Function call arguments enter"];
19 [label="Function call arguments exit"];
}
20 [label="Function call: R|java/lang/Exception.Exception|()" style="filled" fillcolor=yellow];
21 [label="Throw: throw R|java/lang/Exception.Exception|()"];
22 [label="Stub" style="filled" fillcolor=gray];
23 [label="Const: Int(2)" style="filled" fillcolor=gray];
24 [label="Variable declaration: lval y: R|kotlin/Int|" style="filled" fillcolor=gray];
25 [label="Exit block" style="filled" fillcolor=gray];
}
26 [label="Exit init block" style="filled" fillcolor=gray];
} }
subgraph cluster_9 { subgraph cluster_7 {
color=blue color=blue
27 [label="Enter function <init>" style="filled" fillcolor=gray]; 17 [label="Enter init block" style="filled" fillcolor=red];
28 [label="Delegated constructor call: super<R|kotlin/Any|>()" style="filled" fillcolor=gray]; subgraph cluster_8 {
29 [label="Exit function <init>" style="filled" fillcolor=gray]; color=blue
18 [label="Enter block"];
19 [label="Const: Int(1)"];
20 [label="Variable declaration: lval x: R|kotlin/Int|"];
subgraph cluster_9 {
color=blue
21 [label="Function call arguments enter"];
22 [label="Function call arguments exit"];
}
23 [label="Function call: R|java/lang/Exception.Exception|()" style="filled" fillcolor=yellow];
24 [label="Throw: throw R|java/lang/Exception.Exception|()"];
25 [label="Stub" style="filled" fillcolor=gray];
26 [label="Const: Int(2)" style="filled" fillcolor=gray];
27 [label="Variable declaration: lval y: R|kotlin/Int|" style="filled" fillcolor=gray];
28 [label="Exit block" style="filled" fillcolor=gray];
}
29 [label="Exit init block" style="filled" fillcolor=gray];
} }
30 [label="Exit class Bar" style="filled" fillcolor=gray]; 30 [label="Exit class Bar" style="filled" fillcolor=gray];
} }
13 -> {14} [color=green]; 13 -> {14} [color=green];
13 -> {30} [style=dotted]; 13 -> {30} [style=dotted];
13 -> {14 27} [style=dashed]; 13 -> {14 17} [style=dashed];
14 -> {15}; 14 -> {15};
15 -> {16}; 15 -> {16};
16 -> {17}; 16 -> {17} [color=green];
17 -> {18}; 17 -> {18};
18 -> {19}; 18 -> {19};
19 -> {20}; 19 -> {20};
20 -> {21}; 20 -> {21};
21 -> {22} [style=dotted]; 21 -> {22};
22 -> {23} [style=dotted]; 22 -> {23};
23 -> {24} [style=dotted]; 23 -> {24};
24 -> {25} [style=dotted]; 24 -> {25} [style=dotted];
25 -> {26} [style=dotted]; 25 -> {26} [style=dotted];
26 -> {27} [style=dotted]; 26 -> {27} [style=dotted];
@@ -29,81 +29,81 @@ digraph initBlockAndInPlaceLambda_kt {
6 [label="Enter class C" style="filled" fillcolor=red]; 6 [label="Enter class C" style="filled" fillcolor=red];
subgraph cluster_4 { subgraph cluster_4 {
color=blue color=blue
7 [label="Enter init block" style="filled" fillcolor=red]; 7 [label="Enter function <init>" style="filled" fillcolor=red];
subgraph cluster_5 { 8 [label="Delegated constructor call: super<R|kotlin/Any|>()" style="filled" fillcolor=yellow];
color=blue 9 [label="Exit function <init>" style="filled" fillcolor=red];
8 [label="Enter block"];
9 [label="Access variable R|<local>/a|"];
10 [label="Access variable R|/A.b|"];
11 [label="Enter safe call"];
subgraph cluster_6 {
color=blue
12 [label="Function call arguments enter"];
13 [label="Postponed enter to lambda"];
subgraph cluster_7 {
color=blue
14 [label="Enter function <anonymous>" style="filled" fillcolor=red];
subgraph cluster_8 {
color=blue
15 [label="Enter block"];
subgraph cluster_9 {
color=blue
16 [label="Function call arguments enter"];
17 [label="Access variable R|<local>/a|"];
18 [label="Access variable R|<local>/it|"];
19 [label="Function call arguments exit"];
}
20 [label="Function call: R|/C.C|(...)" style="filled" fillcolor=yellow];
21 [label="Exit block"];
}
22 [label="Exit function <anonymous>" style="filled" fillcolor=red];
}
23 [label="Function call arguments exit"];
}
24 [label="Postponed exit from lambda"];
25 [label="Function call: $subj$.R|kotlin/let|<R|B|, R|C|>(...)" style="filled" fillcolor=yellow];
26 [label="Exit safe call"];
27 [label="Variable declaration: lval c: R|C?|"];
28 [label="Exit block"];
}
29 [label="Exit init block" style="filled" fillcolor=red];
} }
subgraph cluster_10 { subgraph cluster_5 {
color=blue color=blue
30 [label="Enter function <init>" style="filled" fillcolor=red]; 10 [label="Enter init block" style="filled" fillcolor=red];
31 [label="Delegated constructor call: super<R|kotlin/Any|>()" style="filled" fillcolor=yellow]; subgraph cluster_6 {
32 [label="Exit function <init>" style="filled" fillcolor=red]; color=blue
11 [label="Enter block"];
12 [label="Access variable R|<local>/a|"];
13 [label="Access variable R|/A.b|"];
14 [label="Enter safe call"];
subgraph cluster_7 {
color=blue
15 [label="Function call arguments enter"];
16 [label="Postponed enter to lambda"];
subgraph cluster_8 {
color=blue
17 [label="Enter function <anonymous>" style="filled" fillcolor=red];
subgraph cluster_9 {
color=blue
18 [label="Enter block"];
subgraph cluster_10 {
color=blue
19 [label="Function call arguments enter"];
20 [label="Access variable R|<local>/a|"];
21 [label="Access variable R|<local>/it|"];
22 [label="Function call arguments exit"];
}
23 [label="Function call: R|/C.C|(...)" style="filled" fillcolor=yellow];
24 [label="Exit block"];
}
25 [label="Exit function <anonymous>" style="filled" fillcolor=red];
}
26 [label="Function call arguments exit"];
}
27 [label="Postponed exit from lambda"];
28 [label="Function call: $subj$.R|kotlin/let|<R|B|, R|C|>(...)" style="filled" fillcolor=yellow];
29 [label="Exit safe call"];
30 [label="Variable declaration: lval c: R|C?|"];
31 [label="Exit block"];
}
32 [label="Exit init block" style="filled" fillcolor=red];
} }
33 [label="Exit class C" style="filled" fillcolor=red]; 33 [label="Exit class C" style="filled" fillcolor=red];
} }
6 -> {7} [color=green]; 6 -> {7} [color=green];
6 -> {33} [style=dotted]; 6 -> {33} [style=dotted];
6 -> {7 30} [style=dashed]; 6 -> {7 10} [style=dashed];
7 -> {8}; 7 -> {8};
8 -> {9}; 8 -> {9};
9 -> {10}; 9 -> {10} [color=green];
10 -> {11 26}; 10 -> {11};
11 -> {12}; 11 -> {12};
12 -> {13}; 12 -> {13};
13 -> {14 23}; 13 -> {14 29};
13 -> {24} [style=dotted];
13 -> {14} [style=dashed];
14 -> {15}; 14 -> {15};
15 -> {16}; 15 -> {16};
16 -> {17}; 16 -> {17 26};
16 -> {27} [style=dotted];
16 -> {17} [style=dashed];
17 -> {18}; 17 -> {18};
18 -> {19}; 18 -> {19};
19 -> {20}; 19 -> {20};
20 -> {21}; 20 -> {21};
21 -> {22}; 21 -> {22};
22 -> {24}; 22 -> {23};
23 -> {25}; 23 -> {24};
24 -> {25} [label="Postponed"]; 24 -> {25};
25 -> {26}; 25 -> {27};
26 -> {27}; 26 -> {28};
27 -> {28}; 27 -> {28} [label="Postponed"];
28 -> {29}; 28 -> {29};
29 -> {30} [color=green]; 29 -> {30};
30 -> {31}; 30 -> {31};
31 -> {32}; 31 -> {32};
32 -> {33} [color=green]; 32 -> {33} [color=green];
@@ -15,21 +15,21 @@ digraph nestedClass_kt {
2 [label="Enter class OuterClass" style="filled" fillcolor=red]; 2 [label="Enter class OuterClass" style="filled" fillcolor=red];
subgraph cluster_2 { subgraph cluster_2 {
color=blue color=blue
3 [label="Enter property" style="filled" fillcolor=red]; 3 [label="Enter function <init>" style="filled" fillcolor=red];
4 [label="Const: Int(1)"]; 4 [label="Delegated constructor call: super<R|kotlin/Any|>()" style="filled" fillcolor=yellow];
5 [label="Exit property" style="filled" fillcolor=red]; 5 [label="Exit function <init>" style="filled" fillcolor=red];
} }
subgraph cluster_3 { subgraph cluster_3 {
color=blue color=blue
6 [label="Enter property" style="filled" fillcolor=red]; 6 [label="Enter property" style="filled" fillcolor=red];
7 [label="Access variable R|/OuterClass.outerProperty|"]; 7 [label="Const: Int(1)"];
8 [label="Exit property" style="filled" fillcolor=red]; 8 [label="Exit property" style="filled" fillcolor=red];
} }
subgraph cluster_4 { subgraph cluster_4 {
color=blue color=blue
9 [label="Enter function <init>" style="filled" fillcolor=red]; 9 [label="Enter property" style="filled" fillcolor=red];
10 [label="Delegated constructor call: super<R|kotlin/Any|>()" style="filled" fillcolor=yellow]; 10 [label="Access variable R|/OuterClass.outerProperty|"];
11 [label="Exit function <init>" style="filled" fillcolor=red]; 11 [label="Exit property" style="filled" fillcolor=red];
} }
12 [label="Exit class OuterClass" style="filled" fillcolor=red]; 12 [label="Exit class OuterClass" style="filled" fillcolor=red];
} }
@@ -65,21 +65,21 @@ digraph nestedClass_kt {
17 [label="Enter class NestedClass" style="filled" fillcolor=red]; 17 [label="Enter class NestedClass" style="filled" fillcolor=red];
subgraph cluster_8 { subgraph cluster_8 {
color=blue color=blue
18 [label="Enter property" style="filled" fillcolor=red]; 18 [label="Enter function <init>" style="filled" fillcolor=red];
19 [label="Const: Int(1)"]; 19 [label="Delegated constructor call: super<R|kotlin/Any|>()" style="filled" fillcolor=yellow];
20 [label="Exit property" style="filled" fillcolor=red]; 20 [label="Exit function <init>" style="filled" fillcolor=red];
} }
subgraph cluster_9 { subgraph cluster_9 {
color=blue color=blue
21 [label="Enter property" style="filled" fillcolor=red]; 21 [label="Enter property" style="filled" fillcolor=red];
22 [label="Access variable R|/OuterClass.NestedClass.nestedProperty|"]; 22 [label="Const: Int(1)"];
23 [label="Exit property" style="filled" fillcolor=red]; 23 [label="Exit property" style="filled" fillcolor=red];
} }
subgraph cluster_10 { subgraph cluster_10 {
color=blue color=blue
24 [label="Enter function <init>" style="filled" fillcolor=red]; 24 [label="Enter property" style="filled" fillcolor=red];
25 [label="Delegated constructor call: super<R|kotlin/Any|>()" style="filled" fillcolor=yellow]; 25 [label="Access variable R|/OuterClass.NestedClass.nestedProperty|"];
26 [label="Exit function <init>" style="filled" fillcolor=red]; 26 [label="Exit property" style="filled" fillcolor=red];
} }
27 [label="Exit class NestedClass" style="filled" fillcolor=red]; 27 [label="Exit class NestedClass" style="filled" fillcolor=red];
} }
@@ -33,74 +33,74 @@ digraph postponedLambdaInConstructor_kt {
7 [label="Enter class B" style="filled" fillcolor=red]; 7 [label="Enter class B" style="filled" fillcolor=red];
subgraph cluster_4 { subgraph cluster_4 {
color=blue color=blue
8 [label="Enter property" style="filled" fillcolor=red]; 8 [label="Enter function <init>" style="filled" fillcolor=red];
9 [label="Access variable R|<local>/s|"]; subgraph cluster_5 {
10 [label="Exit property" style="filled" fillcolor=red];
}
subgraph cluster_5 {
color=blue
11 [label="Enter function <init>" style="filled" fillcolor=red];
subgraph cluster_6 {
color=blue color=blue
12 [label="Function call arguments enter"]; 9 [label="Function call arguments enter"];
13 [label="Access variable R|<local>/s|"]; 10 [label="Access variable R|<local>/s|"];
14 [label="Postponed enter to lambda"]; 11 [label="Postponed enter to lambda"];
subgraph cluster_7 { subgraph cluster_6 {
color=blue color=blue
15 [label="Enter function <anonymous>" style="filled" fillcolor=red]; 12 [label="Enter function <anonymous>" style="filled" fillcolor=red];
subgraph cluster_8 { subgraph cluster_7 {
color=blue color=blue
16 [label="Enter block"]; 13 [label="Enter block"];
17 [label="Exit anonymous function expression"]; 14 [label="Exit anonymous function expression"];
subgraph cluster_9 { subgraph cluster_8 {
color=blue color=blue
18 [label="Enter function <anonymous>" style="filled" fillcolor=red]; 15 [label="Enter function <anonymous>" style="filled" fillcolor=red];
subgraph cluster_10 { subgraph cluster_9 {
color=blue color=blue
19 [label="Enter block"]; 16 [label="Enter block"];
20 [label="Access variable R|<local>/it|"]; 17 [label="Access variable R|<local>/it|"];
21 [label="Exit block"]; 18 [label="Exit block"];
} }
22 [label="Exit function <anonymous>" style="filled" fillcolor=red]; 19 [label="Exit function <anonymous>" style="filled" fillcolor=red];
} }
23 [label="Exit block"]; 20 [label="Exit block"];
} }
24 [label="Exit function <anonymous>" style="filled" fillcolor=red]; 21 [label="Exit function <anonymous>" style="filled" fillcolor=red];
} }
25 [label="Function call arguments exit"]; 22 [label="Function call arguments exit"];
} }
26 [label="Postponed exit from lambda"]; 23 [label="Postponed exit from lambda"];
27 [label="Function call: R|<local>/s|.R|kotlin/let|<R|kotlin/String|, R|() -> kotlin/String|>(...)" style="filled" fillcolor=yellow]; 24 [label="Function call: R|<local>/s|.R|kotlin/let|<R|kotlin/String|, R|() -> kotlin/String|>(...)" style="filled" fillcolor=yellow];
28 [label="Delegated constructor call: super<R|A|>(...)" style="filled" fillcolor=yellow]; 25 [label="Delegated constructor call: super<R|A|>(...)" style="filled" fillcolor=yellow];
29 [label="Exit function <init>" style="filled" fillcolor=red]; 26 [label="Exit function <init>" style="filled" fillcolor=red];
}
subgraph cluster_10 {
color=blue
27 [label="Enter property" style="filled" fillcolor=red];
28 [label="Access variable R|<local>/s|"];
29 [label="Exit property" style="filled" fillcolor=red];
} }
30 [label="Exit class B" style="filled" fillcolor=red]; 30 [label="Exit class B" style="filled" fillcolor=red];
} }
7 -> {8} [color=green]; 7 -> {8} [color=green];
7 -> {30} [style=dotted]; 7 -> {30} [style=dotted];
7 -> {8 11} [style=dashed]; 7 -> {8 27} [style=dashed];
8 -> {9}; 8 -> {9};
9 -> {10}; 9 -> {10};
10 -> {11} [color=green]; 10 -> {11};
11 -> {12}; 11 -> {12 22};
11 -> {23} [style=dotted];
11 -> {12} [style=dashed];
12 -> {13}; 12 -> {13};
13 -> {14}; 13 -> {14};
14 -> {15 25}; 14 -> {15 20};
14 -> {26} [style=dotted];
14 -> {15} [style=dashed]; 14 -> {15} [style=dashed];
15 -> {16}; 15 -> {16};
16 -> {17}; 16 -> {17};
17 -> {18 23}; 17 -> {18};
17 -> {18} [style=dashed];
18 -> {19}; 18 -> {19};
19 -> {20};
20 -> {21}; 20 -> {21};
21 -> {22}; 21 -> {23};
23 -> {24}; 22 -> {24};
24 -> {26}; 23 -> {24} [color=green];
25 -> {27}; 23 -> {25} [color=red label="Postponed"];
24 -> {25};
25 -> {26};
26 -> {27} [color=green]; 26 -> {27} [color=green];
26 -> {28} [color=red label="Postponed"];
27 -> {28}; 27 -> {28};
28 -> {29}; 28 -> {29};
29 -> {30} [color=green]; 29 -> {30} [color=green];
@@ -50,28 +50,28 @@ digraph propertiesAndInitBlocks_kt {
21 [label="Enter class InitializerLocalClass" style="filled" fillcolor=red]; 21 [label="Enter class InitializerLocalClass" style="filled" fillcolor=red];
subgraph cluster_9 { subgraph cluster_9 {
color=blue color=blue
22 [label="Enter init block" style="filled" fillcolor=red]; 22 [label="Enter function <init>" style="filled" fillcolor=red];
subgraph cluster_10 { 23 [label="Delegated constructor call: super<R|kotlin/Any|>()" style="filled" fillcolor=yellow];
color=blue 24 [label="Exit function <init>" style="filled" fillcolor=red];
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|java/lang/Exception.Exception|()" style="filled" fillcolor=yellow];
27 [label="Throw: throw R|java/lang/Exception.Exception|()"];
28 [label="Stub" style="filled" fillcolor=gray];
29 [label="Const: Int(1)" style="filled" fillcolor=gray];
30 [label="Exit block" style="filled" fillcolor=gray];
}
31 [label="Exit init block" style="filled" fillcolor=gray];
} }
subgraph cluster_12 { subgraph cluster_10 {
color=blue color=blue
32 [label="Enter function <init>" style="filled" fillcolor=gray]; 25 [label="Enter init block" style="filled" fillcolor=red];
33 [label="Delegated constructor call: super<R|kotlin/Any|>()" style="filled" fillcolor=gray]; subgraph cluster_11 {
34 [label="Exit function <init>" style="filled" fillcolor=gray]; color=blue
26 [label="Enter block"];
subgraph cluster_12 {
color=blue
27 [label="Function call arguments enter"];
28 [label="Function call arguments exit"];
}
29 [label="Function call: R|java/lang/Exception.Exception|()" style="filled" fillcolor=yellow];
30 [label="Throw: throw R|java/lang/Exception.Exception|()"];
31 [label="Stub" style="filled" fillcolor=gray];
32 [label="Const: Int(1)" style="filled" fillcolor=gray];
33 [label="Exit block" style="filled" fillcolor=gray];
}
34 [label="Exit init block" style="filled" fillcolor=gray];
} }
35 [label="Exit class InitializerLocalClass" style="filled" fillcolor=gray]; 35 [label="Exit class InitializerLocalClass" style="filled" fillcolor=gray];
} }
@@ -181,17 +181,17 @@ digraph propertiesAndInitBlocks_kt {
19 -> {20} [style=dotted]; 19 -> {20} [style=dotted];
20 -> {52} [style=dotted]; 20 -> {52} [style=dotted];
21 -> {22}; 21 -> {22};
21 -> {32} [color=red]; 21 -> {25} [color=red];
21 -> {35} [style=dotted]; 21 -> {35} [style=dotted];
21 -> {22 32} [style=dashed]; 21 -> {22 25} [style=dashed];
22 -> {23}; 22 -> {23};
23 -> {24}; 23 -> {24};
24 -> {25}; 24 -> {25} [color=green];
25 -> {26}; 25 -> {26};
26 -> {27}; 26 -> {27};
27 -> {28} [style=dotted]; 27 -> {28};
28 -> {29} [style=dotted]; 28 -> {29};
29 -> {30} [style=dotted]; 29 -> {30};
30 -> {31} [style=dotted]; 30 -> {31} [style=dotted];
31 -> {32} [style=dotted]; 31 -> {32} [style=dotted];
32 -> {33} [style=dotted]; 32 -> {33} [style=dotted];
@@ -317,27 +317,27 @@ digraph propertiesAndInitBlocks_kt {
101 [label="Enter class GetterLocalClass" style="filled" fillcolor=red]; 101 [label="Enter class GetterLocalClass" style="filled" fillcolor=red];
subgraph cluster_35 { subgraph cluster_35 {
color=blue color=blue
102 [label="Enter init block" style="filled" fillcolor=red]; 102 [label="Enter function <init>" style="filled" fillcolor=red];
subgraph cluster_36 { 103 [label="Delegated constructor call: super<R|kotlin/Any|>()" style="filled" fillcolor=yellow];
color=blue 104 [label="Exit function <init>" style="filled" fillcolor=red];
103 [label="Enter block"];
subgraph cluster_37 {
color=blue
104 [label="Function call arguments enter"];
105 [label="Function call arguments exit"];
}
106 [label="Function call: R|java/lang/Exception.Exception|()" style="filled" fillcolor=yellow];
107 [label="Throw: throw R|java/lang/Exception.Exception|()"];
108 [label="Stub" style="filled" fillcolor=gray];
109 [label="Exit block" style="filled" fillcolor=gray];
}
110 [label="Exit init block" style="filled" fillcolor=gray];
} }
subgraph cluster_38 { subgraph cluster_36 {
color=blue color=blue
111 [label="Enter function <init>" style="filled" fillcolor=gray]; 105 [label="Enter init block" style="filled" fillcolor=red];
112 [label="Delegated constructor call: super<R|kotlin/Any|>()" style="filled" fillcolor=gray]; subgraph cluster_37 {
113 [label="Exit function <init>" style="filled" fillcolor=gray]; color=blue
106 [label="Enter block"];
subgraph cluster_38 {
color=blue
107 [label="Function call arguments enter"];
108 [label="Function call arguments exit"];
}
109 [label="Function call: R|java/lang/Exception.Exception|()" style="filled" fillcolor=yellow];
110 [label="Throw: throw R|java/lang/Exception.Exception|()"];
111 [label="Stub" style="filled" fillcolor=gray];
112 [label="Exit block" style="filled" fillcolor=gray];
}
113 [label="Exit init block" style="filled" fillcolor=gray];
} }
114 [label="Exit class GetterLocalClass" style="filled" fillcolor=gray]; 114 [label="Exit class GetterLocalClass" style="filled" fillcolor=gray];
} }
@@ -347,17 +347,17 @@ digraph propertiesAndInitBlocks_kt {
98 -> {101} [style=dashed]; 98 -> {101} [style=dashed];
99 -> {100}; 99 -> {100};
101 -> {102}; 101 -> {102};
101 -> {111} [color=red]; 101 -> {105} [color=red];
101 -> {114} [style=dotted]; 101 -> {114} [style=dotted];
101 -> {102 111} [style=dashed]; 101 -> {102 105} [style=dashed];
102 -> {103}; 102 -> {103};
103 -> {104}; 103 -> {104};
104 -> {105}; 104 -> {105} [color=green];
105 -> {106}; 105 -> {106};
106 -> {107}; 106 -> {107};
107 -> {108} [style=dotted]; 107 -> {108};
108 -> {109} [style=dotted]; 108 -> {109};
109 -> {110} [style=dotted]; 109 -> {110};
110 -> {111} [style=dotted]; 110 -> {111} [style=dotted];
111 -> {112} [style=dotted]; 111 -> {112} [style=dotted];
112 -> {113} [style=dotted]; 112 -> {113} [style=dotted];
@@ -20,37 +20,37 @@ digraph secondaryConstructorCfg_kt {
5 [label="Delegated constructor call: this<R|B|>(...)" style="filled" fillcolor=yellow]; 5 [label="Delegated constructor call: this<R|B|>(...)" style="filled" fillcolor=yellow];
subgraph cluster_3 { subgraph cluster_3 {
color=blue color=blue
6 [label="Enter property" style="filled" fillcolor=red]; 6 [label="Enter function <init>" style="filled" fillcolor=red];
7 [label="Access variable R|<local>/p0|"]; 7 [label="Delegated constructor call: super<R|kotlin/Any|>()" style="filled" fillcolor=yellow];
8 [label="Exit property" style="filled" fillcolor=red]; 8 [label="Exit function <init>" style="filled" fillcolor=red];
} }
subgraph cluster_4 { subgraph cluster_4 {
color=blue color=blue
9 [label="Enter property" style="filled" fillcolor=red]; 9 [label="Enter property" style="filled" fillcolor=red];
10 [label="Access variable R|<local>/p0|"]; 10 [label="Access variable R|<local>/p0|"];
11 [label="Access variable R|kotlin/String.length|"]; 11 [label="Exit property" style="filled" fillcolor=red];
12 [label="Exit property" style="filled" fillcolor=red];
} }
subgraph cluster_5 { subgraph cluster_5 {
color=blue color=blue
13 [label="Enter init block" style="filled" fillcolor=red]; 12 [label="Enter property" style="filled" fillcolor=red];
subgraph cluster_6 { 13 [label="Access variable R|<local>/p0|"];
color=blue 14 [label="Access variable R|kotlin/String.length|"];
14 [label="Enter block"]; 15 [label="Exit property" style="filled" fillcolor=red];
15 [label="Access variable R|<local>/p0|"];
16 [label="Access variable R|kotlin/String.length|"];
17 [label="Assignment: R|/B.p1|"];
18 [label="Const: String()"];
19 [label="Assignment: R|/B.p3|"];
20 [label="Exit block"];
}
21 [label="Exit init block" style="filled" fillcolor=red];
} }
subgraph cluster_7 { subgraph cluster_6 {
color=blue color=blue
22 [label="Enter function <init>" style="filled" fillcolor=red]; 16 [label="Enter init block" style="filled" fillcolor=red];
23 [label="Delegated constructor call: super<R|kotlin/Any|>()" style="filled" fillcolor=yellow]; subgraph cluster_7 {
24 [label="Exit function <init>" style="filled" fillcolor=red]; color=blue
17 [label="Enter block"];
18 [label="Access variable R|<local>/p0|"];
19 [label="Access variable R|kotlin/String.length|"];
20 [label="Assignment: R|/B.p1|"];
21 [label="Const: String()"];
22 [label="Assignment: R|/B.p3|"];
23 [label="Exit block"];
}
24 [label="Exit init block" style="filled" fillcolor=red];
} }
subgraph cluster_8 { subgraph cluster_8 {
color=blue color=blue
@@ -65,7 +65,7 @@ digraph secondaryConstructorCfg_kt {
} }
2 -> {3 6} [color=green]; 2 -> {3 6} [color=green];
2 -> {30} [style=dotted]; 2 -> {30} [style=dotted];
2 -> {3 6 9 13 22} [style=dashed]; 2 -> {3 6 9 12 16} [style=dashed];
3 -> {4}; 3 -> {4};
4 -> {5}; 4 -> {5};
5 -> {6} [color=green label="return@/B.B"]; 5 -> {6} [color=green label="return@/B.B"];
@@ -75,17 +75,17 @@ digraph secondaryConstructorCfg_kt {
8 -> {9} [color=green]; 8 -> {9} [color=green];
9 -> {10}; 9 -> {10};
10 -> {11}; 10 -> {11};
11 -> {12}; 11 -> {12} [color=green];
12 -> {13} [color=green]; 12 -> {13};
13 -> {14}; 13 -> {14};
14 -> {15}; 14 -> {15};
15 -> {16}; 15 -> {16} [color=green];
16 -> {17}; 16 -> {17};
17 -> {18}; 17 -> {18};
18 -> {19}; 18 -> {19};
19 -> {20}; 19 -> {20};
20 -> {21}; 20 -> {21};
21 -> {22} [color=green]; 21 -> {22};
22 -> {23}; 22 -> {23};
23 -> {24}; 23 -> {24};
24 -> {25} [color=green label="return@/B.B"]; 24 -> {25} [color=green label="return@/B.B"];
@@ -423,15 +423,15 @@ digraph boundSmartcasts_kt {
149 [label="Enter class D" style="filled" fillcolor=red]; 149 [label="Enter class D" style="filled" fillcolor=red];
subgraph cluster_40 { subgraph cluster_40 {
color=blue color=blue
150 [label="Enter property" style="filled" fillcolor=red]; 150 [label="Enter function <init>" style="filled" fillcolor=red];
151 [label="Access variable R|<local>/any|"]; 151 [label="Delegated constructor call: super<R|kotlin/Any|>()" style="filled" fillcolor=yellow];
152 [label="Exit property" style="filled" fillcolor=red]; 152 [label="Exit function <init>" style="filled" fillcolor=red];
} }
subgraph cluster_41 { subgraph cluster_41 {
color=blue color=blue
153 [label="Enter function <init>" style="filled" fillcolor=red]; 153 [label="Enter property" style="filled" fillcolor=red];
154 [label="Delegated constructor call: super<R|kotlin/Any|>()" style="filled" fillcolor=yellow]; 154 [label="Access variable R|<local>/any|"];
155 [label="Exit function <init>" style="filled" fillcolor=red]; 155 [label="Exit property" style="filled" fillcolor=red];
} }
156 [label="Exit class D" style="filled" fillcolor=red]; 156 [label="Exit class D" style="filled" fillcolor=red];
} }
@@ -15,15 +15,15 @@ digraph boundSmartcastsInBranches_kt {
2 [label="Enter class A" style="filled" fillcolor=red]; 2 [label="Enter class A" style="filled" fillcolor=red];
subgraph cluster_2 { subgraph cluster_2 {
color=blue color=blue
3 [label="Enter property" style="filled" fillcolor=red]; 3 [label="Enter function <init>" style="filled" fillcolor=red];
4 [label="Const: String()"]; 4 [label="Delegated constructor call: super<R|kotlin/Any|>()" style="filled" fillcolor=yellow];
5 [label="Exit property" style="filled" fillcolor=red]; 5 [label="Exit function <init>" style="filled" fillcolor=red];
} }
subgraph cluster_3 { subgraph cluster_3 {
color=blue color=blue
6 [label="Enter function <init>" style="filled" fillcolor=red]; 6 [label="Enter property" style="filled" fillcolor=red];
7 [label="Delegated constructor call: super<R|kotlin/Any|>()" style="filled" fillcolor=yellow]; 7 [label="Const: String()"];
8 [label="Exit function <init>" style="filled" fillcolor=red]; 8 [label="Exit property" style="filled" fillcolor=red];
} }
9 [label="Exit class A" style="filled" fillcolor=red]; 9 [label="Exit class A" style="filled" fillcolor=red];
} }
@@ -33,15 +33,15 @@ digraph functionCallBound_kt {
7 [label="Enter class Sub" style="filled" fillcolor=red]; 7 [label="Enter class Sub" style="filled" fillcolor=red];
subgraph cluster_4 { subgraph cluster_4 {
color=blue color=blue
8 [label="Enter property" style="filled" fillcolor=red]; 8 [label="Enter function <init>" style="filled" fillcolor=red];
9 [label="Access variable R|<local>/data|"]; 9 [label="Delegated constructor call: super<R|Base|>()" style="filled" fillcolor=yellow];
10 [label="Exit property" style="filled" fillcolor=red]; 10 [label="Exit function <init>" style="filled" fillcolor=red];
} }
subgraph cluster_5 { subgraph cluster_5 {
color=blue color=blue
11 [label="Enter function <init>" style="filled" fillcolor=red]; 11 [label="Enter property" style="filled" fillcolor=red];
12 [label="Delegated constructor call: super<R|Base|>()" style="filled" fillcolor=yellow]; 12 [label="Access variable R|<local>/data|"];
13 [label="Exit function <init>" style="filled" fillcolor=red]; 13 [label="Exit property" style="filled" fillcolor=red];
} }
14 [label="Exit class Sub" style="filled" fillcolor=red]; 14 [label="Exit class Sub" style="filled" fillcolor=red];
} }
@@ -33,15 +33,15 @@ digraph lambdaInWhenBranch_kt {
7 [label="Enter class SubClass1" style="filled" fillcolor=red]; 7 [label="Enter class SubClass1" style="filled" fillcolor=red];
subgraph cluster_4 { subgraph cluster_4 {
color=blue color=blue
8 [label="Enter property" style="filled" fillcolor=red]; 8 [label="Enter function <init>" style="filled" fillcolor=red];
9 [label="Access variable R|<local>/t|"]; 9 [label="Delegated constructor call: super<R|Sealed|>()" style="filled" fillcolor=yellow];
10 [label="Exit property" style="filled" fillcolor=red]; 10 [label="Exit function <init>" style="filled" fillcolor=red];
} }
subgraph cluster_5 { subgraph cluster_5 {
color=blue color=blue
11 [label="Enter function <init>" style="filled" fillcolor=red]; 11 [label="Enter property" style="filled" fillcolor=red];
12 [label="Delegated constructor call: super<R|Sealed|>()" style="filled" fillcolor=yellow]; 12 [label="Access variable R|<local>/t|"];
13 [label="Exit function <init>" style="filled" fillcolor=red]; 13 [label="Exit property" style="filled" fillcolor=red];
} }
14 [label="Exit class SubClass1" style="filled" fillcolor=red]; 14 [label="Exit class SubClass1" style="filled" fillcolor=red];
} }
@@ -64,15 +64,15 @@ digraph nullability_kt {
16 [label="Enter class QImpl" style="filled" fillcolor=red]; 16 [label="Enter class QImpl" style="filled" fillcolor=red];
subgraph cluster_9 { subgraph cluster_9 {
color=blue color=blue
17 [label="Enter property" style="filled" fillcolor=red]; 17 [label="Enter function <init>" style="filled" fillcolor=red];
18 [label="Access variable R|<local>/data|"]; 18 [label="Delegated constructor call: super<R|kotlin/Any|>()" style="filled" fillcolor=yellow];
19 [label="Exit property" style="filled" fillcolor=red]; 19 [label="Exit function <init>" style="filled" fillcolor=red];
} }
subgraph cluster_10 { subgraph cluster_10 {
color=blue color=blue
20 [label="Enter function <init>" style="filled" fillcolor=red]; 20 [label="Enter property" style="filled" fillcolor=red];
21 [label="Delegated constructor call: super<R|kotlin/Any|>()" style="filled" fillcolor=yellow]; 21 [label="Access variable R|<local>/data|"];
22 [label="Exit function <init>" style="filled" fillcolor=red]; 22 [label="Exit property" style="filled" fillcolor=red];
} }
23 [label="Exit class QImpl" style="filled" fillcolor=red]; 23 [label="Exit class QImpl" style="filled" fillcolor=red];
} }
@@ -112,15 +112,15 @@ digraph nullability_kt {
31 [label="Enter class QImplMutable" style="filled" fillcolor=red]; 31 [label="Enter class QImplMutable" style="filled" fillcolor=red];
subgraph cluster_14 { subgraph cluster_14 {
color=blue color=blue
32 [label="Enter property" style="filled" fillcolor=red]; 32 [label="Enter function <init>" style="filled" fillcolor=red];
33 [label="Access variable R|<local>/data|"]; 33 [label="Delegated constructor call: super<R|kotlin/Any|>()" style="filled" fillcolor=yellow];
34 [label="Exit property" style="filled" fillcolor=red]; 34 [label="Exit function <init>" style="filled" fillcolor=red];
} }
subgraph cluster_15 { subgraph cluster_15 {
color=blue color=blue
35 [label="Enter function <init>" style="filled" fillcolor=red]; 35 [label="Enter property" style="filled" fillcolor=red];
36 [label="Delegated constructor call: super<R|kotlin/Any|>()" style="filled" fillcolor=yellow]; 36 [label="Access variable R|<local>/data|"];
37 [label="Exit function <init>" style="filled" fillcolor=red]; 37 [label="Exit property" style="filled" fillcolor=red];
} }
38 [label="Exit class QImplMutable" style="filled" fillcolor=red]; 38 [label="Exit class QImplMutable" style="filled" fillcolor=red];
} }
@@ -15,15 +15,15 @@ digraph assignSafeCall_kt {
2 [label="Enter class A" style="filled" fillcolor=red]; 2 [label="Enter class A" style="filled" fillcolor=red];
subgraph cluster_2 { subgraph cluster_2 {
color=blue color=blue
3 [label="Enter property" style="filled" fillcolor=red]; 3 [label="Enter function <init>" style="filled" fillcolor=red];
4 [label="Const: Int(1)"]; 4 [label="Delegated constructor call: super<R|kotlin/Any|>()" style="filled" fillcolor=yellow];
5 [label="Exit property" style="filled" fillcolor=red]; 5 [label="Exit function <init>" style="filled" fillcolor=red];
} }
subgraph cluster_3 { subgraph cluster_3 {
color=blue color=blue
6 [label="Enter function <init>" style="filled" fillcolor=red]; 6 [label="Enter property" style="filled" fillcolor=red];
7 [label="Delegated constructor call: super<R|kotlin/Any|>()" style="filled" fillcolor=yellow]; 7 [label="Const: Int(1)"];
8 [label="Exit function <init>" style="filled" fillcolor=red]; 8 [label="Exit property" style="filled" fillcolor=red];
} }
9 [label="Exit class A" style="filled" fillcolor=red]; 9 [label="Exit class A" style="filled" fillcolor=red];
} }
@@ -65,43 +65,43 @@ digraph smartCastInInit_kt {
18 [label="Enter class Main" style="filled" fillcolor=red]; 18 [label="Enter class Main" style="filled" fillcolor=red];
subgraph cluster_8 { subgraph cluster_8 {
color=blue color=blue
19 [label="Enter init block" style="filled" fillcolor=red]; 19 [label="Enter function <init>" style="filled" fillcolor=red];
subgraph cluster_9 { 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 color=blue
20 [label="Enter block"]; 23 [label="Enter block"];
subgraph cluster_10 {
color=blue
21 [label="Function call arguments enter"];
22 [label="Function call arguments exit"];
}
23 [label="Function call: R|/s|()" style="filled" fillcolor=yellow];
24 [label="Assignment: R|/Main.x|"];
subgraph cluster_11 { subgraph cluster_11 {
color=blue color=blue
25 [label="Function call arguments enter"]; 24 [label="Function call arguments enter"];
26 [label="Access variable R|/Main.x|"]; 25 [label="Function call arguments exit"];
27 [label="Smart cast: this@R|/Main|.R|/Main.x|"];
28 [label="Function call arguments exit"];
} }
29 [label="Function call: this@R|/Main|.R|/Main.x|.R|/S.foo|()" style="filled" fillcolor=yellow]; 26 [label="Function call: R|/s|()" style="filled" fillcolor=yellow];
30 [label="Exit block"]; 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"];
} }
31 [label="Exit init block" style="filled" fillcolor=red]; 34 [label="Exit init block" style="filled" fillcolor=red];
}
subgraph cluster_12 {
color=blue
32 [label="Enter function <init>" style="filled" fillcolor=red];
33 [label="Delegated constructor call: super<R|kotlin/Any|>()" style="filled" fillcolor=yellow];
34 [label="Exit function <init>" style="filled" fillcolor=red];
} }
35 [label="Exit class Main" style="filled" fillcolor=red]; 35 [label="Exit class Main" style="filled" fillcolor=red];
} }
18 -> {19} [color=green]; 18 -> {19} [color=green];
18 -> {35} [style=dotted]; 18 -> {35} [style=dotted];
18 -> {19 32} [style=dashed]; 18 -> {19 22} [style=dashed];
19 -> {20}; 19 -> {20};
20 -> {21}; 20 -> {21};
21 -> {22}; 21 -> {22} [color=green];
22 -> {23}; 22 -> {23};
23 -> {24}; 23 -> {24};
24 -> {25}; 24 -> {25};
@@ -111,7 +111,7 @@ digraph smartCastInInit_kt {
28 -> {29}; 28 -> {29};
29 -> {30}; 29 -> {30};
30 -> {31}; 30 -> {31};
31 -> {32} [color=green]; 31 -> {32};
32 -> {33}; 32 -> {33};
33 -> {34}; 33 -> {34};
34 -> {35} [color=green]; 34 -> {35} [color=green];
@@ -15,21 +15,21 @@ digraph smartcastInByClause_kt {
2 [label="Enter class A" style="filled" fillcolor=red]; 2 [label="Enter class A" style="filled" fillcolor=red];
subgraph cluster_2 { subgraph cluster_2 {
color=blue color=blue
3 [label="Enter property" style="filled" fillcolor=red]; 3 [label="Enter function <init>" style="filled" fillcolor=red];
4 [label="Access variable R|<local>/path|"]; 4 [label="Delegated constructor call: super<R|kotlin/Any|>()" style="filled" fillcolor=yellow];
5 [label="Exit property" style="filled" fillcolor=red]; 5 [label="Exit function <init>" style="filled" fillcolor=red];
} }
subgraph cluster_3 { subgraph cluster_3 {
color=blue color=blue
6 [label="Enter property" style="filled" fillcolor=red]; 6 [label="Enter property" style="filled" fillcolor=red];
7 [label="Access variable R|<local>/index|"]; 7 [label="Access variable R|<local>/path|"];
8 [label="Exit property" style="filled" fillcolor=red]; 8 [label="Exit property" style="filled" fillcolor=red];
} }
subgraph cluster_4 { subgraph cluster_4 {
color=blue color=blue
9 [label="Enter function <init>" style="filled" fillcolor=red]; 9 [label="Enter property" style="filled" fillcolor=red];
10 [label="Delegated constructor call: super<R|kotlin/Any|>()" style="filled" fillcolor=yellow]; 10 [label="Access variable R|<local>/index|"];
11 [label="Exit function <init>" style="filled" fillcolor=red]; 11 [label="Exit property" style="filled" fillcolor=red];
} }
12 [label="Exit class A" style="filled" fillcolor=red]; 12 [label="Exit class A" style="filled" fillcolor=red];
} }
@@ -58,15 +58,15 @@ digraph smartcastInByClause_kt {
15 [label="Enter class Derived" style="filled" fillcolor=red]; 15 [label="Enter class Derived" style="filled" fillcolor=red];
subgraph cluster_7 { subgraph cluster_7 {
color=blue color=blue
16 [label="Enter property" style="filled" fillcolor=red]; 16 [label="Enter function <init>" style="filled" fillcolor=red];
17 [label="Access variable R|<local>/index|"]; 17 [label="Delegated constructor call: super<R|kotlin/Any|>()" style="filled" fillcolor=yellow];
18 [label="Exit property" style="filled" fillcolor=red]; 18 [label="Exit function <init>" style="filled" fillcolor=red];
} }
subgraph cluster_8 { subgraph cluster_8 {
color=blue color=blue
19 [label="Enter function <init>" style="filled" fillcolor=red]; 19 [label="Enter property" style="filled" fillcolor=red];
20 [label="Delegated constructor call: super<R|kotlin/Any|>()" style="filled" fillcolor=yellow]; 20 [label="Access variable R|<local>/index|"];
21 [label="Exit function <init>" style="filled" fillcolor=red]; 21 [label="Exit property" style="filled" fillcolor=red];
} }
22 [label="Exit class Derived" style="filled" fillcolor=red]; 22 [label="Exit class Derived" style="filled" fillcolor=red];
} }
@@ -113,31 +113,31 @@ digraph smartcastInByClause_kt {
44 [label="Enter class <anonymous object>" style="filled" fillcolor=red]; 44 [label="Enter class <anonymous object>" style="filled" fillcolor=red];
subgraph cluster_13 { subgraph cluster_13 {
color=blue color=blue
45 [label="Enter field" style="filled" fillcolor=red]; 45 [label="Enter function <init>" style="filled" fillcolor=red];
subgraph cluster_14 { 46 [label="Delegated constructor call: super<R|kotlin/Any|>()" style="filled" fillcolor=yellow];
color=blue 47 [label="Exit function <init>" style="filled" fillcolor=red];
46 [label="Function call arguments enter"];
47 [label="Access variable R|<local>/a|"];
48 [label="Smart cast: R|<local>/a|"];
49 [label="Access variable R|/A.index|"];
50 [label="Function call arguments exit"];
}
51 [label="Function call: R|/Derived.Derived|(...)" style="filled" fillcolor=yellow];
52 [label="Exit field" style="filled" fillcolor=red];
} }
subgraph cluster_15 { subgraph cluster_14 {
color=blue color=blue
53 [label="Enter property" style="filled" fillcolor=red]; 48 [label="Enter field" style="filled" fillcolor=red];
54 [label="Access variable R|<local>/a|"]; subgraph cluster_15 {
55 [label="Smart cast: R|<local>/a|"]; color=blue
56 [label="Access variable R|/A.index|"]; 49 [label="Function call arguments enter"];
57 [label="Exit property" style="filled" fillcolor=red]; 50 [label="Access variable R|<local>/a|"];
51 [label="Smart cast: R|<local>/a|"];
52 [label="Access variable R|/A.index|"];
53 [label="Function call arguments exit"];
}
54 [label="Function call: R|/Derived.Derived|(...)" style="filled" fillcolor=yellow];
55 [label="Exit field" style="filled" fillcolor=red];
} }
subgraph cluster_16 { subgraph cluster_16 {
color=blue color=blue
58 [label="Enter function <init>" style="filled" fillcolor=red]; 56 [label="Enter property" style="filled" fillcolor=red];
59 [label="Delegated constructor call: super<R|kotlin/Any|>()" style="filled" fillcolor=yellow]; 57 [label="Access variable R|<local>/a|"];
60 [label="Exit function <init>" style="filled" fillcolor=red]; 58 [label="Smart cast: R|<local>/a|"];
59 [label="Access variable R|/A.index|"];
60 [label="Exit property" style="filled" fillcolor=red];
} }
61 [label="Exit class <anonymous object>" style="filled" fillcolor=red]; 61 [label="Exit class <anonymous object>" style="filled" fillcolor=red];
} }
@@ -207,24 +207,24 @@ digraph smartcastInByClause_kt {
43 -> {62} [style=dotted]; 43 -> {62} [style=dotted];
43 -> {44} [style=dashed]; 43 -> {44} [style=dashed];
44 -> {45}; 44 -> {45};
44 -> {53 58 67} [color=red]; 44 -> {48 56 67} [color=red];
44 -> {61} [style=dotted]; 44 -> {61} [style=dotted];
44 -> {45 53 58} [style=dashed]; 44 -> {45 48 56} [style=dashed];
45 -> {46}; 45 -> {46};
46 -> {47}; 46 -> {47};
47 -> {48}; 47 -> {48} [color=green];
47 -> {61} [color=red];
48 -> {49}; 48 -> {49};
49 -> {50}; 49 -> {50};
50 -> {51}; 50 -> {51};
51 -> {52}; 51 -> {52};
52 -> {53} [color=green]; 52 -> {53};
52 -> {61} [color=red];
53 -> {54}; 53 -> {54};
54 -> {55}; 54 -> {55};
55 -> {56}; 55 -> {56} [color=green];
55 -> {61} [color=red];
56 -> {57}; 56 -> {57};
57 -> {58} [color=green]; 57 -> {58};
57 -> {61} [color=red];
58 -> {59}; 58 -> {59};
59 -> {60}; 59 -> {60};
60 -> {61}; 60 -> {61};
@@ -133,21 +133,21 @@ digraph smartcastToNothing_kt {
43 [label="Enter class A" style="filled" fillcolor=red]; 43 [label="Enter class A" style="filled" fillcolor=red];
subgraph cluster_13 { subgraph cluster_13 {
color=blue color=blue
44 [label="Enter property" style="filled" fillcolor=red]; 44 [label="Enter function <init>" style="filled" fillcolor=red];
45 [label="Const: Int(1)"]; 45 [label="Delegated constructor call: super<R|kotlin/Any|>()" style="filled" fillcolor=yellow];
46 [label="Exit property" style="filled" fillcolor=red]; 46 [label="Exit function <init>" style="filled" fillcolor=red];
} }
subgraph cluster_14 { subgraph cluster_14 {
color=blue color=blue
47 [label="Enter property" style="filled" fillcolor=red]; 47 [label="Enter property" style="filled" fillcolor=red];
48 [label="Const: Boolean(true)"]; 48 [label="Const: Int(1)"];
49 [label="Exit property" style="filled" fillcolor=red]; 49 [label="Exit property" style="filled" fillcolor=red];
} }
subgraph cluster_15 { subgraph cluster_15 {
color=blue color=blue
50 [label="Enter function <init>" style="filled" fillcolor=red]; 50 [label="Enter property" style="filled" fillcolor=red];
51 [label="Delegated constructor call: super<R|kotlin/Any|>()" style="filled" fillcolor=yellow]; 51 [label="Const: Boolean(true)"];
52 [label="Exit function <init>" style="filled" fillcolor=red]; 52 [label="Exit property" style="filled" fillcolor=red];
} }
53 [label="Exit class A" style="filled" fillcolor=red]; 53 [label="Exit class A" style="filled" fillcolor=red];
} }
@@ -15,15 +15,15 @@ digraph overridenOpenVal_kt {
2 [label="Enter class A" style="filled" fillcolor=red]; 2 [label="Enter class A" style="filled" fillcolor=red];
subgraph cluster_2 { subgraph cluster_2 {
color=blue color=blue
3 [label="Enter property" style="filled" fillcolor=red]; 3 [label="Enter function <init>" style="filled" fillcolor=red];
4 [label="Access variable R|<local>/x|"]; 4 [label="Delegated constructor call: super<R|kotlin/Any|>()" style="filled" fillcolor=yellow];
5 [label="Exit property" style="filled" fillcolor=red]; 5 [label="Exit function <init>" style="filled" fillcolor=red];
} }
subgraph cluster_3 { subgraph cluster_3 {
color=blue color=blue
6 [label="Enter function <init>" style="filled" fillcolor=red]; 6 [label="Enter property" style="filled" fillcolor=red];
7 [label="Delegated constructor call: super<R|kotlin/Any|>()" style="filled" fillcolor=yellow]; 7 [label="Access variable R|<local>/x|"];
8 [label="Exit function <init>" style="filled" fillcolor=red]; 8 [label="Exit property" style="filled" fillcolor=red];
} }
9 [label="Exit class A" style="filled" fillcolor=red]; 9 [label="Exit class A" style="filled" fillcolor=red];
} }
@@ -27,27 +27,27 @@ digraph inAnonymousObject_kt {
7 [label="Enter class <anonymous object>" style="filled" fillcolor=red]; 7 [label="Enter class <anonymous object>" style="filled" fillcolor=red];
subgraph cluster_5 { subgraph cluster_5 {
color=blue color=blue
8 [label="Enter property" style="filled" fillcolor=red]; 8 [label="Enter function <init>" style="filled" fillcolor=red];
9 [label="Access variable R|<local>/a|"]; 9 [label="Delegated constructor call: super<R|kotlin/Any|>()" style="filled" fillcolor=yellow];
10 [label="Exit property" style="filled" fillcolor=red]; 10 [label="Exit function <init>" style="filled" fillcolor=red];
} }
subgraph cluster_6 { subgraph cluster_6 {
color=blue color=blue
11 [label="Enter init block" style="filled" fillcolor=red]; 11 [label="Enter property" style="filled" fillcolor=red];
subgraph cluster_7 { 12 [label="Access variable R|<local>/a|"];
color=blue 13 [label="Exit property" style="filled" fillcolor=red];
12 [label="Enter block"];
13 [label="Access variable R|<local>/b|"];
14 [label="Assignment: R|/<anonymous>.leaked|"];
15 [label="Exit block"];
}
16 [label="Exit init block" style="filled" fillcolor=red];
} }
subgraph cluster_8 { subgraph cluster_7 {
color=blue color=blue
17 [label="Enter function <init>" style="filled" fillcolor=red]; 14 [label="Enter init block" style="filled" fillcolor=red];
18 [label="Delegated constructor call: super<R|kotlin/Any|>()" style="filled" fillcolor=yellow]; subgraph cluster_8 {
19 [label="Exit function <init>" style="filled" fillcolor=red]; color=blue
15 [label="Enter block"];
16 [label="Access variable R|<local>/b|"];
17 [label="Assignment: R|/<anonymous>.leaked|"];
18 [label="Exit block"];
}
19 [label="Exit init block" style="filled" fillcolor=red];
} }
20 [label="Exit class <anonymous object>" style="filled" fillcolor=red]; 20 [label="Exit class <anonymous object>" style="filled" fillcolor=red];
} }
@@ -94,20 +94,20 @@ digraph inAnonymousObject_kt {
6 -> {21} [style=dotted]; 6 -> {21} [style=dotted];
6 -> {7} [style=dashed]; 6 -> {7} [style=dashed];
7 -> {8}; 7 -> {8};
7 -> {11 17 32} [color=red]; 7 -> {11 14 32} [color=red];
7 -> {20} [style=dotted]; 7 -> {20} [style=dotted];
7 -> {8 11 17} [style=dashed]; 7 -> {8 11 14} [style=dashed];
8 -> {9}; 8 -> {9};
9 -> {10}; 9 -> {10};
10 -> {11} [color=green]; 10 -> {11} [color=green];
10 -> {20} [color=red]; 10 -> {20} [color=red];
11 -> {12}; 11 -> {12};
12 -> {13}; 12 -> {13};
13 -> {14}; 13 -> {14} [color=green];
13 -> {20} [color=red];
14 -> {15}; 14 -> {15};
15 -> {16}; 15 -> {16};
16 -> {17} [color=green]; 16 -> {17};
16 -> {20} [color=red];
17 -> {18}; 17 -> {18};
18 -> {19}; 18 -> {19};
19 -> {20}; 19 -> {20};
@@ -89,153 +89,153 @@ digraph delegateWithAnonymousObject_kt {
25 [label="Enter class IssuesListUserProfile" style="filled" fillcolor=red]; 25 [label="Enter class IssuesListUserProfile" style="filled" fillcolor=red];
subgraph cluster_10 { subgraph cluster_10 {
color=blue color=blue
26 [label="Enter property" style="filled" fillcolor=red]; 26 [label="Enter function <init>" style="filled" fillcolor=red];
subgraph cluster_11 { 27 [label="Delegated constructor call: super<R|DelegateProvider<IssuesListUserProfile>|>()" style="filled" fillcolor=yellow];
color=blue 28 [label="Exit function <init>" style="filled" fillcolor=red];
27 [label="Function call arguments enter"];
28 [label="Postponed enter to lambda"];
subgraph cluster_12 {
color=blue
29 [label="Enter function <anonymous>" style="filled" fillcolor=red];
subgraph cluster_13 {
color=blue
30 [label="Enter block"];
31 [label="Enter anonymous object"];
subgraph cluster_14 {
color=blue
32 [label="Enter class <anonymous object>" style="filled" fillcolor=red];
subgraph cluster_15 {
color=blue
33 [label="Enter function <init>" style="filled" fillcolor=red];
34 [label="Delegated constructor call: super<R|kotlin/Any|>()" style="filled" fillcolor=yellow];
35 [label="Exit function <init>" style="filled" fillcolor=red];
}
36 [label="Exit class <anonymous object>" style="filled" fillcolor=red];
}
37 [label="Exit anonymous object expression"];
38 [label="Exit block"];
}
39 [label="Exit function <anonymous>" style="filled" fillcolor=red];
}
subgraph cluster_16 {
color=blue
40 [label="Enter function setValue" style="filled" fillcolor=red];
subgraph cluster_17 {
color=blue
41 [label="Enter block"];
subgraph cluster_18 {
color=blue
42 [label="Function call arguments enter"];
subgraph cluster_19 {
color=blue
43 [label="Function call arguments enter"];
44 [label="Function call arguments exit"];
}
45 [label="Function call: R|/IssueListView.IssueListView|()" style="filled" fillcolor=yellow];
46 [label="Access variable R|<local>/value|"];
47 [label="Function call arguments exit"];
}
48 [label="Function call: R|/IssueListView.IssueListView|().R|/IssueListView.updateFrom|(...)" style="filled" fillcolor=yellow];
49 [label="Jump: ^setValue R|/IssueListView.IssueListView|().R|/IssueListView.updateFrom|(R|<local>/value|)"];
50 [label="Stub" style="filled" fillcolor=gray];
51 [label="Exit block" style="filled" fillcolor=gray];
}
52 [label="Exit function setValue" style="filled" fillcolor=red];
}
subgraph cluster_20 {
color=blue
53 [label="Enter function getValue" style="filled" fillcolor=red];
subgraph cluster_21 {
color=blue
54 [label="Enter block"];
subgraph cluster_22 {
color=blue
55 [label="Function call arguments enter"];
56 [label="Function call arguments exit"];
}
57 [label="Function call: R|/IssueListView.IssueListView|()" style="filled" fillcolor=yellow];
58 [label="Jump: ^getValue R|/IssueListView.IssueListView|()"];
59 [label="Stub" style="filled" fillcolor=gray];
60 [label="Exit block" style="filled" fillcolor=gray];
}
61 [label="Exit function getValue" style="filled" fillcolor=red];
}
62 [label="Function call arguments exit"];
}
63 [label="Postponed exit from lambda"];
64 [label="Function call: this@R|/IssuesListUserProfile|.R|/delegate|<R|IssuesListUserProfile|, R|IssuesListUserProfile|, R|IssueListView|>(...)" style="filled" fillcolor=yellow];
subgraph cluster_23 {
color=blue
65 [label="Function call arguments enter"];
66 [label="Function call arguments exit"];
}
67 [label="Function call: this@R|/IssuesListUserProfile|.R|/delegate|<R|IssuesListUserProfile|, R|IssuesListUserProfile|, R|IssueListView|>(...).R?C|special/error|(...)" style="filled" fillcolor=yellow];
68 [label="Exit property delegate" style="filled" fillcolor=yellow];
69 [label="Exit property" style="filled" fillcolor=red];
} }
subgraph cluster_24 { subgraph cluster_11 {
color=blue color=blue
70 [label="Enter function <init>" style="filled" fillcolor=red]; 29 [label="Enter property" style="filled" fillcolor=red];
71 [label="Delegated constructor call: super<R|DelegateProvider<IssuesListUserProfile>|>()" style="filled" fillcolor=yellow]; subgraph cluster_12 {
72 [label="Exit function <init>" style="filled" fillcolor=red]; color=blue
30 [label="Function call arguments enter"];
31 [label="Postponed enter to lambda"];
subgraph cluster_13 {
color=blue
32 [label="Enter function <anonymous>" style="filled" fillcolor=red];
subgraph cluster_14 {
color=blue
33 [label="Enter block"];
34 [label="Enter anonymous object"];
subgraph cluster_15 {
color=blue
35 [label="Enter class <anonymous object>" style="filled" fillcolor=red];
subgraph cluster_16 {
color=blue
36 [label="Enter function <init>" style="filled" fillcolor=red];
37 [label="Delegated constructor call: super<R|kotlin/Any|>()" style="filled" fillcolor=yellow];
38 [label="Exit function <init>" style="filled" fillcolor=red];
}
39 [label="Exit class <anonymous object>" style="filled" fillcolor=red];
}
40 [label="Exit anonymous object expression"];
41 [label="Exit block"];
}
42 [label="Exit function <anonymous>" style="filled" fillcolor=red];
}
subgraph cluster_17 {
color=blue
43 [label="Enter function setValue" style="filled" fillcolor=red];
subgraph cluster_18 {
color=blue
44 [label="Enter block"];
subgraph cluster_19 {
color=blue
45 [label="Function call arguments enter"];
subgraph cluster_20 {
color=blue
46 [label="Function call arguments enter"];
47 [label="Function call arguments exit"];
}
48 [label="Function call: R|/IssueListView.IssueListView|()" style="filled" fillcolor=yellow];
49 [label="Access variable R|<local>/value|"];
50 [label="Function call arguments exit"];
}
51 [label="Function call: R|/IssueListView.IssueListView|().R|/IssueListView.updateFrom|(...)" style="filled" fillcolor=yellow];
52 [label="Jump: ^setValue R|/IssueListView.IssueListView|().R|/IssueListView.updateFrom|(R|<local>/value|)"];
53 [label="Stub" style="filled" fillcolor=gray];
54 [label="Exit block" style="filled" fillcolor=gray];
}
55 [label="Exit function setValue" style="filled" fillcolor=red];
}
subgraph cluster_21 {
color=blue
56 [label="Enter function getValue" style="filled" fillcolor=red];
subgraph cluster_22 {
color=blue
57 [label="Enter block"];
subgraph cluster_23 {
color=blue
58 [label="Function call arguments enter"];
59 [label="Function call arguments exit"];
}
60 [label="Function call: R|/IssueListView.IssueListView|()" style="filled" fillcolor=yellow];
61 [label="Jump: ^getValue R|/IssueListView.IssueListView|()"];
62 [label="Stub" style="filled" fillcolor=gray];
63 [label="Exit block" style="filled" fillcolor=gray];
}
64 [label="Exit function getValue" style="filled" fillcolor=red];
}
65 [label="Function call arguments exit"];
}
66 [label="Postponed exit from lambda"];
67 [label="Function call: this@R|/IssuesListUserProfile|.R|/delegate|<R|IssuesListUserProfile|, R|IssuesListUserProfile|, R|IssueListView|>(...)" style="filled" fillcolor=yellow];
subgraph cluster_24 {
color=blue
68 [label="Function call arguments enter"];
69 [label="Function call arguments exit"];
}
70 [label="Function call: this@R|/IssuesListUserProfile|.R|/delegate|<R|IssuesListUserProfile|, R|IssuesListUserProfile|, R|IssueListView|>(...).R?C|special/error|(...)" style="filled" fillcolor=yellow];
71 [label="Exit property delegate" style="filled" fillcolor=yellow];
72 [label="Exit property" style="filled" fillcolor=red];
} }
73 [label="Exit class IssuesListUserProfile" style="filled" fillcolor=red]; 73 [label="Exit class IssuesListUserProfile" style="filled" fillcolor=red];
} }
25 -> {26} [color=green]; 25 -> {26} [color=green];
25 -> {73} [style=dotted]; 25 -> {73} [style=dotted];
25 -> {26 70} [style=dashed]; 25 -> {26 29} [style=dashed];
26 -> {27}; 26 -> {27};
27 -> {28}; 27 -> {28};
28 -> {29 62 63}; 28 -> {29} [color=green];
28 -> {29} [style=dashed];
29 -> {30}; 29 -> {30};
30 -> {31}; 30 -> {31};
31 -> {32}; 31 -> {32 65 66};
31 -> {37} [style=dotted];
31 -> {32} [style=dashed]; 31 -> {32} [style=dashed];
32 -> {33}; 32 -> {33};
32 -> {40 53} [color=red];
32 -> {36} [style=dotted];
32 -> {33} [style=dashed];
33 -> {34}; 33 -> {34};
34 -> {35}; 34 -> {35};
34 -> {40} [style=dotted];
34 -> {35} [style=dashed];
35 -> {36}; 35 -> {36};
35 -> {43 56} [color=red];
35 -> {39} [style=dotted];
35 -> {36} [style=dashed];
36 -> {37}; 36 -> {37};
36 -> {40 53} [color=green];
36 -> {40 53} [style=dashed];
37 -> {38}; 37 -> {38};
38 -> {39}; 38 -> {39};
39 -> {40};
39 -> {43 56} [color=green];
39 -> {43 56} [style=dashed];
40 -> {41}; 40 -> {41};
41 -> {42}; 41 -> {42};
42 -> {43};
43 -> {44}; 43 -> {44};
44 -> {45}; 44 -> {45};
45 -> {46}; 45 -> {46};
46 -> {47}; 46 -> {47};
47 -> {48}; 47 -> {48};
48 -> {49}; 48 -> {49};
49 -> {52}; 49 -> {50};
49 -> {50} [style=dotted]; 50 -> {51};
50 -> {51} [style=dotted]; 51 -> {52};
51 -> {52} [style=dotted]; 52 -> {55};
53 -> {54}; 52 -> {53} [style=dotted];
54 -> {55}; 53 -> {54} [style=dotted];
55 -> {56}; 54 -> {55} [style=dotted];
56 -> {57}; 56 -> {57};
57 -> {58}; 57 -> {58};
58 -> {61}; 58 -> {59};
58 -> {59} [style=dotted]; 59 -> {60};
59 -> {60} [style=dotted]; 60 -> {61};
60 -> {61} [style=dotted]; 61 -> {64};
62 -> {64}; 61 -> {62} [style=dotted];
63 -> {64} [color=green]; 62 -> {63} [style=dotted];
63 -> {68} [color=red label="Postponed"]; 63 -> {64} [style=dotted];
64 -> {65}; 65 -> {67};
65 -> {66}; 66 -> {67} [color=green];
66 -> {67}; 66 -> {71} [color=red label="Postponed"];
67 -> {68}; 67 -> {68};
68 -> {69}; 68 -> {69};
69 -> {70} [color=green]; 69 -> {70};
70 -> {71}; 70 -> {71};
71 -> {72}; 71 -> {72};
72 -> {73} [color=green]; 72 -> {73} [color=green];
@@ -61,15 +61,15 @@ digraph plusAssignWithLambdaInRhs_kt {
19 [label="Enter class A" style="filled" fillcolor=red]; 19 [label="Enter class A" style="filled" fillcolor=red];
subgraph cluster_6 { subgraph cluster_6 {
color=blue color=blue
20 [label="Enter property" style="filled" fillcolor=red]; 20 [label="Enter function <init>" style="filled" fillcolor=red];
21 [label="Access variable R|<local>/executor|"]; 21 [label="Delegated constructor call: super<R|kotlin/Any|>()" style="filled" fillcolor=yellow];
22 [label="Exit property" style="filled" fillcolor=red]; 22 [label="Exit function <init>" style="filled" fillcolor=red];
} }
subgraph cluster_7 { subgraph cluster_7 {
color=blue color=blue
23 [label="Enter function <init>" style="filled" fillcolor=red]; 23 [label="Enter property" style="filled" fillcolor=red];
24 [label="Delegated constructor call: super<R|kotlin/Any|>()" style="filled" fillcolor=yellow]; 24 [label="Access variable R|<local>/executor|"];
25 [label="Exit function <init>" style="filled" fillcolor=red]; 25 [label="Exit property" style="filled" fillcolor=red];
} }
26 [label="Exit class A" style="filled" fillcolor=red]; 26 [label="Exit class A" style="filled" fillcolor=red];
} }
@@ -436,8 +436,18 @@ class ControlFlowGraphBuilder {
// ----------------------------------- Classes ----------------------------------- // ----------------------------------- Classes -----------------------------------
private fun FirClass.firstInPlaceInitializedMember(): FirDeclaration? = /**
declarations.find { it is FirControlFlowGraphOwner && it !is FirConstructor && it.isUsedInControlFlowGraphBuilderForClass } * The first in-place initializer is either:
* 1. The primary constructor.
* 2. The first property or anonymous initializer.
*/
private fun FirClass.firstInPlaceInitializer(): FirDeclaration? {
return declarations.find {
it is FirControlFlowGraphOwner &&
(it !is FirConstructor || it.isPrimary) &&
it.isUsedInControlFlowGraphBuilderForClass
}
}
private inline fun List<FirElement>.forEachGraphOwner(block: (FirControlFlowGraphOwner) -> Unit) { private inline fun List<FirElement>.forEachGraphOwner(block: (FirControlFlowGraphOwner) -> Unit) {
for (member in this) { for (member in this) {
@@ -486,14 +496,19 @@ class ControlFlowGraphBuilder {
} }
if (enterNode.previousNodes.isNotEmpty()) { if (enterNode.previousNodes.isNotEmpty()) {
val firstInPlace = klass.firstInPlaceInitializedMember() val firstInPlace = klass.firstInPlaceInitializer()
klass.declarations.forEachGraphOwner { klass.declarations.forEachGraphOwner {
// For local classes, the first in-place initializer, all constructors when there are no in-place initializers, or any // For local classes,
// this-delegating constructors should have a forward edge from ClassEnterNode, while everything else should have a // - the first in-place initializer,
// DFG-only forward edge. // - all constructors when there are no in-place initializers,
val kind = if (firstInPlace == it || // - or any this-delegating constructors,
(it is FirConstructor && (firstInPlace == null || it.delegatedConstructor?.isThis == true)) // should have a forward edge from ClassEnterNode.
) EdgeKind.Forward else EdgeKind.DfgForward // Everything else should have a DFG-only forward edge.
val kind = when {
firstInPlace == it -> EdgeKind.Forward
it is FirConstructor && (firstInPlace == null || it.delegatedConstructor?.isThis == true) -> EdgeKind.Forward
else -> EdgeKind.DfgForward
}
enterToLocalClassesMembers[(it as FirDeclaration).symbol] = enterNode to kind enterToLocalClassesMembers[(it as FirDeclaration).symbol] = enterNode to kind
} }
} }
@@ -521,13 +536,23 @@ class ControlFlowGraphBuilder {
} }
val isLocalClass = klass.isLocal val isLocalClass = klass.isLocal
var primaryConstructor: ControlFlowGraph? = null
val calledInPlace = mutableListOf<ControlFlowGraph>() val calledInPlace = mutableListOf<ControlFlowGraph>()
val secondaryConstructors = mutableMapOf<FirConstructor, ControlFlowGraph>()
val calledLater = mutableListOf<ControlFlowGraph>() val calledLater = mutableListOf<ControlFlowGraph>()
val constructors = mutableMapOf<FirConstructor, ControlFlowGraph>()
klass.declarations.forEachGraphOwner { klass.declarations.forEachGraphOwner {
val graph = it.controlFlowGraphReference?.controlFlowGraph ?: return@forEachGraphOwner val graph = it.controlFlowGraphReference?.controlFlowGraph ?: return@forEachGraphOwner
when (it) { when (it) {
is FirConstructor -> constructors[it] = graph is FirConstructor -> when {
it.isPrimary -> {
// The primary constructor is treated as an in-place initializer since it is always called, but a specific
// reference needs to be saved to inject into any secondary constructor delegation.
calledInPlace.add(graph)
primaryConstructor = graph
}
else -> secondaryConstructors[it] = graph
}
is FirPropertyAccessor, is FirFunction, is FirClass -> if (isLocalClass) { is FirPropertyAccessor, is FirFunction, is FirClass -> if (isLocalClass) {
calledLater.add(graph) calledLater.add(graph)
} }
@@ -536,22 +561,29 @@ class ControlFlowGraphBuilder {
} }
} }
// Create primary constructor and in-place initializer edges.
val firstInPlaceEnter = calledInPlace.firstOrNull()?.enterNode
val lastInPlaceExit = calledInPlace.fold<_, CFGNode<*>>(enterNode) { lastNode, graph -> val lastInPlaceExit = calledInPlace.fold<_, CFGNode<*>>(enterNode) { lastNode, graph ->
// In local classes, we already have control flow (+ data flow) edge from `enterNode` // In local classes, we already have control flow (+ data flow) edge from `enterNode`
// to first in-place initializer. // to primary constructor or first in-place initializer.
if (lastNode !== enterNode || lastNode.previousNodes.isEmpty()) { if (lastNode !== enterNode || lastNode.previousNodes.isEmpty()) {
addEdgeToSubGraph(lastNode, graph.enterNode) addEdgeToSubGraph(lastNode, graph.enterNode)
} }
graph.exitNode graph.exitNode
} }
if (exitNode.isUnion) {
// => this is an anonymous object => there's only one constructor => can use `exitNode` for (graph in calledInPlace) {
// to unify data flow from all in-place-called members, including said constructor. EdgeKind.forward(
for (graph in calledInPlace) { // => this class has a primary constructor => the last in-place initializer must have a
addEdge(graph.exitNode, exitNode, preferredKind = EdgeKind.DfgForward) // control flow edge to the exit node.
} usedInCfa = primaryConstructor != null && graph.exitNode == lastInPlaceExit,
// => this is an anonymous object => there's only one constructor => can use `exitNode`
// to unify data flow from all in-place-called members, including said constructor.
usedInDfa = exitNode.isUnion,
)?.let { edgeKind -> addEdge(graph.exitNode, exitNode, preferredKind = edgeKind) }
} }
// Create secondary constructor edges.
val parentConstructors = mutableMapOf<FirConstructor, FirConstructor?>() val parentConstructors = mutableMapOf<FirConstructor, FirConstructor?>()
fun FirConstructor.parentConstructor(): FirConstructor? = parentConstructors.getOrPutNullable(this) { fun FirConstructor.parentConstructor(): FirConstructor? = parentConstructors.getOrPutNullable(this) {
// Break cycles in some way; there will be errors on delegated constructor calls in that case. // Break cycles in some way; there will be errors on delegated constructor calls in that case.
@@ -561,15 +593,23 @@ class ControlFlowGraphBuilder {
?.takeIf { parent -> this !in generateSequence(parent) { it.parentConstructor() } } ?.takeIf { parent -> this !in generateSequence(parent) { it.parentConstructor() } }
} }
for ((ctor, graph) in constructors) { fun getDelegateNodes(ctor: FirConstructor): Pair<CFGNode<FirElement>?, CFGNode<FirElement>?> {
val delegatedConstructorGraph = constructors[ctor.parentConstructor()] val parentConstructor = ctor.parentConstructor()
if (delegatedConstructorGraph != null) { val secondaryGraph = secondaryConstructors[parentConstructor]
return when {
secondaryGraph != null -> (firstInPlaceEnter ?: secondaryGraph.enterNode) to secondaryGraph.exitNode
primaryConstructor != null && primaryConstructor == parentConstructor?.controlFlowGraphReference?.controlFlowGraph -> firstInPlaceEnter to lastInPlaceExit
else -> null to null
}
}
for ((ctor, graph) in secondaryConstructors) {
val (delegatedEnter, delegatedExit) = getDelegateNodes(ctor)
if (delegatedEnter != null && delegatedExit != null) {
// Inject delegated constructor and other in-place initializer sub-graphs after the delegated constructor call node. This // 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 // ensures property initialization and use is calculated correctly when there are complex calculations for the arguments to
// the delegated constructor. // the delegated constructor.
val delegatedConstructorEnter = calledInPlace.firstOrNull()?.enterNode ?: delegatedConstructorGraph.enterNode
val delegatedConstructorExit = delegatedConstructorGraph.exitNode
val delegatedConstructorCall = graph.nodes.single { it is DelegatedConstructorCallNode } val delegatedConstructorCall = graph.nodes.single { it is DelegatedConstructorCallNode }
val edgeLabel = graph.exitNode as FunctionExitNode val edgeLabel = graph.exitNode as FunctionExitNode
@@ -578,9 +618,9 @@ class ControlFlowGraphBuilder {
if (!isLocalClass) addEdgeToSubGraph(enterNode, graph.enterNode) if (!isLocalClass) addEdgeToSubGraph(enterNode, graph.enterNode)
addEdgeToSubGraph(delegatedConstructorCall, delegatedConstructorEnter, label = edgeLabel) addEdgeToSubGraph(delegatedConstructorCall, delegatedEnter, label = edgeLabel)
for (node in followingNodes) { for (node in followingNodes) {
addEdge(delegatedConstructorExit, node, preferredKind = EdgeKind.CfgForward, label = edgeLabel) addEdge(delegatedExit, node, preferredKind = EdgeKind.CfgForward, label = edgeLabel)
addEdge(delegatedConstructorCall, node, preferredKind = EdgeKind.DfgForward) addEdge(delegatedConstructorCall, node, preferredKind = EdgeKind.DfgForward)
} }
} else if (lastInPlaceExit !== enterNode || lastInPlaceExit.previousNodes.isEmpty()) { } else if (lastInPlaceExit !== enterNode || lastInPlaceExit.previousNodes.isEmpty()) {
@@ -591,7 +631,7 @@ class ControlFlowGraphBuilder {
addEdge(graph.exitNode, exitNode, preferredKind = if (exitNode.isUnion) EdgeKind.Forward else EdgeKind.CfgForward) addEdge(graph.exitNode, exitNode, preferredKind = if (exitNode.isUnion) EdgeKind.Forward else EdgeKind.CfgForward)
} }
if (constructors.isEmpty()) { if (primaryConstructor == null && secondaryConstructors.isEmpty()) {
// Interfaces have no constructors, add an edge from enter to exit so that methods aren't marked as dead. // Interfaces have no constructors, add an edge from enter to exit so that methods aren't marked as dead.
addEdge(enterNode, exitNode, preferredKind = EdgeKind.CfgForward) addEdge(enterNode, exitNode, preferredKind = EdgeKind.CfgForward)
} else { } else {
@@ -605,7 +645,7 @@ class ControlFlowGraphBuilder {
addEdgeToSubGraph(exitNode, graph.enterNode) addEdgeToSubGraph(exitNode, graph.enterNode)
} }
enterNode.subGraphs = calledInPlace + constructors.values enterNode.subGraphs = calledInPlace + secondaryConstructors.values
exitNode.subGraphs = calledLater exitNode.subGraphs = calledLater
return exitNode.takeIf { it.isUnion } to popGraph() return exitNode.takeIf { it.isUnion } to popGraph()
} }
@@ -122,7 +122,19 @@ enum class EdgeKind(
DfgForward(usedInDfa = true, usedInDeadDfa = true, usedInCfa = false, isBack = false, isDead = false), DfgForward(usedInDfa = true, usedInDeadDfa = true, usedInCfa = false, isBack = false, isDead = false),
CfgForward(usedInDfa = false, usedInDeadDfa = false, usedInCfa = true, isBack = false, isDead = false), CfgForward(usedInDfa = false, usedInDeadDfa = false, usedInCfa = true, isBack = false, isDead = false),
CfgBackward(usedInDfa = false, usedInDeadDfa = false, usedInCfa = true, isBack = true, isDead = false), CfgBackward(usedInDfa = false, usedInDeadDfa = false, usedInCfa = true, isBack = true, isDead = false),
DeadBackward(usedInDfa = false, usedInDeadDfa = false, usedInCfa = true, isBack = true, isDead = true) DeadBackward(usedInDfa = false, usedInDeadDfa = false, usedInCfa = true, isBack = true, isDead = true),
;
companion object {
fun forward(usedInCfa: Boolean = false, usedInDfa: Boolean = false): EdgeKind? {
return when {
usedInCfa && usedInDfa -> Forward
usedInCfa -> CfgForward
usedInDfa -> DfgForward
else -> null
}
}
}
} }
private val CFGNode<*>.previousNodeCount private val CFGNode<*>.previousNodeCount
+124 -124
View File
@@ -51,27 +51,27 @@ digraph kt44814_kt {
12 [label="Enter class FirPsiSourceElement [2]" style="filled" fillcolor=red]; 12 [label="Enter class FirPsiSourceElement [2]" style="filled" fillcolor=red];
subgraph cluster_6 { subgraph cluster_6 {
color=blue color=blue
13 [label="Enter property [3]" style="filled" fillcolor=red]; 13 [label="Enter function <init> [3]" style="filled" fillcolor=red];
14 [label="Access variable R|<local>/psi| [3]"]; 14 [label="Delegated constructor call: super<R|FirSourceElement|>() [3]" style="filled" fillcolor=yellow];
15 [label="Exit property [3]" style="filled" fillcolor=red]; 15 [label="Exit function <init> [3]" style="filled" fillcolor=red];
} }
subgraph cluster_7 { subgraph cluster_7 {
color=blue color=blue
16 [label="Enter property [3]" style="filled" fillcolor=red]; 16 [label="Enter property [3]" style="filled" fillcolor=red];
17 [label="Access variable R|<local>/lighterASTNode| [3]"]; 17 [label="Access variable R|<local>/psi| [3]"];
18 [label="Exit property [3]" style="filled" fillcolor=red]; 18 [label="Exit property [3]" style="filled" fillcolor=red];
} }
subgraph cluster_8 { subgraph cluster_8 {
color=blue color=blue
19 [label="Enter property [3]" style="filled" fillcolor=red]; 19 [label="Enter property [3]" style="filled" fillcolor=red];
20 [label="Access variable R|<local>/treeStructure| [3]"]; 20 [label="Access variable R|<local>/lighterASTNode| [3]"];
21 [label="Exit property [3]" style="filled" fillcolor=red]; 21 [label="Exit property [3]" style="filled" fillcolor=red];
} }
subgraph cluster_9 { subgraph cluster_9 {
color=blue color=blue
22 [label="Enter function <init> [3]" style="filled" fillcolor=red]; 22 [label="Enter property [3]" style="filled" fillcolor=red];
23 [label="Delegated constructor call: super<R|FirSourceElement|>() [3]" style="filled" fillcolor=yellow]; 23 [label="Access variable R|<local>/treeStructure| [3]"];
24 [label="Exit function <init> [3]" style="filled" fillcolor=red]; 24 [label="Exit property [3]" style="filled" fillcolor=red];
} }
25 [label="Exit class FirPsiSourceElement [2]" style="filled" fillcolor=red]; 25 [label="Exit class FirPsiSourceElement [2]" style="filled" fillcolor=red];
} }
@@ -96,21 +96,21 @@ digraph kt44814_kt {
26 [label="Enter class FirLightSourceElement [2]" style="filled" fillcolor=red]; 26 [label="Enter class FirLightSourceElement [2]" style="filled" fillcolor=red];
subgraph cluster_11 { subgraph cluster_11 {
color=blue color=blue
27 [label="Enter property [3]" style="filled" fillcolor=red]; 27 [label="Enter function <init> [3]" style="filled" fillcolor=red];
28 [label="Access variable R|<local>/lighterASTNode| [3]"]; 28 [label="Delegated constructor call: super<R|FirSourceElement|>() [3]" style="filled" fillcolor=yellow];
29 [label="Exit property [3]" style="filled" fillcolor=red]; 29 [label="Exit function <init> [3]" style="filled" fillcolor=red];
} }
subgraph cluster_12 { subgraph cluster_12 {
color=blue color=blue
30 [label="Enter property [3]" style="filled" fillcolor=red]; 30 [label="Enter property [3]" style="filled" fillcolor=red];
31 [label="Access variable R|<local>/treeStructure| [3]"]; 31 [label="Access variable R|<local>/lighterASTNode| [3]"];
32 [label="Exit property [3]" style="filled" fillcolor=red]; 32 [label="Exit property [3]" style="filled" fillcolor=red];
} }
subgraph cluster_13 { subgraph cluster_13 {
color=blue color=blue
33 [label="Enter function <init> [3]" style="filled" fillcolor=red]; 33 [label="Enter property [3]" style="filled" fillcolor=red];
34 [label="Delegated constructor call: super<R|FirSourceElement|>() [3]" style="filled" fillcolor=yellow]; 34 [label="Access variable R|<local>/treeStructure| [3]"];
35 [label="Exit function <init> [3]" style="filled" fillcolor=red]; 35 [label="Exit property [3]" style="filled" fillcolor=red];
} }
36 [label="Exit class FirLightSourceElement [2]" style="filled" fillcolor=red]; 36 [label="Exit class FirLightSourceElement [2]" style="filled" fillcolor=red];
} }
@@ -168,55 +168,55 @@ digraph kt44814_kt {
47 [label="Enter class LighterASTNode [2]" style="filled" fillcolor=red]; 47 [label="Enter class LighterASTNode [2]" style="filled" fillcolor=red];
subgraph cluster_19 { subgraph cluster_19 {
color=blue color=blue
48 [label="Enter property [3]" style="filled" fillcolor=red]; 48 [label="Enter function <init> [3]" style="filled" fillcolor=red];
49 [label="Access variable R|<local>/_children| [3]"]; 49 [label="Enter default value of _children [3]"];
50 [label="Exit property [3]" style="filled" fillcolor=red]; subgraph cluster_20 {
}
subgraph cluster_20 {
color=blue
51 [label="Enter property [3]" style="filled" fillcolor=red];
52 [label="Access qualifier /TokenType [3]"];
53 [label="Access variable R|/TokenType.Companion.MODIFIER_LIST| [3]"];
54 [label="Exit property [3]" style="filled" fillcolor=red];
}
subgraph cluster_21 {
color=blue
55 [label="Enter function <init> [3]" style="filled" fillcolor=red];
56 [label="Enter default value of _children [3]"];
subgraph cluster_22 {
color=blue color=blue
57 [label="Enter default value of _children [4]" style="filled" fillcolor=red]; 50 [label="Enter default value of _children [4]" style="filled" fillcolor=red];
subgraph cluster_23 { subgraph cluster_21 {
color=blue color=blue
58 [label="Function call arguments enter [4]"]; 51 [label="Function call arguments enter [4]"];
59 [label="Function call arguments exit [4]"]; 52 [label="Function call arguments exit [4]"];
} }
60 [label="Function call: R|kotlin/collections/emptyList|<R|LighterASTNode?|>() [4]" style="filled" fillcolor=yellow]; 53 [label="Function call: R|kotlin/collections/emptyList|<R|LighterASTNode?|>() [4]" style="filled" fillcolor=yellow];
61 [label="Exit default value of _children [4]" style="filled" fillcolor=red]; 54 [label="Exit default value of _children [4]" style="filled" fillcolor=red];
} }
62 [label="Exit default value of _children [3]"]; 55 [label="Exit default value of _children [3]"];
63 [label="Delegated constructor call: super<R|kotlin/Any|>() [3]" style="filled" fillcolor=yellow]; 56 [label="Delegated constructor call: super<R|kotlin/Any|>() [3]" style="filled" fillcolor=yellow];
64 [label="Exit function <init> [3]" style="filled" fillcolor=red]; 57 [label="Exit function <init> [3]" style="filled" fillcolor=red];
}
subgraph cluster_22 {
color=blue
58 [label="Enter property [3]" style="filled" fillcolor=red];
59 [label="Access variable R|<local>/_children| [3]"];
60 [label="Exit property [3]" style="filled" fillcolor=red];
}
subgraph cluster_23 {
color=blue
61 [label="Enter property [3]" style="filled" fillcolor=red];
62 [label="Access qualifier /TokenType [3]"];
63 [label="Access variable R|/TokenType.Companion.MODIFIER_LIST| [3]"];
64 [label="Exit property [3]" style="filled" fillcolor=red];
} }
65 [label="Exit class LighterASTNode [2]" style="filled" fillcolor=red]; 65 [label="Exit class LighterASTNode [2]" style="filled" fillcolor=red];
} }
47 -> {48} [color=green]; 47 -> {48} [color=green];
47 -> {65} [style=dotted]; 47 -> {65} [style=dotted];
47 -> {48 51 55} [style=dashed]; 47 -> {48 58 61} [style=dashed];
48 -> {49}; 48 -> {49};
49 -> {50}; 49 -> {50 55};
50 -> {51} [color=green]; 49 -> {50} [style=dashed];
50 -> {51};
51 -> {52}; 51 -> {52};
52 -> {53}; 52 -> {53};
53 -> {54}; 53 -> {54};
54 -> {55} [color=green]; 54 -> {55};
55 -> {56}; 55 -> {56};
56 -> {57 62}; 56 -> {57};
56 -> {57} [style=dashed]; 57 -> {58} [color=green];
57 -> {58};
58 -> {59}; 58 -> {59};
59 -> {60}; 59 -> {60};
60 -> {61}; 60 -> {61} [color=green];
61 -> {62}; 61 -> {62};
62 -> {63}; 62 -> {63};
63 -> {64}; 63 -> {64};
@@ -266,31 +266,31 @@ digraph kt44814_kt {
78 [label="Enter class Companion [3]" style="filled" fillcolor=red]; 78 [label="Enter class Companion [3]" style="filled" fillcolor=red];
subgraph cluster_29 { subgraph cluster_29 {
color=blue color=blue
79 [label="Enter property [4]" style="filled" fillcolor=red]; 79 [label="Enter function <init> [4]" style="filled" fillcolor=red];
subgraph cluster_30 { 80 [label="Delegated constructor call: super<R|kotlin/Any|>() [4]" style="filled" fillcolor=yellow];
color=blue 81 [label="Exit function <init> [4]" style="filled" fillcolor=red];
80 [label="Function call arguments enter [4]"];
81 [label="Function call arguments exit [4]"];
}
82 [label="Function call: R|/TokenType.TokenType|() [4]" style="filled" fillcolor=yellow];
83 [label="Exit property [4]" style="filled" fillcolor=red];
} }
subgraph cluster_31 { subgraph cluster_30 {
color=blue color=blue
84 [label="Enter function <init> [4]" style="filled" fillcolor=red]; 82 [label="Enter property [4]" style="filled" fillcolor=red];
85 [label="Delegated constructor call: super<R|kotlin/Any|>() [4]" style="filled" fillcolor=yellow]; subgraph cluster_31 {
86 [label="Exit function <init> [4]" style="filled" fillcolor=red]; color=blue
83 [label="Function call arguments enter [4]"];
84 [label="Function call arguments exit [4]"];
}
85 [label="Function call: R|/TokenType.TokenType|() [4]" style="filled" fillcolor=yellow];
86 [label="Exit property [4]" style="filled" fillcolor=red];
} }
87 [label="Exit class Companion [3]" style="filled" fillcolor=red]; 87 [label="Exit class Companion [3]" style="filled" fillcolor=red];
} }
78 -> {79} [color=green]; 78 -> {79} [color=green];
78 -> {87} [style=dotted]; 78 -> {87} [style=dotted];
78 -> {79 84} [style=dashed]; 78 -> {79 82} [style=dashed];
79 -> {80}; 79 -> {80};
80 -> {81}; 80 -> {81};
81 -> {82}; 81 -> {82} [color=green];
82 -> {83}; 82 -> {83};
83 -> {84} [color=green]; 83 -> {84};
84 -> {85}; 84 -> {85};
85 -> {86}; 85 -> {86};
86 -> {87} [color=green]; 86 -> {87} [color=green];
@@ -336,31 +336,31 @@ digraph kt44814_kt {
98 [label="Enter class KtModifierListOwner [2]" style="filled" fillcolor=red]; 98 [label="Enter class KtModifierListOwner [2]" style="filled" fillcolor=red];
subgraph cluster_37 { subgraph cluster_37 {
color=blue color=blue
99 [label="Enter property [3]" style="filled" fillcolor=red]; 99 [label="Enter function <init> [3]" style="filled" fillcolor=red];
subgraph cluster_38 { 100 [label="Delegated constructor call: super<R|PsiElement|>() [3]" style="filled" fillcolor=yellow];
color=blue 101 [label="Exit function <init> [3]" style="filled" fillcolor=red];
100 [label="Function call arguments enter [3]"];
101 [label="Function call arguments exit [3]"];
}
102 [label="Function call: R|/KtModifierList.KtModifierList|() [3]" style="filled" fillcolor=yellow];
103 [label="Exit property [3]" style="filled" fillcolor=red];
} }
subgraph cluster_39 { subgraph cluster_38 {
color=blue color=blue
104 [label="Enter function <init> [3]" style="filled" fillcolor=red]; 102 [label="Enter property [3]" style="filled" fillcolor=red];
105 [label="Delegated constructor call: super<R|PsiElement|>() [3]" style="filled" fillcolor=yellow]; subgraph cluster_39 {
106 [label="Exit function <init> [3]" style="filled" fillcolor=red]; color=blue
103 [label="Function call arguments enter [3]"];
104 [label="Function call arguments exit [3]"];
}
105 [label="Function call: R|/KtModifierList.KtModifierList|() [3]" style="filled" fillcolor=yellow];
106 [label="Exit property [3]" style="filled" fillcolor=red];
} }
107 [label="Exit class KtModifierListOwner [2]" style="filled" fillcolor=red]; 107 [label="Exit class KtModifierListOwner [2]" style="filled" fillcolor=red];
} }
98 -> {99} [color=green]; 98 -> {99} [color=green];
98 -> {107} [style=dotted]; 98 -> {107} [style=dotted];
98 -> {99 104} [style=dashed]; 98 -> {99 102} [style=dashed];
99 -> {100}; 99 -> {100};
100 -> {101}; 100 -> {101};
101 -> {102}; 101 -> {102} [color=green];
102 -> {103}; 102 -> {103};
103 -> {104} [color=green]; 103 -> {104};
104 -> {105}; 104 -> {105};
105 -> {106}; 105 -> {106};
106 -> {107} [color=green]; 106 -> {107} [color=green];
@@ -370,21 +370,21 @@ digraph kt44814_kt {
108 [label="Enter class FirModifier [2]" style="filled" fillcolor=red]; 108 [label="Enter class FirModifier [2]" style="filled" fillcolor=red];
subgraph cluster_41 { subgraph cluster_41 {
color=blue color=blue
109 [label="Enter property [3]" style="filled" fillcolor=red]; 109 [label="Enter function <init> [3]" style="filled" fillcolor=red];
110 [label="Access variable R|<local>/node| [3]"]; 110 [label="Delegated constructor call: super<R|kotlin/Any|>() [3]" style="filled" fillcolor=yellow];
111 [label="Exit property [3]" style="filled" fillcolor=red]; 111 [label="Exit function <init> [3]" style="filled" fillcolor=red];
} }
subgraph cluster_42 { subgraph cluster_42 {
color=blue color=blue
112 [label="Enter property [3]" style="filled" fillcolor=red]; 112 [label="Enter property [3]" style="filled" fillcolor=red];
113 [label="Access variable R|<local>/token| [3]"]; 113 [label="Access variable R|<local>/node| [3]"];
114 [label="Exit property [3]" style="filled" fillcolor=red]; 114 [label="Exit property [3]" style="filled" fillcolor=red];
} }
subgraph cluster_43 { subgraph cluster_43 {
color=blue color=blue
115 [label="Enter function <init> [3]" style="filled" fillcolor=red]; 115 [label="Enter property [3]" style="filled" fillcolor=red];
116 [label="Delegated constructor call: super<R|kotlin/Any|>() [3]" style="filled" fillcolor=yellow]; 116 [label="Access variable R|<local>/token| [3]"];
117 [label="Exit function <init> [3]" style="filled" fillcolor=red]; 117 [label="Exit property [3]" style="filled" fillcolor=red];
} }
118 [label="Exit class FirModifier [2]" style="filled" fillcolor=red]; 118 [label="Exit class FirModifier [2]" style="filled" fillcolor=red];
} }
@@ -428,28 +428,28 @@ digraph kt44814_kt {
126 [label="Enter class FirLightModifier [3]" style="filled" fillcolor=red]; 126 [label="Enter class FirLightModifier [3]" style="filled" fillcolor=red];
subgraph cluster_47 { subgraph cluster_47 {
color=blue color=blue
127 [label="Enter property [4]" style="filled" fillcolor=red]; 127 [label="Enter function <init> [4]" style="filled" fillcolor=red];
128 [label="Access variable R|<local>/tree| [4]"]; 128 [label="Access variable R|<local>/node| [4]"];
129 [label="Exit property [4]" style="filled" fillcolor=red]; 129 [label="Access variable R|<local>/token| [4]"];
130 [label="Delegated constructor call: super<R|FirModifier<LighterASTNode>|>(...) [4]" style="filled" fillcolor=yellow];
131 [label="Exit function <init> [4]" style="filled" fillcolor=red];
} }
subgraph cluster_48 { subgraph cluster_48 {
color=blue color=blue
130 [label="Enter function <init> [4]" style="filled" fillcolor=red]; 132 [label="Enter property [4]" style="filled" fillcolor=red];
131 [label="Access variable R|<local>/node| [4]"]; 133 [label="Access variable R|<local>/tree| [4]"];
132 [label="Access variable R|<local>/token| [4]"]; 134 [label="Exit property [4]" style="filled" fillcolor=red];
133 [label="Delegated constructor call: super<R|FirModifier<LighterASTNode>|>(...) [4]" style="filled" fillcolor=yellow];
134 [label="Exit function <init> [4]" style="filled" fillcolor=red];
} }
135 [label="Exit class FirLightModifier [3]" style="filled" fillcolor=red]; 135 [label="Exit class FirLightModifier [3]" style="filled" fillcolor=red];
} }
126 -> {127} [color=green]; 126 -> {127} [color=green];
126 -> {135} [style=dotted]; 126 -> {135} [style=dotted];
126 -> {127 130} [style=dashed]; 126 -> {127 132} [style=dashed];
127 -> {128}; 127 -> {128};
128 -> {129}; 128 -> {129};
129 -> {130} [color=green]; 129 -> {130};
130 -> {131}; 130 -> {131};
131 -> {132}; 131 -> {132} [color=green];
132 -> {133}; 132 -> {133};
133 -> {134}; 133 -> {134};
134 -> {135} [color=green]; 134 -> {135} [color=green];
@@ -459,31 +459,31 @@ digraph kt44814_kt {
136 [label="Enter class FirModifierList [2]" style="filled" fillcolor=red]; 136 [label="Enter class FirModifierList [2]" style="filled" fillcolor=red];
subgraph cluster_50 { subgraph cluster_50 {
color=blue color=blue
137 [label="Enter property [3]" style="filled" fillcolor=red]; 137 [label="Enter function <init> [3]" style="filled" fillcolor=red];
subgraph cluster_51 { 138 [label="Delegated constructor call: super<R|kotlin/Any|>() [3]" style="filled" fillcolor=yellow];
color=blue 139 [label="Exit function <init> [3]" style="filled" fillcolor=red];
138 [label="Function call arguments enter [3]"];
139 [label="Function call arguments exit [3]"];
}
140 [label="Function call: R|kotlin/collections/emptyList|<R|FirModifier<*>|>() [3]" style="filled" fillcolor=yellow];
141 [label="Exit property [3]" style="filled" fillcolor=red];
} }
subgraph cluster_52 { subgraph cluster_51 {
color=blue color=blue
142 [label="Enter function <init> [3]" style="filled" fillcolor=red]; 140 [label="Enter property [3]" style="filled" fillcolor=red];
143 [label="Delegated constructor call: super<R|kotlin/Any|>() [3]" style="filled" fillcolor=yellow]; subgraph cluster_52 {
144 [label="Exit function <init> [3]" style="filled" fillcolor=red]; color=blue
141 [label="Function call arguments enter [3]"];
142 [label="Function call arguments exit [3]"];
}
143 [label="Function call: R|kotlin/collections/emptyList|<R|FirModifier<*>|>() [3]" style="filled" fillcolor=yellow];
144 [label="Exit property [3]" style="filled" fillcolor=red];
} }
145 [label="Exit class FirModifierList [2]" style="filled" fillcolor=red]; 145 [label="Exit class FirModifierList [2]" style="filled" fillcolor=red];
} }
136 -> {137} [color=green]; 136 -> {137} [color=green];
136 -> {145} [style=dotted]; 136 -> {145} [style=dotted];
136 -> {137 142} [style=dashed]; 136 -> {137 140} [style=dashed];
137 -> {138}; 137 -> {138};
138 -> {139}; 138 -> {139};
139 -> {140}; 139 -> {140} [color=green];
140 -> {141}; 140 -> {141};
141 -> {142} [color=green]; 141 -> {142};
142 -> {143}; 142 -> {143};
143 -> {144}; 143 -> {144};
144 -> {145} [color=green]; 144 -> {145} [color=green];
@@ -493,15 +493,15 @@ digraph kt44814_kt {
146 [label="Enter class FirPsiModifierList [3]" style="filled" fillcolor=red]; 146 [label="Enter class FirPsiModifierList [3]" style="filled" fillcolor=red];
subgraph cluster_54 { subgraph cluster_54 {
color=blue color=blue
147 [label="Enter property [4]" style="filled" fillcolor=red]; 147 [label="Enter function <init> [4]" style="filled" fillcolor=red];
148 [label="Access variable R|<local>/modifierList| [4]"]; 148 [label="Delegated constructor call: super<R|FirModifierList|>() [4]" style="filled" fillcolor=yellow];
149 [label="Exit property [4]" style="filled" fillcolor=red]; 149 [label="Exit function <init> [4]" style="filled" fillcolor=red];
} }
subgraph cluster_55 { subgraph cluster_55 {
color=blue color=blue
150 [label="Enter function <init> [4]" style="filled" fillcolor=red]; 150 [label="Enter property [4]" style="filled" fillcolor=red];
151 [label="Delegated constructor call: super<R|FirModifierList|>() [4]" style="filled" fillcolor=yellow]; 151 [label="Access variable R|<local>/modifierList| [4]"];
152 [label="Exit function <init> [4]" style="filled" fillcolor=red]; 152 [label="Exit property [4]" style="filled" fillcolor=red];
} }
153 [label="Exit class FirPsiModifierList [3]" style="filled" fillcolor=red]; 153 [label="Exit class FirPsiModifierList [3]" style="filled" fillcolor=red];
} }
@@ -520,21 +520,21 @@ digraph kt44814_kt {
154 [label="Enter class FirLightModifierList [3]" style="filled" fillcolor=red]; 154 [label="Enter class FirLightModifierList [3]" style="filled" fillcolor=red];
subgraph cluster_57 { subgraph cluster_57 {
color=blue color=blue
155 [label="Enter property [4]" style="filled" fillcolor=red]; 155 [label="Enter function <init> [4]" style="filled" fillcolor=red];
156 [label="Access variable R|<local>/modifierList| [4]"]; 156 [label="Delegated constructor call: super<R|FirModifierList|>() [4]" style="filled" fillcolor=yellow];
157 [label="Exit property [4]" style="filled" fillcolor=red]; 157 [label="Exit function <init> [4]" style="filled" fillcolor=red];
} }
subgraph cluster_58 { subgraph cluster_58 {
color=blue color=blue
158 [label="Enter property [4]" style="filled" fillcolor=red]; 158 [label="Enter property [4]" style="filled" fillcolor=red];
159 [label="Access variable R|<local>/tree| [4]"]; 159 [label="Access variable R|<local>/modifierList| [4]"];
160 [label="Exit property [4]" style="filled" fillcolor=red]; 160 [label="Exit property [4]" style="filled" fillcolor=red];
} }
subgraph cluster_59 { subgraph cluster_59 {
color=blue color=blue
161 [label="Enter function <init> [4]" style="filled" fillcolor=red]; 161 [label="Enter property [4]" style="filled" fillcolor=red];
162 [label="Delegated constructor call: super<R|FirModifierList|>() [4]" style="filled" fillcolor=yellow]; 162 [label="Access variable R|<local>/tree| [4]"];
163 [label="Exit function <init> [4]" style="filled" fillcolor=red]; 163 [label="Exit property [4]" style="filled" fillcolor=red];
} }
164 [label="Exit class FirLightModifierList [3]" style="filled" fillcolor=red]; 164 [label="Exit class FirLightModifierList [3]" style="filled" fillcolor=red];
} }
@@ -3,6 +3,6 @@ open class A(val a: Any) {
override fun toString() = a.toString() override fun toString() = a.toString()
} }
object B : A(B.foo) { // call B.foo should be not-allowed object B : A(<!UNINITIALIZED_VARIABLE!>B.foo<!>) { // call B.foo should be not-allowed
val foo = 4 val foo = 4
} }
@@ -2,8 +2,8 @@
fun error(): Nothing = throw Exception() fun error(): Nothing = throw Exception()
class Some<!UNREACHABLE_CODE!>()<!> { class Some() {
var x: Int <!MUST_BE_INITIALIZED_OR_BE_ABSTRACT!>var x: Int<!>
val y: Int = error() val y: Int = error()
init { init {
@@ -1,222 +0,0 @@
fun foo(): Int = 42
object ThrowInTryWithCatch {
private val p: String
init {
try {
throw Exception()
} catch (e: Exception) {
}
p = "OK"
}
}
object ThrowInTryWithCatchAndFinally {
private val p: String
init {
try {
throw Exception()
} catch (e: Exception) {
} finally {
}
p = "OK"
}
}
object ThrowInFinally {
private val p: String
init {
try {
foo()
} catch (e: Exception) {
} finally {
throw Exception()
}
p = "OK"
}
}
object RethrowInCatch {
private val p: String
init {
try {
foo()
} catch (e: Exception) {
throw e
}
p = "OK"
}
}
object RethrowInCatchWithFinally {
private val p: String
init {
try {
foo()
} catch (e: Exception) {
throw e
} finally {
}
p = "OK"
}
}
object InnerTryWithCatch {
private val p: String
init {
try {
foo()
} catch (e: Exception) {
try {
throw e
} catch (ee: Exception) {
}
}
p = "OK"
}
}
object InnerTryWithFinally {
private val p: String
init {
try {
foo()
} catch (e: Exception) {
try {
throw e
} finally {
}
}
p = "OK"
}
}
object InnerTryWithCatchAndFinally {
private val p: String
init {
try {
foo()
} catch (e: Exception) {
try {
throw e
} catch (ee: Exception) {
} finally {
}
}
p = "OK"
}
}
object InnerCatch {
private val p: String
init {
try {
foo()
} catch (e: Exception) {
try {
foo()
} catch (ee: Exception) {
throw ee
}
}
p = "OK"
}
}
object InnerCatchWithFinally {
private val p: String
init {
try {
foo()
} catch (e: Exception) {
try {
foo()
} catch (ee: Exception) {
throw ee
} finally {
}
}
p = "OK"
}
}
object InnerCatchOuterRethrow {
private val p: String
init {
try {
foo()
} catch (e: Exception) {
try {
foo()
} catch (ee: Exception) {
throw e
}
}
p = "OK"
}
}
object InnerCatchOuterRethrowWithFinally {
private val p: String
init {
try {
foo()
} catch (e: Exception) {
try {
foo()
} catch (ee: Exception) {
throw e
} finally {
}
}
p = "OK"
}
}
object InnerFinally {
private val p: String
init {
try {
foo()
} catch (e: Exception) {
try {
foo()
} finally {
throw e
}
}
p = "OK"
}
}
object InnerFinallyWithCatch {
private val p: String
init {
try {
foo()
} catch (e: Exception) {
try {
foo()
} catch (ee: Exception) {
} finally {
throw e
}
}
p = "OK"
}
}
@@ -1,3 +1,5 @@
// FIR_IDENTICAL
fun foo(): Int = 42 fun foo(): Int = 42
object ThrowInTryWithCatch { object ThrowInTryWithCatch {
@@ -121,35 +121,35 @@ digraph NestedInnerClass_fir_kts {
35 [label="Enter class Inner [3]" style="filled" fillcolor=red]; 35 [label="Enter class Inner [3]" style="filled" fillcolor=red];
subgraph cluster_13 { subgraph cluster_13 {
color=blue color=blue
36 [label="Enter property [4]" style="filled" fillcolor=red]; 36 [label="Enter function <init> [4]" style="filled" fillcolor=red];
37 [label="Access variable R|/property| [4]"]; 37 [label="Delegated constructor call: super<R|kotlin/Any|>() [4]" style="filled" fillcolor=yellow];
38 [label="Exit property [4]" style="filled" fillcolor=red]; 38 [label="Exit function <init> [4]" style="filled" fillcolor=red];
} }
subgraph cluster_14 { subgraph cluster_14 {
color=blue color=blue
39 [label="Enter property [4]" style="filled" fillcolor=red]; 39 [label="Enter property [4]" style="filled" fillcolor=red];
40 [label="Access variable this@NestedInnerClass# [4]"]; 40 [label="Access variable R|/property| [4]"];
41 [label="Access variable <Unresolved name: property># [4]"]; 41 [label="Exit property [4]" style="filled" fillcolor=red];
42 [label="Exit property [4]" style="filled" fillcolor=red];
} }
subgraph cluster_15 { subgraph cluster_15 {
color=blue color=blue
43 [label="Enter function <init> [4]" style="filled" fillcolor=red]; 42 [label="Enter property [4]" style="filled" fillcolor=red];
44 [label="Delegated constructor call: super<R|kotlin/Any|>() [4]" style="filled" fillcolor=yellow]; 43 [label="Access variable this@NestedInnerClass# [4]"];
45 [label="Exit function <init> [4]" style="filled" fillcolor=red]; 44 [label="Access variable <Unresolved name: property># [4]"];
45 [label="Exit property [4]" style="filled" fillcolor=red];
} }
46 [label="Exit class Inner [3]" style="filled" fillcolor=red]; 46 [label="Exit class Inner [3]" style="filled" fillcolor=red];
} }
35 -> {36} [color=green]; 35 -> {36} [color=green];
35 -> {46} [style=dotted]; 35 -> {46} [style=dotted];
35 -> {36 39 43} [style=dashed]; 35 -> {36 39 42} [style=dashed];
36 -> {37}; 36 -> {37};
37 -> {38}; 37 -> {38};
38 -> {39} [color=green]; 38 -> {39} [color=green];
39 -> {40}; 39 -> {40};
40 -> {41}; 40 -> {41};
41 -> {42}; 41 -> {42} [color=green];
42 -> {43} [color=green]; 42 -> {43};
43 -> {44}; 43 -> {44};
44 -> {45}; 44 -> {45};
45 -> {46} [color=green]; 45 -> {46} [color=green];
@@ -121,35 +121,35 @@ digraph NestedInnerClass_ll_kts {
35 [label="Enter class Inner [3]" style="filled" fillcolor=red]; 35 [label="Enter class Inner [3]" style="filled" fillcolor=red];
subgraph cluster_13 { subgraph cluster_13 {
color=blue color=blue
36 [label="Enter property [4]" style="filled" fillcolor=red]; 36 [label="Enter function <init> [4]" style="filled" fillcolor=red];
37 [label="Access variable R|/property| [4]"]; 37 [label="Delegated constructor call: super<R|kotlin/Any|>() [4]" style="filled" fillcolor=yellow];
38 [label="Exit property [4]" style="filled" fillcolor=red]; 38 [label="Exit function <init> [4]" style="filled" fillcolor=red];
} }
subgraph cluster_14 { subgraph cluster_14 {
color=blue color=blue
39 [label="Enter property [4]" style="filled" fillcolor=red]; 39 [label="Enter property [4]" style="filled" fillcolor=red];
40 [label="Access variable this@NestedInnerClass# [4]"]; 40 [label="Access variable R|/property| [4]"];
41 [label="Access variable <Unresolved name: property># [4]"]; 41 [label="Exit property [4]" style="filled" fillcolor=red];
42 [label="Exit property [4]" style="filled" fillcolor=red];
} }
subgraph cluster_15 { subgraph cluster_15 {
color=blue color=blue
43 [label="Enter function <init> [4]" style="filled" fillcolor=red]; 42 [label="Enter property [4]" style="filled" fillcolor=red];
44 [label="Delegated constructor call: super<R|kotlin/Any|>() [4]" style="filled" fillcolor=yellow]; 43 [label="Access variable this@NestedInnerClass# [4]"];
45 [label="Exit function <init> [4]" style="filled" fillcolor=red]; 44 [label="Access variable <Unresolved name: property># [4]"];
45 [label="Exit property [4]" style="filled" fillcolor=red];
} }
46 [label="Exit class Inner [3]" style="filled" fillcolor=red]; 46 [label="Exit class Inner [3]" style="filled" fillcolor=red];
} }
35 -> {36} [color=green]; 35 -> {36} [color=green];
35 -> {46} [style=dotted]; 35 -> {46} [style=dotted];
35 -> {36 39 43} [style=dashed]; 35 -> {36 39 42} [style=dashed];
36 -> {37}; 36 -> {37};
37 -> {38}; 37 -> {38};
38 -> {39} [color=green]; 38 -> {39} [color=green];
39 -> {40}; 39 -> {40};
40 -> {41}; 40 -> {41};
41 -> {42}; 41 -> {42} [color=green];
42 -> {43} [color=green]; 42 -> {43};
43 -> {44}; 43 -> {44};
44 -> {45}; 44 -> {45};
45 -> {46} [color=green]; 45 -> {46} [color=green];