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