FIR. Refactor smart-cast representation in FIR tree

Make smart-casts non-transparent expression without delegation
to underlying FirQualifiedAccessExpression, as children delegation in
fir tree has unclear semantics
Remove two different kinds of tree nodes for smart-casts
This commit is contained in:
Simon Ogorodnik
2022-08-02 00:49:24 +02:00
committed by teamcity
parent bc9db58b3c
commit 513af2dfbc
154 changed files with 9573 additions and 9320 deletions
+120 -116
View File
@@ -48,10 +48,11 @@ digraph lambdas_kt {
color=blue
24 [label="Enter block"];
25 [label="Access variable R|<local>/x|"];
26 [label="Function call: R|<local>/x|.R|kotlin/Int.inc|()"];
27 [label="Exit block"];
26 [label="Smart cast: R|<local>/x|"];
27 [label="Function call: R|<local>/x|.R|kotlin/Int.inc|()"];
28 [label="Exit block"];
}
28 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
29 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
}
16 [label="Postponed exit from lambda"];
17 [label="Function call: R|/run|(...)"];
@@ -82,208 +83,211 @@ digraph lambdas_kt {
19 -> {20};
20 -> {21};
21 -> {22};
23 -> {28 24};
23 -> {29 24};
24 -> {25};
25 -> {26};
26 -> {27};
27 -> {28};
28 -> {16};
28 -> {23} [color=green style=dashed];
28 -> {29};
29 -> {16};
29 -> {23} [color=green style=dashed];
subgraph cluster_9 {
color=red
29 [label="Enter function test_2" style="filled" fillcolor=red];
30 [label="Enter function test_2" style="filled" fillcolor=red];
subgraph cluster_10 {
color=blue
30 [label="Enter block"];
31 [label="Enter block"];
subgraph cluster_11 {
color=blue
31 [label="Enter when"];
32 [label="Enter when"];
subgraph cluster_12 {
color=blue
32 [label="Enter when branch condition "];
33 [label="Access variable R|<local>/x|"];
34 [label="Type operator: (R|<local>/x| is R|kotlin/Int|)"];
35 [label="Exit when branch condition"];
33 [label="Enter when branch condition "];
34 [label="Access variable R|<local>/x|"];
35 [label="Type operator: (R|<local>/x| is R|kotlin/Int|)"];
36 [label="Exit when branch condition"];
}
36 [label="Synthetic else branch"];
37 [label="Enter when branch result"];
37 [label="Synthetic else branch"];
38 [label="Enter when branch result"];
subgraph cluster_13 {
color=blue
38 [label="Enter block"];
39 [label="Postponed enter to lambda"];
39 [label="Enter block"];
40 [label="Postponed enter to lambda"];
subgraph cluster_14 {
color=blue
48 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
49 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
subgraph cluster_15 {
color=blue
49 [label="Enter block"];
50 [label="Access variable R|<local>/x|"];
51 [label="Function call: R|<local>/x|.R|kotlin/Int.inc|()"];
52 [label="Exit block"];
50 [label="Enter block"];
51 [label="Access variable R|<local>/x|"];
52 [label="Smart cast: R|<local>/x|"];
53 [label="Function call: R|<local>/x|.R|kotlin/Int.inc|()"];
54 [label="Exit block"];
}
53 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
55 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
}
40 [label="Postponed exit from lambda"];
41 [label="Exit anonymous function expression"];
42 [label="Variable declaration: lval lambda: R|() -> kotlin/Int|"];
43 [label="Exit block"];
41 [label="Postponed exit from lambda"];
42 [label="Exit anonymous function expression"];
43 [label="Variable declaration: lval lambda: R|() -> kotlin/Int|"];
44 [label="Exit block"];
}
44 [label="Exit when branch result"];
45 [label="Exit when"];
45 [label="Exit when branch result"];
46 [label="Exit when"];
}
46 [label="Exit block"];
47 [label="Exit block"];
}
47 [label="Exit function test_2" style="filled" fillcolor=red];
48 [label="Exit function test_2" style="filled" fillcolor=red];
}
29 -> {30};
30 -> {31};
31 -> {32};
32 -> {33};
33 -> {34};
34 -> {35};
35 -> {37 36};
36 -> {45};
37 -> {38};
35 -> {36};
36 -> {38 37};
37 -> {46};
38 -> {39};
39 -> {40 48};
39 -> {48} [style=dashed];
40 -> {41};
39 -> {40};
40 -> {41 49};
40 -> {49} [style=dashed];
41 -> {42};
42 -> {43};
43 -> {44};
44 -> {45};
45 -> {46};
46 -> {47};
48 -> {49};
47 -> {48};
49 -> {50};
50 -> {51};
51 -> {52};
52 -> {53};
53 -> {54};
54 -> {55};
subgraph cluster_16 {
color=red
54 [label="Enter function getInt" style="filled" fillcolor=red];
56 [label="Enter function getInt" style="filled" fillcolor=red];
subgraph cluster_17 {
color=blue
55 [label="Enter block"];
56 [label="Function call: R|<local>/block|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()"];
57 [label="Const: Int(1)"];
58 [label="Jump: ^getInt Int(1)"];
59 [label="Stub" style="filled" fillcolor=gray];
60 [label="Exit block" style="filled" fillcolor=gray];
57 [label="Enter block"];
58 [label="Function call: R|<local>/block|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()"];
59 [label="Const: Int(1)"];
60 [label="Jump: ^getInt Int(1)"];
61 [label="Stub" style="filled" fillcolor=gray];
62 [label="Exit block" style="filled" fillcolor=gray];
}
61 [label="Exit function getInt" style="filled" fillcolor=red];
63 [label="Exit function getInt" style="filled" fillcolor=red];
}
54 -> {55};
55 -> {56};
56 -> {57};
57 -> {58};
58 -> {61};
58 -> {59} [style=dotted];
59 -> {60} [style=dotted];
58 -> {59};
59 -> {60};
60 -> {63};
60 -> {61} [style=dotted];
61 -> {62} [style=dotted];
62 -> {63} [style=dotted];
subgraph cluster_18 {
color=red
62 [label="Enter function test_3" style="filled" fillcolor=red];
64 [label="Enter function test_3" style="filled" fillcolor=red];
subgraph cluster_19 {
color=blue
63 [label="Enter block"];
64 [label="Postponed enter to lambda"];
65 [label="Enter block"];
66 [label="Postponed enter to lambda"];
subgraph cluster_20 {
color=blue
71 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
73 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
subgraph cluster_21 {
color=blue
72 [label="Enter block"];
73 [label="Const: Int(1)"];
74 [label="Jump: ^test_3 Int(1)"];
75 [label="Stub" style="filled" fillcolor=gray];
76 [label="Exit block" style="filled" fillcolor=gray];
74 [label="Enter block"];
75 [label="Const: Int(1)"];
76 [label="Jump: ^test_3 Int(1)"];
77 [label="Stub" style="filled" fillcolor=gray];
78 [label="Exit block" style="filled" fillcolor=gray];
}
77 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
79 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
}
65 [label="Postponed exit from lambda"];
66 [label="Function call: R|/getInt|(...)"];
67 [label="Jump: ^test_3 R|/getInt|(<L> = getInt@fun <anonymous>(): R|kotlin/Unit| <inline=Inline, kind=UNKNOWN> {
67 [label="Postponed exit from lambda"];
68 [label="Function call: R|/getInt|(...)"];
69 [label="Jump: ^test_3 R|/getInt|(<L> = getInt@fun <anonymous>(): R|kotlin/Unit| <inline=Inline, kind=UNKNOWN> {
^test_3 Int(1)
}
)"];
68 [label="Stub" style="filled" fillcolor=gray];
69 [label="Exit block" style="filled" fillcolor=gray];
70 [label="Stub" style="filled" fillcolor=gray];
71 [label="Exit block" style="filled" fillcolor=gray];
}
70 [label="Exit function test_3" style="filled" fillcolor=red];
72 [label="Exit function test_3" style="filled" fillcolor=red];
}
62 -> {63};
63 -> {64};
64 -> {65 71};
64 -> {71} [style=dashed];
64 -> {65};
65 -> {66};
66 -> {67};
67 -> {70};
67 -> {68} [style=dotted];
68 -> {69} [style=dotted];
66 -> {67 73};
66 -> {73} [style=dashed];
67 -> {68};
68 -> {69};
69 -> {72};
69 -> {70} [style=dotted];
71 -> {77 72};
72 -> {73};
73 -> {74};
74 -> {70};
74 -> {75} [style=dotted];
75 -> {76} [style=dotted];
70 -> {71} [style=dotted];
71 -> {72} [style=dotted];
73 -> {79 74};
74 -> {75};
75 -> {76};
76 -> {72};
76 -> {77} [style=dotted];
77 -> {65};
77 -> {71} [color=green style=dashed];
77 -> {78} [style=dotted];
78 -> {79} [style=dotted];
79 -> {67};
79 -> {73} [color=green style=dashed];
subgraph cluster_22 {
color=red
78 [label="Enter function test_4" style="filled" fillcolor=red];
80 [label="Enter function test_4" style="filled" fillcolor=red];
subgraph cluster_23 {
color=blue
79 [label="Enter block"];
80 [label="Postponed enter to lambda"];
81 [label="Enter block"];
82 [label="Postponed enter to lambda"];
subgraph cluster_24 {
color=blue
87 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
89 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
subgraph cluster_25 {
color=blue
88 [label="Enter block"];
89 [label="Const: Int(1)"];
90 [label="Jump: ^test_4 Int(1)"];
91 [label="Stub" style="filled" fillcolor=gray];
92 [label="Exit block" style="filled" fillcolor=gray];
90 [label="Enter block"];
91 [label="Const: Int(1)"];
92 [label="Jump: ^test_4 Int(1)"];
93 [label="Stub" style="filled" fillcolor=gray];
94 [label="Exit block" style="filled" fillcolor=gray];
}
93 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
95 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
}
81 [label="Postponed exit from lambda"];
82 [label="Function call: R|/getInt|(...)"];
83 [label="Jump: ^test_4 R|/getInt|(block = getInt@fun <anonymous>(): R|kotlin/Unit| <inline=Inline, kind=UNKNOWN> {
83 [label="Postponed exit from lambda"];
84 [label="Function call: R|/getInt|(...)"];
85 [label="Jump: ^test_4 R|/getInt|(block = getInt@fun <anonymous>(): R|kotlin/Unit| <inline=Inline, kind=UNKNOWN> {
^test_4 Int(1)
}
)"];
84 [label="Stub" style="filled" fillcolor=gray];
85 [label="Exit block" style="filled" fillcolor=gray];
86 [label="Stub" style="filled" fillcolor=gray];
87 [label="Exit block" style="filled" fillcolor=gray];
}
86 [label="Exit function test_4" style="filled" fillcolor=red];
88 [label="Exit function test_4" style="filled" fillcolor=red];
}
78 -> {79};
79 -> {80};
80 -> {81 87};
80 -> {87} [style=dashed];
80 -> {81};
81 -> {82};
82 -> {83};
83 -> {86};
83 -> {84} [style=dotted];
84 -> {85} [style=dotted];
82 -> {83 89};
82 -> {89} [style=dashed];
83 -> {84};
84 -> {85};
85 -> {88};
85 -> {86} [style=dotted];
87 -> {93 88};
88 -> {89};
89 -> {90};
90 -> {86};
90 -> {91} [style=dotted];
91 -> {92} [style=dotted];
86 -> {87} [style=dotted];
87 -> {88} [style=dotted];
89 -> {95 90};
90 -> {91};
91 -> {92};
92 -> {88};
92 -> {93} [style=dotted];
93 -> {81};
93 -> {87} [color=green style=dashed];
93 -> {94} [style=dotted];
94 -> {95} [style=dotted];
95 -> {83};
95 -> {89} [color=green style=dashed];
}