[FIR] Rewind DFA after call arguments for correct receiver smartcasting

^KT-63709 Fixed
This commit is contained in:
Brian Norman
2023-11-27 13:48:09 -06:00
committed by Space Team
parent 38d5e56530
commit 0881910a1b
128 changed files with 22457 additions and 16148 deletions
+326 -270
View File
@@ -45,23 +45,38 @@ digraph jumps_kt {
subgraph cluster_7 {
color=blue
19 [label="Enter block"];
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="Exit block" style="filled" fillcolor=gray];
subgraph cluster_8 {
color=blue
20 [label="Function call arguments enter"];
21 [label="Function call arguments exit"];
}
22 [label="Function call: R|java/lang/Exception.Exception|()" style="filled" fillcolor=yellow];
23 [label="Throw: throw R|java/lang/Exception.Exception|()"];
24 [label="Stub" style="filled" fillcolor=gray];
25 [label="Exit block" style="filled" fillcolor=gray];
}
24 [label="Exit when branch result" style="filled" fillcolor=gray];
25 [label="Exit when"];
26 [label="Exit when branch result" style="filled" fillcolor=gray];
27 [label="Exit when"];
}
26 [label="Variable declaration: lval y: R|kotlin/Int|"];
27 [label="Access variable R|<local>/y|"];
28 [label="Function call: R|<local>/y|.R|kotlin/Int.inc|()" style="filled" fillcolor=yellow];
29 [label="Access variable R|<local>/x|"];
30 [label="Smart cast: R|<local>/x|"];
31 [label="Function call: R|<local>/x|.R|kotlin/Int.inc|()" style="filled" fillcolor=yellow];
32 [label="Exit block"];
28 [label="Variable declaration: lval y: R|kotlin/Int|"];
subgraph cluster_9 {
color=blue
29 [label="Function call arguments enter"];
30 [label="Access variable R|<local>/y|"];
31 [label="Function call arguments exit"];
}
32 [label="Function call: R|<local>/y|.R|kotlin/Int.inc|()" style="filled" fillcolor=yellow];
subgraph cluster_10 {
color=blue
33 [label="Function call arguments enter"];
34 [label="Access variable R|<local>/x|"];
35 [label="Smart cast: R|<local>/x|"];
36 [label="Function call arguments exit"];
}
37 [label="Function call: R|<local>/x|.R|kotlin/Int.inc|()" style="filled" fillcolor=yellow];
38 [label="Exit block"];
}
33 [label="Exit function test_1" style="filled" fillcolor=red];
39 [label="Exit function test_1" style="filled" fillcolor=red];
}
2 -> {3};
3 -> {4};
@@ -78,56 +93,53 @@ digraph jumps_kt {
14 -> {15};
15 -> {16};
16 -> {17};
17 -> {25};
17 -> {27};
18 -> {19};
19 -> {20};
20 -> {21};
21 -> {22} [style=dotted];
22 -> {23} [style=dotted];
21 -> {22};
22 -> {23};
23 -> {24} [style=dotted];
24 -> {25} [style=dotted];
25 -> {26};
26 -> {27};
25 -> {26} [style=dotted];
26 -> {27} [style=dotted];
27 -> {28};
28 -> {29};
29 -> {30};
30 -> {31};
31 -> {32};
32 -> {33};
33 -> {34};
34 -> {35};
35 -> {36};
36 -> {37};
37 -> {38};
38 -> {39};
subgraph cluster_8 {
subgraph cluster_11 {
color=red
34 [label="Enter function test_2" style="filled" fillcolor=red];
subgraph cluster_9 {
40 [label="Enter function test_2" style="filled" fillcolor=red];
subgraph cluster_12 {
color=blue
35 [label="Enter block"];
subgraph cluster_10 {
41 [label="Enter block"];
subgraph cluster_13 {
color=blue
36 [label="Enter when"];
subgraph cluster_11 {
color=blue
37 [label="Enter when branch condition "];
38 [label="Access variable R|<local>/x|"];
39 [label="Const: Null(null)"];
40 [label="Equality operator =="];
41 [label="Exit when branch condition"];
}
subgraph cluster_12 {
color=blue
42 [label="Enter when branch condition else"];
43 [label="Exit when branch condition"];
}
44 [label="Enter when branch result"];
subgraph cluster_13 {
color=blue
45 [label="Enter block"];
46 [label="Access variable R|<local>/x|"];
47 [label="Smart cast: R|<local>/x|"];
48 [label="Exit block"];
}
49 [label="Exit when branch result"];
50 [label="Enter when branch result"];
42 [label="Enter when"];
subgraph cluster_14 {
color=blue
43 [label="Enter when branch condition "];
44 [label="Access variable R|<local>/x|"];
45 [label="Const: Null(null)"];
46 [label="Equality operator =="];
47 [label="Exit when branch condition"];
}
subgraph cluster_15 {
color=blue
48 [label="Enter when branch condition else"];
49 [label="Exit when branch condition"];
}
50 [label="Enter when branch result"];
subgraph cluster_16 {
color=blue
51 [label="Enter block"];
52 [label="Access variable R|<local>/x|"];
@@ -135,296 +147,340 @@ digraph jumps_kt {
54 [label="Exit block"];
}
55 [label="Exit when branch result"];
56 [label="Exit when"];
56 [label="Enter when branch result"];
subgraph cluster_17 {
color=blue
57 [label="Enter block"];
58 [label="Access variable R|<local>/x|"];
59 [label="Smart cast: R|<local>/x|"];
60 [label="Exit block"];
}
61 [label="Exit when branch result"];
62 [label="Exit when"];
}
57 [label="Variable declaration: lval y: R|kotlin/Int?|"];
58 [label="Access variable R|<local>/y|"];
59 [label="Function call: R|<local>/y|.R|kotlin/Int.inc<Inapplicable(UNSAFE_CALL): kotlin/Int.inc>#|()" style="filled" fillcolor=yellow];
60 [label="Exit block"];
63 [label="Variable declaration: lval y: R|kotlin/Int?|"];
subgraph cluster_18 {
color=blue
64 [label="Function call arguments enter"];
65 [label="Access variable R|<local>/y|"];
66 [label="Function call arguments exit"];
}
67 [label="Function call: R|<local>/y|.R|kotlin/Int.inc<Inapplicable(UNSAFE_CALL): kotlin/Int.inc>#|()" style="filled" fillcolor=yellow];
68 [label="Exit block"];
}
61 [label="Exit function test_2" style="filled" fillcolor=red];
69 [label="Exit function test_2" style="filled" fillcolor=red];
}
34 -> {35};
35 -> {36};
36 -> {37};
37 -> {38};
38 -> {39};
39 -> {40};
40 -> {41};
41 -> {42 50};
41 -> {42};
42 -> {43};
43 -> {44};
44 -> {45};
45 -> {46};
46 -> {47};
47 -> {48};
47 -> {48 56};
48 -> {49};
49 -> {56};
49 -> {50};
50 -> {51};
51 -> {52};
52 -> {53};
53 -> {54};
54 -> {55};
55 -> {56};
55 -> {62};
56 -> {57};
57 -> {58};
58 -> {59};
59 -> {60};
60 -> {61};
subgraph cluster_15 {
color=red
62 [label="Enter function test_3" style="filled" fillcolor=red];
subgraph cluster_16 {
color=blue
63 [label="Enter block"];
subgraph cluster_17 {
color=blue
64 [label="Enter while loop"];
subgraph cluster_18 {
color=blue
65 [label="Enter loop condition"];
66 [label="Const: Boolean(true)"];
67 [label="Exit loop condition"];
}
subgraph cluster_19 {
color=blue
68 [label="Enter loop block"];
subgraph cluster_20 {
color=blue
69 [label="Enter block"];
70 [label="Access variable R|<local>/x|"];
71 [label="Type operator: (R|<local>/x| as R|kotlin/Int|)"];
72 [label="Jump: break@@@[Boolean(true)] "];
73 [label="Stub" style="filled" fillcolor=gray];
74 [label="Exit block" style="filled" fillcolor=gray];
}
75 [label="Exit loop block" style="filled" fillcolor=gray];
}
76 [label="Exit while loop"];
}
77 [label="Access variable R|<local>/x|"];
78 [label="Smart cast: R|<local>/x|"];
79 [label="Function call: R|<local>/x|.R|kotlin/Int.inc|()" style="filled" fillcolor=yellow];
80 [label="Exit block"];
}
81 [label="Exit function test_3" style="filled" fillcolor=red];
}
61 -> {62};
62 -> {63};
63 -> {64};
64 -> {65};
65 -> {66};
66 -> {67};
67 -> {68};
67 -> {76} [style=dotted];
68 -> {69};
69 -> {70};
subgraph cluster_19 {
color=red
70 [label="Enter function test_3" style="filled" fillcolor=red];
subgraph cluster_20 {
color=blue
71 [label="Enter block"];
subgraph cluster_21 {
color=blue
72 [label="Enter while loop"];
subgraph cluster_22 {
color=blue
73 [label="Enter loop condition"];
74 [label="Const: Boolean(true)"];
75 [label="Exit loop condition"];
}
subgraph cluster_23 {
color=blue
76 [label="Enter loop block"];
subgraph cluster_24 {
color=blue
77 [label="Enter block"];
78 [label="Access variable R|<local>/x|"];
79 [label="Type operator: (R|<local>/x| as R|kotlin/Int|)"];
80 [label="Jump: break@@@[Boolean(true)] "];
81 [label="Stub" style="filled" fillcolor=gray];
82 [label="Exit block" style="filled" fillcolor=gray];
}
83 [label="Exit loop block" style="filled" fillcolor=gray];
}
84 [label="Exit while loop"];
}
subgraph cluster_25 {
color=blue
85 [label="Function call arguments enter"];
86 [label="Access variable R|<local>/x|"];
87 [label="Smart cast: R|<local>/x|"];
88 [label="Function call arguments exit"];
}
89 [label="Function call: R|<local>/x|.R|kotlin/Int.inc|()" style="filled" fillcolor=yellow];
90 [label="Exit block"];
}
91 [label="Exit function test_3" style="filled" fillcolor=red];
}
70 -> {71};
71 -> {72};
72 -> {76};
72 -> {73} [style=dotted];
73 -> {74} [style=dotted];
74 -> {75} [style=dotted];
75 -> {65} [color=green style=dotted];
72 -> {73};
73 -> {74};
74 -> {75};
75 -> {76};
75 -> {84} [style=dotted];
76 -> {77};
77 -> {78};
78 -> {79};
79 -> {80};
80 -> {81};
subgraph cluster_21 {
color=red
82 [label="Enter function test_4" style="filled" fillcolor=red];
subgraph cluster_22 {
color=blue
83 [label="Enter block"];
subgraph cluster_23 {
color=blue
84 [label="Enter do-while loop"];
subgraph cluster_24 {
color=blue
85 [label="Enter loop block"];
subgraph cluster_25 {
color=blue
86 [label="Enter block"];
87 [label="Access variable R|<local>/x|"];
88 [label="Type operator: (R|<local>/x| as R|kotlin/Int|)"];
89 [label="Jump: break@@@[Boolean(true)] "];
90 [label="Stub" style="filled" fillcolor=gray];
91 [label="Exit block" style="filled" fillcolor=gray];
}
92 [label="Exit loop block" style="filled" fillcolor=gray];
}
subgraph cluster_26 {
color=blue
93 [label="Enter loop condition" style="filled" fillcolor=gray];
94 [label="Const: Boolean(true)" style="filled" fillcolor=gray];
95 [label="Exit loop condition" style="filled" fillcolor=gray];
}
96 [label="Exit do-while loop"];
}
97 [label="Access variable R|<local>/x|"];
98 [label="Smart cast: R|<local>/x|"];
99 [label="Function call: R|<local>/x|.R|kotlin/Int.inc|()" style="filled" fillcolor=yellow];
100 [label="Exit block"];
}
101 [label="Exit function test_4" style="filled" fillcolor=red];
}
82 -> {83};
83 -> {84};
80 -> {84};
80 -> {81} [style=dotted];
81 -> {82} [style=dotted];
82 -> {83} [style=dotted];
83 -> {73} [color=green style=dotted];
84 -> {85};
85 -> {86};
86 -> {87};
87 -> {88};
88 -> {89};
89 -> {96};
89 -> {90} [style=dotted];
90 -> {91} [style=dotted];
91 -> {92} [style=dotted];
92 -> {93} [style=dotted];
93 -> {94} [style=dotted];
94 -> {95} [style=dotted];
95 -> {85} [color=green style=dotted];
95 -> {96} [style=dotted];
96 -> {97};
97 -> {98};
98 -> {99};
99 -> {100};
100 -> {101};
89 -> {90};
90 -> {91};
subgraph cluster_27 {
subgraph cluster_26 {
color=red
102 [label="Enter function test_5" style="filled" fillcolor=red];
subgraph cluster_28 {
92 [label="Enter function test_4" style="filled" fillcolor=red];
subgraph cluster_27 {
color=blue
103 [label="Enter block"];
subgraph cluster_29 {
93 [label="Enter block"];
subgraph cluster_28 {
color=blue
104 [label="Enter while loop"];
subgraph cluster_30 {
94 [label="Enter do-while loop"];
subgraph cluster_29 {
color=blue
105 [label="Enter loop condition"];
106 [label="Access variable R|<local>/b|"];
107 [label="Exit loop condition"];
95 [label="Enter loop block"];
subgraph cluster_30 {
color=blue
96 [label="Enter block"];
97 [label="Access variable R|<local>/x|"];
98 [label="Type operator: (R|<local>/x| as R|kotlin/Int|)"];
99 [label="Jump: break@@@[Boolean(true)] "];
100 [label="Stub" style="filled" fillcolor=gray];
101 [label="Exit block" style="filled" fillcolor=gray];
}
102 [label="Exit loop block" style="filled" fillcolor=gray];
}
subgraph cluster_31 {
color=blue
108 [label="Enter loop block"];
subgraph cluster_32 {
color=blue
109 [label="Enter block"];
subgraph cluster_33 {
color=blue
110 [label="Enter when"];
subgraph cluster_34 {
color=blue
111 [label="Enter when branch condition "];
112 [label="Access variable R|<local>/b|"];
113 [label="Exit when branch condition"];
}
114 [label="Synthetic else branch"];
115 [label="Enter when branch result"];
subgraph cluster_35 {
color=blue
116 [label="Enter block"];
117 [label="Jump: continue@@@[R|<local>/b|] "];
118 [label="Stub" style="filled" fillcolor=gray];
119 [label="Exit block" style="filled" fillcolor=gray];
}
120 [label="Exit when branch result" style="filled" fillcolor=gray];
121 [label="Exit when"];
}
122 [label="Exit block"];
}
123 [label="Exit loop block"];
103 [label="Enter loop condition" style="filled" fillcolor=gray];
104 [label="Const: Boolean(true)" style="filled" fillcolor=gray];
105 [label="Exit loop condition" style="filled" fillcolor=gray];
}
124 [label="Exit while loop"];
106 [label="Exit do-while loop"];
}
125 [label="Exit block"];
subgraph cluster_32 {
color=blue
107 [label="Function call arguments enter"];
108 [label="Access variable R|<local>/x|"];
109 [label="Smart cast: R|<local>/x|"];
110 [label="Function call arguments exit"];
}
111 [label="Function call: R|<local>/x|.R|kotlin/Int.inc|()" style="filled" fillcolor=yellow];
112 [label="Exit block"];
}
126 [label="Exit function test_5" style="filled" fillcolor=red];
113 [label="Exit function test_4" style="filled" fillcolor=red];
}
102 -> {103};
103 -> {104};
104 -> {105};
105 -> {106};
92 -> {93};
93 -> {94};
94 -> {95};
95 -> {96};
96 -> {97};
97 -> {98};
98 -> {99};
99 -> {106};
99 -> {100} [style=dotted];
100 -> {101} [style=dotted];
101 -> {102} [style=dotted];
102 -> {103} [style=dotted];
103 -> {104} [style=dotted];
104 -> {105} [style=dotted];
105 -> {95} [color=green style=dotted];
105 -> {106} [style=dotted];
106 -> {107};
107 -> {108 124};
107 -> {108};
108 -> {109};
109 -> {110};
110 -> {111};
111 -> {112};
112 -> {113};
113 -> {114 115};
114 -> {121};
subgraph cluster_33 {
color=red
114 [label="Enter function test_5" style="filled" fillcolor=red];
subgraph cluster_34 {
color=blue
115 [label="Enter block"];
subgraph cluster_35 {
color=blue
116 [label="Enter while loop"];
subgraph cluster_36 {
color=blue
117 [label="Enter loop condition"];
118 [label="Access variable R|<local>/b|"];
119 [label="Exit loop condition"];
}
subgraph cluster_37 {
color=blue
120 [label="Enter loop block"];
subgraph cluster_38 {
color=blue
121 [label="Enter block"];
subgraph cluster_39 {
color=blue
122 [label="Enter when"];
subgraph cluster_40 {
color=blue
123 [label="Enter when branch condition "];
124 [label="Access variable R|<local>/b|"];
125 [label="Exit when branch condition"];
}
126 [label="Synthetic else branch"];
127 [label="Enter when branch result"];
subgraph cluster_41 {
color=blue
128 [label="Enter block"];
129 [label="Jump: continue@@@[R|<local>/b|] "];
130 [label="Stub" style="filled" fillcolor=gray];
131 [label="Exit block" style="filled" fillcolor=gray];
}
132 [label="Exit when branch result" style="filled" fillcolor=gray];
133 [label="Exit when"];
}
134 [label="Exit block"];
}
135 [label="Exit loop block"];
}
136 [label="Exit while loop"];
}
137 [label="Exit block"];
}
138 [label="Exit function test_5" style="filled" fillcolor=red];
}
114 -> {115};
115 -> {116};
116 -> {117};
117 -> {105} [color=green style=dashed];
117 -> {118} [style=dotted];
118 -> {119} [style=dotted];
119 -> {120} [style=dotted];
120 -> {121} [style=dotted];
117 -> {118};
118 -> {119};
119 -> {120 136};
120 -> {121};
121 -> {122};
122 -> {123};
123 -> {105} [color=green style=dashed];
123 -> {124};
124 -> {125};
125 -> {126};
subgraph cluster_36 {
color=red
127 [label="Enter function run" style="filled" fillcolor=red];
subgraph cluster_37 {
color=blue
128 [label="Enter block"];
129 [label="Function call: R|<local>/block|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()" style="filled" fillcolor=yellow];
130 [label="Exit block"];
}
131 [label="Exit function run" style="filled" fillcolor=red];
}
125 -> {126 127};
126 -> {133};
127 -> {128};
128 -> {129};
129 -> {130};
130 -> {131};
subgraph cluster_38 {
color=red
132 [label="Enter function test_6" style="filled" fillcolor=red];
subgraph cluster_39 {
color=blue
133 [label="Enter block"];
134 [label="Postponed enter to lambda"];
subgraph cluster_40 {
color=blue
135 [label="Enter function <anonymous>" style="filled" fillcolor=red];
subgraph cluster_41 {
color=blue
136 [label="Enter block"];
137 [label="Jump: ^@run Unit"];
138 [label="Stub" style="filled" fillcolor=gray];
139 [label="Exit block" style="filled" fillcolor=gray];
}
140 [label="Exit function <anonymous>" style="filled" fillcolor=red];
}
141 [label="Postponed exit from lambda"];
142 [label="Function call: R|/run|(...)" style="filled" fillcolor=yellow];
143 [label="Exit block"];
}
144 [label="Exit function test_6" style="filled" fillcolor=red];
}
132 -> {133};
129 -> {117} [color=green style=dashed];
129 -> {130} [style=dotted];
130 -> {131} [style=dotted];
131 -> {132} [style=dotted];
132 -> {133} [style=dotted];
133 -> {134};
134 -> {135 141 142};
134 -> {135} [style=dashed];
135 -> {136};
134 -> {135};
135 -> {117} [color=green style=dashed];
136 -> {137};
137 -> {140};
137 -> {138} [style=dotted];
138 -> {139} [style=dotted];
139 -> {140} [style=dotted];
137 -> {138};
subgraph cluster_42 {
color=red
139 [label="Enter function run" style="filled" fillcolor=red];
subgraph cluster_43 {
color=blue
140 [label="Enter block"];
subgraph cluster_44 {
color=blue
141 [label="Function call arguments enter"];
142 [label="Function call arguments exit"];
}
143 [label="Function call: R|<local>/block|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()" style="filled" fillcolor=yellow];
144 [label="Exit block"];
}
145 [label="Exit function run" style="filled" fillcolor=red];
}
139 -> {140};
140 -> {141};
141 -> {142};
141 -> {134} [color=green style=dashed];
142 -> {143};
143 -> {144};
144 -> {145};
subgraph cluster_45 {
color=red
146 [label="Enter function test_6" style="filled" fillcolor=red];
subgraph cluster_46 {
color=blue
147 [label="Enter block"];
subgraph cluster_47 {
color=blue
148 [label="Function call arguments enter"];
149 [label="Postponed enter to lambda"];
subgraph cluster_48 {
color=blue
150 [label="Enter function <anonymous>" style="filled" fillcolor=red];
subgraph cluster_49 {
color=blue
151 [label="Enter block"];
152 [label="Jump: ^@run Unit"];
153 [label="Stub" style="filled" fillcolor=gray];
154 [label="Exit block" style="filled" fillcolor=gray];
}
155 [label="Exit function <anonymous>" style="filled" fillcolor=red];
}
156 [label="Function call arguments exit"];
}
157 [label="Postponed exit from lambda"];
158 [label="Function call: R|/run|(...)" style="filled" fillcolor=yellow];
159 [label="Exit block"];
}
160 [label="Exit function test_6" style="filled" fillcolor=red];
}
146 -> {147};
147 -> {148};
148 -> {149};
149 -> {150 156 157};
149 -> {150} [style=dashed];
150 -> {151};
151 -> {152};
152 -> {155};
152 -> {153} [style=dotted];
153 -> {154} [style=dotted];
154 -> {155} [style=dotted];
155 -> {157};
156 -> {158};
157 -> {158};
157 -> {149} [color=green style=dashed];
158 -> {159};
159 -> {160};
}