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
@@ -27,10 +27,11 @@ digraph bangbang_kt {
7 [label="Check not null: R|<local>/a|!!"];
8 [label="Function call: R|<local>/a|!!.R|/A.foo|()"];
9 [label="Access variable R|<local>/a|"];
10 [label="Function call: R|<local>/a|.R|/A.foo|()"];
11 [label="Exit block"];
10 [label="Smart cast: R|<local>/a|"];
11 [label="Function call: R|<local>/a|.R|/A.foo|()"];
12 [label="Exit block"];
}
12 [label="Exit function test_0" style="filled" fillcolor=red];
13 [label="Exit function test_0" style="filled" fillcolor=red];
}
4 -> {5};
5 -> {6};
@@ -40,52 +41,54 @@ digraph bangbang_kt {
9 -> {10};
10 -> {11};
11 -> {12};
12 -> {13};
subgraph cluster_4 {
color=red
13 [label="Enter function test_1" style="filled" fillcolor=red];
14 [label="Enter function test_1" style="filled" fillcolor=red];
subgraph cluster_5 {
color=blue
14 [label="Enter block"];
15 [label="Enter block"];
subgraph cluster_6 {
color=blue
15 [label="Enter when"];
16 [label="Enter when"];
subgraph cluster_7 {
color=blue
16 [label="Enter when branch condition "];
17 [label="Access variable R|<local>/a|"];
18 [label="Check not null: R|<local>/a|!!"];
19 [label="Function call: R|<local>/a|!!.R|/A.foo|()"];
20 [label="Exit when branch condition"];
17 [label="Enter when branch condition "];
18 [label="Access variable R|<local>/a|"];
19 [label="Check not null: R|<local>/a|!!"];
20 [label="Function call: R|<local>/a|!!.R|/A.foo|()"];
21 [label="Exit when branch condition"];
}
21 [label="Synthetic else branch"];
22 [label="Enter when branch result"];
22 [label="Synthetic else branch"];
23 [label="Enter when branch result"];
subgraph cluster_8 {
color=blue
23 [label="Enter block"];
24 [label="Access variable R|<local>/a|"];
25 [label="Function call: R|<local>/a|.R|/A.foo|()"];
26 [label="Exit block"];
24 [label="Enter block"];
25 [label="Access variable R|<local>/a|"];
26 [label="Smart cast: R|<local>/a|"];
27 [label="Function call: R|<local>/a|.R|/A.foo|()"];
28 [label="Exit block"];
}
27 [label="Exit when branch result"];
28 [label="Exit when"];
29 [label="Exit when branch result"];
30 [label="Exit when"];
}
29 [label="Access variable R|<local>/a|"];
30 [label="Function call: R|<local>/a|.R|/A.foo|()"];
31 [label="Exit block"];
31 [label="Access variable R|<local>/a|"];
32 [label="Smart cast: R|<local>/a|"];
33 [label="Function call: R|<local>/a|.R|/A.foo|()"];
34 [label="Exit block"];
}
32 [label="Exit function test_1" style="filled" fillcolor=red];
35 [label="Exit function test_1" style="filled" fillcolor=red];
}
13 -> {14};
14 -> {15};
15 -> {16};
16 -> {17};
17 -> {18};
18 -> {19};
19 -> {20};
20 -> {22 21};
21 -> {28};
22 -> {23};
20 -> {21};
21 -> {23 22};
22 -> {30};
23 -> {24};
24 -> {25};
25 -> {26};
@@ -95,67 +98,69 @@ digraph bangbang_kt {
29 -> {30};
30 -> {31};
31 -> {32};
32 -> {33};
33 -> {34};
34 -> {35};
subgraph cluster_9 {
color=red
33 [label="Enter function test_2" style="filled" fillcolor=red];
36 [label="Enter function test_2" style="filled" fillcolor=red];
subgraph cluster_10 {
color=blue
34 [label="Enter block"];
37 [label="Enter block"];
subgraph cluster_11 {
color=blue
35 [label="Enter when"];
38 [label="Enter when"];
subgraph cluster_12 {
color=blue
36 [label="Enter when branch condition "];
39 [label="Enter when branch condition "];
subgraph cluster_13 {
color=blue
37 [label="Enter &&"];
38 [label="Access variable R|<local>/a|"];
39 [label="Check not null: R|<local>/a|!!"];
40 [label="Function call: R|<local>/a|!!.R|/A.foo|()"];
41 [label="Exit left part of &&"];
42 [label="Enter right part of &&"];
43 [label="Access variable R|<local>/b|"];
44 [label="Exit &&"];
40 [label="Enter &&"];
41 [label="Access variable R|<local>/a|"];
42 [label="Check not null: R|<local>/a|!!"];
43 [label="Function call: R|<local>/a|!!.R|/A.foo|()"];
44 [label="Exit left part of &&"];
45 [label="Enter right part of &&"];
46 [label="Access variable R|<local>/b|"];
47 [label="Exit &&"];
}
45 [label="Exit when branch condition"];
48 [label="Exit when branch condition"];
}
46 [label="Synthetic else branch"];
47 [label="Enter when branch result"];
49 [label="Synthetic else branch"];
50 [label="Enter when branch result"];
subgraph cluster_14 {
color=blue
48 [label="Enter block"];
49 [label="Access variable R|<local>/a|"];
50 [label="Function call: R|<local>/a|.R|/A.foo|()"];
51 [label="Exit block"];
51 [label="Enter block"];
52 [label="Access variable R|<local>/a|"];
53 [label="Smart cast: R|<local>/a|"];
54 [label="Function call: R|<local>/a|.R|/A.foo|()"];
55 [label="Exit block"];
}
52 [label="Exit when branch result"];
53 [label="Exit when"];
56 [label="Exit when branch result"];
57 [label="Exit when"];
}
54 [label="Access variable R|<local>/a|"];
55 [label="Function call: R|<local>/a|.R|/A.foo|()"];
56 [label="Exit block"];
58 [label="Access variable R|<local>/a|"];
59 [label="Smart cast: R|<local>/a|"];
60 [label="Function call: R|<local>/a|.R|/A.foo|()"];
61 [label="Exit block"];
}
57 [label="Exit function test_2" style="filled" fillcolor=red];
62 [label="Exit function test_2" style="filled" fillcolor=red];
}
33 -> {34};
34 -> {35};
35 -> {36};
36 -> {37};
37 -> {38};
38 -> {39};
39 -> {40};
40 -> {41};
41 -> {44 42};
41 -> {42};
42 -> {43};
43 -> {44};
44 -> {45};
45 -> {47 46};
46 -> {53};
44 -> {47 45};
45 -> {46};
46 -> {47};
47 -> {48};
48 -> {49};
49 -> {50};
48 -> {50 49};
49 -> {57};
50 -> {51};
51 -> {52};
52 -> {53};
@@ -163,249 +168,260 @@ digraph bangbang_kt {
54 -> {55};
55 -> {56};
56 -> {57};
subgraph cluster_15 {
color=red
58 [label="Enter function test_3" style="filled" fillcolor=red];
subgraph cluster_16 {
color=blue
59 [label="Enter block"];
subgraph cluster_17 {
color=blue
60 [label="Enter when"];
subgraph cluster_18 {
color=blue
61 [label="Enter when branch condition "];
subgraph cluster_19 {
color=blue
62 [label="Enter &&"];
63 [label="Access variable R|<local>/b|"];
64 [label="Exit left part of &&"];
65 [label="Enter right part of &&"];
66 [label="Access variable R|<local>/a|"];
67 [label="Check not null: R|<local>/a|!!"];
68 [label="Function call: R|<local>/a|!!.R|/A.foo|()"];
69 [label="Exit &&"];
}
70 [label="Exit when branch condition"];
}
71 [label="Synthetic else branch"];
72 [label="Enter when branch result"];
subgraph cluster_20 {
color=blue
73 [label="Enter block"];
74 [label="Access variable R|<local>/a|"];
75 [label="Function call: R|<local>/a|.R|/A.foo|()"];
76 [label="Exit block"];
}
77 [label="Exit when branch result"];
78 [label="Exit when"];
}
79 [label="Access variable R|<local>/a|"];
80 [label="Function call: R|<local>/a|.<Inapplicable(UNSAFE_CALL): /A.foo>#()"];
81 [label="Exit block"];
}
82 [label="Exit function test_3" style="filled" fillcolor=red];
}
57 -> {58};
58 -> {59};
59 -> {60};
60 -> {61};
61 -> {62};
62 -> {63};
subgraph cluster_15 {
color=red
63 [label="Enter function test_3" style="filled" fillcolor=red];
subgraph cluster_16 {
color=blue
64 [label="Enter block"];
subgraph cluster_17 {
color=blue
65 [label="Enter when"];
subgraph cluster_18 {
color=blue
66 [label="Enter when branch condition "];
subgraph cluster_19 {
color=blue
67 [label="Enter &&"];
68 [label="Access variable R|<local>/b|"];
69 [label="Exit left part of &&"];
70 [label="Enter right part of &&"];
71 [label="Access variable R|<local>/a|"];
72 [label="Check not null: R|<local>/a|!!"];
73 [label="Function call: R|<local>/a|!!.R|/A.foo|()"];
74 [label="Exit &&"];
}
75 [label="Exit when branch condition"];
}
76 [label="Synthetic else branch"];
77 [label="Enter when branch result"];
subgraph cluster_20 {
color=blue
78 [label="Enter block"];
79 [label="Access variable R|<local>/a|"];
80 [label="Smart cast: R|<local>/a|"];
81 [label="Function call: R|<local>/a|.R|/A.foo|()"];
82 [label="Exit block"];
}
83 [label="Exit when branch result"];
84 [label="Exit when"];
}
85 [label="Access variable R|<local>/a|"];
86 [label="Function call: R|<local>/a|.<Inapplicable(UNSAFE_CALL): /A.foo>#()"];
87 [label="Exit block"];
}
88 [label="Exit function test_3" style="filled" fillcolor=red];
}
63 -> {64};
64 -> {69 65};
64 -> {65};
65 -> {66};
66 -> {67};
67 -> {68};
68 -> {69};
69 -> {70};
70 -> {72 71};
71 -> {78};
69 -> {74 70};
70 -> {71};
71 -> {72};
72 -> {73};
73 -> {74};
74 -> {75};
75 -> {76};
76 -> {77};
75 -> {77 76};
76 -> {84};
77 -> {78};
78 -> {79};
79 -> {80};
80 -> {81};
81 -> {82};
subgraph cluster_21 {
color=red
83 [label="Enter function test_4" style="filled" fillcolor=red];
subgraph cluster_22 {
color=blue
84 [label="Enter block"];
subgraph cluster_23 {
color=blue
85 [label="Enter when"];
subgraph cluster_24 {
color=blue
86 [label="Enter when branch condition "];
subgraph cluster_25 {
color=blue
87 [label="Enter ||"];
88 [label="Access variable R|<local>/a|"];
89 [label="Check not null: R|<local>/a|!!"];
90 [label="Function call: R|<local>/a|!!.R|/A.foo|()"];
91 [label="Exit left part of ||"];
92 [label="Enter right part of ||"];
93 [label="Access variable R|<local>/b|"];
94 [label="Exit ||"];
}
95 [label="Exit when branch condition"];
}
96 [label="Synthetic else branch"];
97 [label="Enter when branch result"];
subgraph cluster_26 {
color=blue
98 [label="Enter block"];
99 [label="Access variable R|<local>/a|"];
100 [label="Function call: R|<local>/a|.R|/A.foo|()"];
101 [label="Exit block"];
}
102 [label="Exit when branch result"];
103 [label="Exit when"];
}
104 [label="Access variable R|<local>/a|"];
105 [label="Function call: R|<local>/a|.R|/A.foo|()"];
106 [label="Exit block"];
}
107 [label="Exit function test_4" style="filled" fillcolor=red];
}
82 -> {83};
83 -> {84};
84 -> {85};
85 -> {86};
86 -> {87};
87 -> {88};
88 -> {89};
subgraph cluster_21 {
color=red
89 [label="Enter function test_4" style="filled" fillcolor=red];
subgraph cluster_22 {
color=blue
90 [label="Enter block"];
subgraph cluster_23 {
color=blue
91 [label="Enter when"];
subgraph cluster_24 {
color=blue
92 [label="Enter when branch condition "];
subgraph cluster_25 {
color=blue
93 [label="Enter ||"];
94 [label="Access variable R|<local>/a|"];
95 [label="Check not null: R|<local>/a|!!"];
96 [label="Function call: R|<local>/a|!!.R|/A.foo|()"];
97 [label="Exit left part of ||"];
98 [label="Enter right part of ||"];
99 [label="Access variable R|<local>/b|"];
100 [label="Exit ||"];
}
101 [label="Exit when branch condition"];
}
102 [label="Synthetic else branch"];
103 [label="Enter when branch result"];
subgraph cluster_26 {
color=blue
104 [label="Enter block"];
105 [label="Access variable R|<local>/a|"];
106 [label="Smart cast: R|<local>/a|"];
107 [label="Function call: R|<local>/a|.R|/A.foo|()"];
108 [label="Exit block"];
}
109 [label="Exit when branch result"];
110 [label="Exit when"];
}
111 [label="Access variable R|<local>/a|"];
112 [label="Smart cast: R|<local>/a|"];
113 [label="Function call: R|<local>/a|.R|/A.foo|()"];
114 [label="Exit block"];
}
115 [label="Exit function test_4" style="filled" fillcolor=red];
}
89 -> {90};
90 -> {91};
91 -> {94 92};
91 -> {92};
92 -> {93};
93 -> {94};
94 -> {95};
95 -> {97 96};
96 -> {103};
97 -> {98};
95 -> {96};
96 -> {97};
97 -> {100 98};
98 -> {99};
99 -> {100};
100 -> {101};
101 -> {102};
102 -> {103};
101 -> {103 102};
102 -> {110};
103 -> {104};
104 -> {105};
105 -> {106};
106 -> {107};
subgraph cluster_27 {
color=red
108 [label="Enter function test_5" style="filled" fillcolor=red];
subgraph cluster_28 {
color=blue
109 [label="Enter block"];
subgraph cluster_29 {
color=blue
110 [label="Enter when"];
subgraph cluster_30 {
color=blue
111 [label="Enter when branch condition "];
subgraph cluster_31 {
color=blue
112 [label="Enter ||"];
113 [label="Access variable R|<local>/b|"];
114 [label="Exit left part of ||"];
115 [label="Enter right part of ||"];
116 [label="Access variable R|<local>/a|"];
117 [label="Check not null: R|<local>/a|!!"];
118 [label="Function call: R|<local>/a|!!.R|/A.foo|()"];
119 [label="Exit ||"];
}
120 [label="Exit when branch condition"];
}
121 [label="Synthetic else branch"];
122 [label="Enter when branch result"];
subgraph cluster_32 {
color=blue
123 [label="Enter block"];
124 [label="Access variable R|<local>/a|"];
125 [label="Function call: R|<local>/a|.<Inapplicable(UNSAFE_CALL): /A.foo>#()"];
126 [label="Exit block"];
}
127 [label="Exit when branch result"];
128 [label="Exit when"];
}
129 [label="Access variable R|<local>/a|"];
130 [label="Function call: R|<local>/a|.<Inapplicable(UNSAFE_CALL): /A.foo>#()"];
131 [label="Exit block"];
}
132 [label="Exit function test_5" style="filled" fillcolor=red];
}
107 -> {108};
108 -> {109};
109 -> {110};
110 -> {111};
111 -> {112};
112 -> {113};
113 -> {114};
114 -> {119 115};
115 -> {116};
114 -> {115};
subgraph cluster_27 {
color=red
116 [label="Enter function test_5" style="filled" fillcolor=red];
subgraph cluster_28 {
color=blue
117 [label="Enter block"];
subgraph cluster_29 {
color=blue
118 [label="Enter when"];
subgraph cluster_30 {
color=blue
119 [label="Enter when branch condition "];
subgraph cluster_31 {
color=blue
120 [label="Enter ||"];
121 [label="Access variable R|<local>/b|"];
122 [label="Exit left part of ||"];
123 [label="Enter right part of ||"];
124 [label="Access variable R|<local>/a|"];
125 [label="Check not null: R|<local>/a|!!"];
126 [label="Function call: R|<local>/a|!!.R|/A.foo|()"];
127 [label="Exit ||"];
}
128 [label="Exit when branch condition"];
}
129 [label="Synthetic else branch"];
130 [label="Enter when branch result"];
subgraph cluster_32 {
color=blue
131 [label="Enter block"];
132 [label="Access variable R|<local>/a|"];
133 [label="Function call: R|<local>/a|.<Inapplicable(UNSAFE_CALL): /A.foo>#()"];
134 [label="Exit block"];
}
135 [label="Exit when branch result"];
136 [label="Exit when"];
}
137 [label="Access variable R|<local>/a|"];
138 [label="Function call: R|<local>/a|.<Inapplicable(UNSAFE_CALL): /A.foo>#()"];
139 [label="Exit block"];
}
140 [label="Exit function test_5" style="filled" fillcolor=red];
}
116 -> {117};
117 -> {118};
118 -> {119};
119 -> {120};
120 -> {122 121};
121 -> {128};
122 -> {123};
120 -> {121};
121 -> {122};
122 -> {127 123};
123 -> {124};
124 -> {125};
125 -> {126};
126 -> {127};
127 -> {128};
128 -> {129};
129 -> {130};
128 -> {130 129};
129 -> {136};
130 -> {131};
131 -> {132};
subgraph cluster_33 {
color=red
133 [label="Enter function test_6" style="filled" fillcolor=red];
subgraph cluster_34 {
color=blue
134 [label="Enter block"];
135 [label="Access variable R|<local>/x|"];
136 [label="Check not null: R|<local>/x|!!"];
137 [label="Function call: R|<local>/x|!!.R|/A.foo|()"];
138 [label="Exit block"];
}
139 [label="Exit function test_6" style="filled" fillcolor=red];
}
132 -> {133};
133 -> {134};
134 -> {135};
135 -> {136};
136 -> {137};
137 -> {138};
138 -> {139};
139 -> {140};
subgraph cluster_35 {
subgraph cluster_33 {
color=red
140 [label="Enter function test_7" style="filled" fillcolor=red];
subgraph cluster_36 {
141 [label="Enter function test_6" style="filled" fillcolor=red];
subgraph cluster_34 {
color=blue
141 [label="Enter block"];
142 [label="Access variable R|<local>/x|"];
143 [label="Check not null: R|<local>/x|!!"];
144 [label="Function call: R|<local>/x|!!.R|/A.foo|()"];
145 [label="Exit block"];
142 [label="Enter block"];
143 [label="Access variable R|<local>/x|"];
144 [label="Check not null: R|<local>/x|!!"];
145 [label="Function call: R|<local>/x|!!.R|/A.foo|()"];
146 [label="Exit block"];
}
146 [label="Exit function test_7" style="filled" fillcolor=red];
147 [label="Exit function test_6" style="filled" fillcolor=red];
}
140 -> {141};
141 -> {142};
142 -> {143};
143 -> {144};
144 -> {145};
145 -> {146};
146 -> {147};
subgraph cluster_35 {
color=red
148 [label="Enter function test_7" style="filled" fillcolor=red];
subgraph cluster_36 {
color=blue
149 [label="Enter block"];
150 [label="Access variable R|<local>/x|"];
151 [label="Check not null: R|<local>/x|!!"];
152 [label="Function call: R|<local>/x|!!.R|/A.foo|()"];
153 [label="Exit block"];
}
154 [label="Exit function test_7" style="filled" fillcolor=red];
}
148 -> {149};
149 -> {150};
150 -> {151};
151 -> {152};
152 -> {153};
153 -> {154};
}