[FIR-TEST] Move analysis tests to separate module

This commit is contained in:
Dmitriy Novozhilov
2020-03-18 15:10:46 +03:00
parent 3a479d5d16
commit cc07ae96b3
1477 changed files with 1001 additions and 980 deletions
@@ -0,0 +1,836 @@
digraph booleanOperators_kt {
graph [nodesep=3]
node [shape=box penwidth=2]
edge [penwidth=2]
subgraph cluster_0 {
color=red
0 [label="Enter function foo" style="filled" fillcolor=red];
1 [label="Exit function foo" style="filled" fillcolor=red];
}
0 -> {1};
subgraph cluster_1 {
color=red
2 [label="Enter function bool" style="filled" fillcolor=red];
3 [label="Exit function bool" style="filled" fillcolor=red];
}
2 -> {3};
subgraph cluster_2 {
color=red
4 [label="Enter function bar" style="filled" fillcolor=red];
5 [label="Exit function bar" style="filled" fillcolor=red];
}
4 -> {5};
subgraph cluster_3 {
color=red
6 [label="Enter function baz" style="filled" fillcolor=red];
7 [label="Exit function baz" style="filled" fillcolor=red];
}
6 -> {7};
subgraph cluster_4 {
color=red
8 [label="Enter function test_1" style="filled" fillcolor=red];
subgraph cluster_5 {
color=blue
9 [label="Enter when"];
subgraph cluster_6 {
color=blue
10 [label="Enter when branch condition "];
subgraph cluster_7 {
color=blue
11 [label="Enter &&"];
12 [label="Access variable R|<local>/x|"];
13 [label="Type operator: (R|<local>/x| is R|B|)"];
14 [label="Exit left part of &&"];
15 [label="Enter right part of &&"];
16 [label="Access variable R|<local>/x|"];
17 [label="Type operator: (R|<local>/x| is R|C|)"];
18 [label="Exit &&"];
}
19 [label="Exit when branch condition"];
}
20 [label="Synthetic else branch"];
21 [label="Enter when branch result"];
subgraph cluster_8 {
color=blue
22 [label="Enter block"];
23 [label="Access variable R|<local>/x|"];
24 [label="Function call: R|<local>/x|.R|/A.foo|()"];
25 [label="Access variable R|<local>/x|"];
26 [label="Function call: R|<local>/x|.R|/B.bar|()"];
27 [label="Access variable R|<local>/x|"];
28 [label="Function call: R|<local>/x|.R|/C.baz|()"];
29 [label="Exit block"];
}
30 [label="Exit when branch result"];
31 [label="Exit when"];
}
32 [label="Exit function test_1" style="filled" fillcolor=red];
}
8 -> {9};
9 -> {10};
10 -> {11};
11 -> {12};
12 -> {13};
13 -> {14};
14 -> {18 15};
15 -> {16};
16 -> {17};
17 -> {18};
18 -> {19};
19 -> {21 20};
20 -> {31};
21 -> {22};
22 -> {23};
23 -> {24};
24 -> {25};
25 -> {26};
26 -> {27};
27 -> {28};
28 -> {29};
29 -> {30};
30 -> {31};
31 -> {32};
subgraph cluster_9 {
color=red
33 [label="Enter function test_2" style="filled" fillcolor=red];
subgraph cluster_10 {
color=blue
34 [label="Enter when"];
subgraph cluster_11 {
color=blue
35 [label="Enter when branch condition "];
subgraph cluster_12 {
color=blue
36 [label="Enter ||"];
37 [label="Access variable R|<local>/x|"];
38 [label="Type operator: (R|<local>/x| is R|B|)"];
39 [label="Exit left part of ||"];
40 [label="Enter right part of ||"];
41 [label="Access variable R|<local>/x|"];
42 [label="Type operator: (R|<local>/x| is R|C|)"];
43 [label="Exit ||"];
}
44 [label="Exit when branch condition"];
}
45 [label="Synthetic else branch"];
46 [label="Enter when branch result"];
subgraph cluster_13 {
color=blue
47 [label="Enter block"];
48 [label="Access variable R|<local>/x|"];
49 [label="Function call: R|<local>/x|.R|/A.foo|()"];
50 [label="Access variable R|<local>/x|"];
51 [label="Function call: R|<local>/x|.<Unresolved name: bar>#()"];
52 [label="Access variable R|<local>/x|"];
53 [label="Function call: R|<local>/x|.<Unresolved name: baz>#()"];
54 [label="Exit block"];
}
55 [label="Exit when branch result"];
56 [label="Exit when"];
}
57 [label="Exit function test_2" style="filled" fillcolor=red];
}
33 -> {34};
34 -> {35};
35 -> {36};
36 -> {37};
37 -> {38};
38 -> {39};
39 -> {43 40};
40 -> {41};
41 -> {42};
42 -> {43};
43 -> {44};
44 -> {46 45};
45 -> {56};
46 -> {47};
47 -> {48};
48 -> {49};
49 -> {50};
50 -> {51};
51 -> {52};
52 -> {53};
53 -> {54};
54 -> {55};
55 -> {56};
56 -> {57};
subgraph cluster_14 {
color=red
58 [label="Enter function test_3" style="filled" fillcolor=red];
subgraph cluster_15 {
color=blue
59 [label="Enter when"];
subgraph cluster_16 {
color=blue
60 [label="Enter when branch condition "];
61 [label="Access variable R|<local>/x|"];
62 [label="Type operator: (R|<local>/x| !is R|A|)"];
63 [label="Function call: (R|<local>/x| !is R|A|).R|kotlin/Boolean.not|()"];
64 [label="Exit when branch condition"];
}
65 [label="Synthetic else branch"];
66 [label="Enter when branch result"];
subgraph cluster_17 {
color=blue
67 [label="Enter block"];
68 [label="Access variable R|<local>/x|"];
69 [label="Function call: R|<local>/x|.R|/A.foo|()"];
70 [label="Exit block"];
}
71 [label="Exit when branch result"];
72 [label="Exit when"];
}
73 [label="Exit function test_3" style="filled" fillcolor=red];
}
58 -> {59};
59 -> {60};
60 -> {61};
61 -> {62};
62 -> {63};
63 -> {64};
64 -> {66 65};
65 -> {72};
66 -> {67};
67 -> {68};
68 -> {69};
69 -> {70};
70 -> {71};
71 -> {72};
72 -> {73};
subgraph cluster_18 {
color=red
74 [label="Enter function test_4" style="filled" fillcolor=red];
subgraph cluster_19 {
color=blue
75 [label="Enter when"];
subgraph cluster_20 {
color=blue
76 [label="Enter when branch condition "];
subgraph cluster_21 {
color=blue
77 [label="Enter ||"];
78 [label="Access variable R|<local>/x|"];
79 [label="Type operator: (R|<local>/x| !is R|kotlin/String|)"];
80 [label="Exit left part of ||"];
81 [label="Enter right part of ||"];
82 [label="Access variable R|<local>/x|"];
83 [label="Access variable R|kotlin/String.length|"];
84 [label="Const: Int(0)"];
85 [label="Operator =="];
86 [label="Exit ||"];
}
87 [label="Exit when branch condition"];
}
88 [label="Synthetic else branch"];
89 [label="Enter when branch result"];
subgraph cluster_22 {
color=blue
90 [label="Enter block"];
91 [label="Access variable R|<local>/x|"];
92 [label="Access variable <Unresolved name: length>#"];
93 [label="Exit block"];
}
94 [label="Exit when branch result"];
95 [label="Exit when"];
}
96 [label="Access variable R|<local>/x|"];
97 [label="Access variable <Unresolved name: length>#"];
98 [label="Exit function test_4" style="filled" fillcolor=red];
}
74 -> {75};
75 -> {76};
76 -> {77};
77 -> {78};
78 -> {79};
79 -> {80};
80 -> {86 81};
81 -> {82};
82 -> {83};
83 -> {84};
84 -> {85};
85 -> {86};
86 -> {87};
87 -> {89 88};
88 -> {95};
89 -> {90};
90 -> {91};
91 -> {92};
92 -> {93};
93 -> {94};
94 -> {95};
95 -> {96};
96 -> {97};
97 -> {98};
subgraph cluster_23 {
color=red
99 [label="Enter function test_5" style="filled" fillcolor=red];
subgraph cluster_24 {
color=blue
100 [label="Enter when"];
subgraph cluster_25 {
color=blue
101 [label="Enter when branch condition "];
subgraph cluster_26 {
color=blue
102 [label="Enter &&"];
103 [label="Access variable R|<local>/x|"];
104 [label="Type operator: (R|<local>/x| is R|A|)"];
105 [label="Exit left part of &&"];
106 [label="Enter right part of &&"];
107 [label="Access variable R|<local>/x|"];
108 [label="Function call: R|<local>/x|.R|/A.bool|()"];
109 [label="Exit &&"];
}
110 [label="Exit when branch condition"];
}
111 [label="Synthetic else branch"];
112 [label="Enter when branch result"];
subgraph cluster_27 {
color=blue
113 [label="Enter block"];
114 [label="Access variable R|<local>/x|"];
115 [label="Function call: R|<local>/x|.R|/A.foo|()"];
116 [label="Exit block"];
}
117 [label="Exit when branch result"];
118 [label="Exit when"];
}
119 [label="Exit function test_5" style="filled" fillcolor=red];
}
99 -> {100};
100 -> {101};
101 -> {102};
102 -> {103};
103 -> {104};
104 -> {105};
105 -> {109 106};
106 -> {107};
107 -> {108};
108 -> {109};
109 -> {110};
110 -> {112 111};
111 -> {118};
112 -> {113};
113 -> {114};
114 -> {115};
115 -> {116};
116 -> {117};
117 -> {118};
118 -> {119};
subgraph cluster_28 {
color=red
120 [label="Enter function test_6" style="filled" fillcolor=red];
subgraph cluster_29 {
color=blue
121 [label="Enter when"];
subgraph cluster_30 {
color=blue
122 [label="Enter when branch condition "];
123 [label="Access variable R|<local>/x|"];
124 [label="Type operator: (R|<local>/x| !is R|A|)"];
125 [label="Function call: (R|<local>/x| !is R|A|).R|kotlin/Boolean.not|()"];
126 [label="Exit when branch condition"];
}
127 [label="Synthetic else branch"];
128 [label="Enter when branch result"];
subgraph cluster_31 {
color=blue
129 [label="Enter block"];
130 [label="Access variable R|<local>/x|"];
131 [label="Function call: R|<local>/x|.R|/A.foo|()"];
132 [label="Exit block"];
}
133 [label="Exit when branch result"];
134 [label="Exit when"];
}
135 [label="Exit function test_6" style="filled" fillcolor=red];
}
120 -> {121};
121 -> {122};
122 -> {123};
123 -> {124};
124 -> {125};
125 -> {126};
126 -> {128 127};
127 -> {134};
128 -> {129};
129 -> {130};
130 -> {131};
131 -> {132};
132 -> {133};
133 -> {134};
134 -> {135};
subgraph cluster_32 {
color=red
136 [label="Enter function test_7" style="filled" fillcolor=red];
subgraph cluster_33 {
color=blue
137 [label="Enter when"];
subgraph cluster_34 {
color=blue
138 [label="Enter when branch condition "];
subgraph cluster_35 {
color=blue
139 [label="Enter ||"];
140 [label="Access variable R|<local>/x|"];
141 [label="Type operator: (R|<local>/x| is R|A|)"];
142 [label="Exit left part of ||"];
143 [label="Enter right part of ||"];
144 [label="Const: Boolean(false)"];
145 [label="Exit ||"];
}
146 [label="Exit when branch condition"];
}
147 [label="Synthetic else branch"];
148 [label="Enter when branch result"];
subgraph cluster_36 {
color=blue
149 [label="Enter block"];
150 [label="Access variable R|<local>/x|"];
151 [label="Function call: R|<local>/x|.<Unresolved name: foo>#()"];
152 [label="Exit block"];
}
153 [label="Exit when branch result"];
154 [label="Exit when"];
}
155 [label="Exit function test_7" style="filled" fillcolor=red];
}
136 -> {137};
137 -> {138};
138 -> {139};
139 -> {140};
140 -> {141};
141 -> {142};
142 -> {145 143};
143 -> {144};
144 -> {145};
145 -> {146};
146 -> {148 147};
147 -> {154};
148 -> {149};
149 -> {150};
150 -> {151};
151 -> {152};
152 -> {153};
153 -> {154};
154 -> {155};
subgraph cluster_37 {
color=red
156 [label="Enter function test_8" style="filled" fillcolor=red];
subgraph cluster_38 {
color=blue
157 [label="Enter when"];
subgraph cluster_39 {
color=blue
158 [label="Enter when branch condition "];
subgraph cluster_40 {
color=blue
159 [label="Enter ||"];
160 [label="Const: Boolean(false)"];
161 [label="Exit left part of ||"];
162 [label="Enter right part of ||"];
163 [label="Access variable R|<local>/x|"];
164 [label="Type operator: (R|<local>/x| is R|A|)"];
165 [label="Exit ||"];
}
166 [label="Exit when branch condition"];
}
167 [label="Synthetic else branch"];
168 [label="Enter when branch result"];
subgraph cluster_41 {
color=blue
169 [label="Enter block"];
170 [label="Access variable R|<local>/x|"];
171 [label="Function call: R|<local>/x|.<Unresolved name: foo>#()"];
172 [label="Exit block"];
}
173 [label="Exit when branch result"];
174 [label="Exit when"];
}
175 [label="Exit function test_8" style="filled" fillcolor=red];
}
156 -> {157};
157 -> {158};
158 -> {159};
159 -> {160};
160 -> {161};
161 -> {162};
161 -> {165} [style=dotted];
162 -> {163};
163 -> {164};
164 -> {165};
165 -> {166};
166 -> {168 167};
167 -> {174};
168 -> {169};
169 -> {170};
170 -> {171};
171 -> {172};
172 -> {173};
173 -> {174};
174 -> {175};
subgraph cluster_42 {
color=red
176 [label="Enter function test_9" style="filled" fillcolor=red];
subgraph cluster_43 {
color=blue
177 [label="Enter when"];
subgraph cluster_44 {
color=blue
178 [label="Enter when branch condition "];
subgraph cluster_45 {
color=blue
179 [label="Enter ||"];
180 [label="Access variable R|<local>/x|"];
181 [label="Type operator: (R|<local>/x| is R|A|)"];
182 [label="Exit left part of ||"];
183 [label="Enter right part of ||"];
184 [label="Const: Boolean(true)"];
185 [label="Exit ||"];
}
186 [label="Exit when branch condition"];
}
187 [label="Synthetic else branch"];
188 [label="Enter when branch result"];
subgraph cluster_46 {
color=blue
189 [label="Enter block"];
190 [label="Access variable R|<local>/x|"];
191 [label="Function call: R|<local>/x|.<Unresolved name: foo>#()"];
192 [label="Exit block"];
}
193 [label="Exit when branch result"];
194 [label="Exit when"];
}
195 [label="Exit function test_9" style="filled" fillcolor=red];
}
176 -> {177};
177 -> {178};
178 -> {179};
179 -> {180};
180 -> {181};
181 -> {182};
182 -> {185 183};
183 -> {184};
184 -> {185};
185 -> {186};
186 -> {188 187};
187 -> {194};
188 -> {189};
189 -> {190};
190 -> {191};
191 -> {192};
192 -> {193};
193 -> {194};
194 -> {195};
subgraph cluster_47 {
color=red
196 [label="Enter function test_10" style="filled" fillcolor=red];
subgraph cluster_48 {
color=blue
197 [label="Enter when"];
subgraph cluster_49 {
color=blue
198 [label="Enter when branch condition "];
subgraph cluster_50 {
color=blue
199 [label="Enter ||"];
200 [label="Const: Boolean(true)"];
201 [label="Exit left part of ||"];
202 [label="Enter right part of ||" style="filled" fillcolor=gray];
203 [label="Access variable R|<local>/x|" style="filled" fillcolor=gray];
204 [label="Type operator: (R|<local>/x| is R|A|)" style="filled" fillcolor=gray];
205 [label="Exit ||"];
}
206 [label="Exit when branch condition"];
}
207 [label="Synthetic else branch"];
208 [label="Enter when branch result"];
subgraph cluster_51 {
color=blue
209 [label="Enter block"];
210 [label="Access variable R|<local>/x|"];
211 [label="Function call: R|<local>/x|.<Unresolved name: foo>#()"];
212 [label="Exit block"];
}
213 [label="Exit when branch result"];
214 [label="Exit when"];
}
215 [label="Exit function test_10" style="filled" fillcolor=red];
}
196 -> {197};
197 -> {198};
198 -> {199};
199 -> {200};
200 -> {201};
201 -> {205};
201 -> {202} [style=dotted];
202 -> {203} [style=dotted];
203 -> {204} [style=dotted];
204 -> {205} [style=dotted];
205 -> {206};
206 -> {208 207};
207 -> {214};
208 -> {209};
209 -> {210};
210 -> {211};
211 -> {212};
212 -> {213};
213 -> {214};
214 -> {215};
subgraph cluster_52 {
color=red
216 [label="Enter function test_11" style="filled" fillcolor=red];
subgraph cluster_53 {
color=blue
217 [label="Enter when"];
subgraph cluster_54 {
color=blue
218 [label="Enter when branch condition "];
subgraph cluster_55 {
color=blue
219 [label="Enter &&"];
220 [label="Const: Boolean(false)"];
221 [label="Exit left part of &&"];
222 [label="Enter right part of &&" style="filled" fillcolor=gray];
223 [label="Access variable R|<local>/x|" style="filled" fillcolor=gray];
224 [label="Type operator: (R|<local>/x| is R|A|)" style="filled" fillcolor=gray];
225 [label="Exit &&"];
}
226 [label="Exit when branch condition"];
}
227 [label="Synthetic else branch"];
228 [label="Enter when branch result"];
subgraph cluster_56 {
color=blue
229 [label="Enter block"];
230 [label="Access variable R|<local>/x|"];
231 [label="Function call: R|<local>/x|.<Unresolved name: foo>#()"];
232 [label="Exit block"];
}
233 [label="Exit when branch result"];
234 [label="Exit when"];
}
235 [label="Exit function test_11" style="filled" fillcolor=red];
}
216 -> {217};
217 -> {218};
218 -> {219};
219 -> {220};
220 -> {221};
221 -> {225};
221 -> {222} [style=dotted];
222 -> {223} [style=dotted];
223 -> {224} [style=dotted];
224 -> {225} [style=dotted];
225 -> {226};
226 -> {228 227};
227 -> {234};
228 -> {229};
229 -> {230};
230 -> {231};
231 -> {232};
232 -> {233};
233 -> {234};
234 -> {235};
subgraph cluster_57 {
color=red
236 [label="Enter function test_12" style="filled" fillcolor=red];
subgraph cluster_58 {
color=blue
237 [label="Enter when"];
subgraph cluster_59 {
color=blue
238 [label="Enter when branch condition "];
subgraph cluster_60 {
color=blue
239 [label="Enter &&"];
240 [label="Access variable R|<local>/x|"];
241 [label="Type operator: (R|<local>/x| is R|A|)"];
242 [label="Exit left part of &&"];
243 [label="Enter right part of &&"];
244 [label="Const: Boolean(false)"];
245 [label="Exit &&"];
}
246 [label="Exit when branch condition"];
}
247 [label="Synthetic else branch"];
248 [label="Enter when branch result"];
subgraph cluster_61 {
color=blue
249 [label="Enter block"];
250 [label="Access variable R|<local>/x|"];
251 [label="Function call: R|<local>/x|.R|/A.foo|()"];
252 [label="Exit block"];
}
253 [label="Exit when branch result"];
254 [label="Exit when"];
}
255 [label="Exit function test_12" style="filled" fillcolor=red];
}
236 -> {237};
237 -> {238};
238 -> {239};
239 -> {240};
240 -> {241};
241 -> {242};
242 -> {245 243};
243 -> {244};
244 -> {245};
245 -> {246};
246 -> {248 247};
247 -> {254};
248 -> {249};
249 -> {250};
250 -> {251};
251 -> {252};
252 -> {253};
253 -> {254};
254 -> {255};
subgraph cluster_62 {
color=red
256 [label="Enter function test_13" style="filled" fillcolor=red];
subgraph cluster_63 {
color=blue
257 [label="Enter when"];
subgraph cluster_64 {
color=blue
258 [label="Enter when branch condition "];
subgraph cluster_65 {
color=blue
259 [label="Enter &&"];
260 [label="Const: Boolean(true)"];
261 [label="Exit left part of &&"];
262 [label="Enter right part of &&"];
263 [label="Access variable R|<local>/x|"];
264 [label="Type operator: (R|<local>/x| is R|A|)"];
265 [label="Exit &&"];
}
266 [label="Exit when branch condition"];
}
267 [label="Synthetic else branch"];
268 [label="Enter when branch result"];
subgraph cluster_66 {
color=blue
269 [label="Enter block"];
270 [label="Access variable R|<local>/x|"];
271 [label="Function call: R|<local>/x|.R|/A.foo|()"];
272 [label="Exit block"];
}
273 [label="Exit when branch result"];
274 [label="Exit when"];
}
275 [label="Exit function test_13" style="filled" fillcolor=red];
}
256 -> {257};
257 -> {258};
258 -> {259};
259 -> {260};
260 -> {261};
261 -> {262};
261 -> {265} [style=dotted];
262 -> {263};
263 -> {264};
264 -> {265};
265 -> {266};
266 -> {268 267};
267 -> {274};
268 -> {269};
269 -> {270};
270 -> {271};
271 -> {272};
272 -> {273};
273 -> {274};
274 -> {275};
subgraph cluster_67 {
color=red
276 [label="Enter function test_14" style="filled" fillcolor=red];
subgraph cluster_68 {
color=blue
277 [label="Enter when"];
subgraph cluster_69 {
color=blue
278 [label="Enter when branch condition "];
subgraph cluster_70 {
color=blue
279 [label="Enter &&"];
280 [label="Access variable R|<local>/x|"];
281 [label="Type operator: (R|<local>/x| is R|A|)"];
282 [label="Exit left part of &&"];
283 [label="Enter right part of &&"];
284 [label="Const: Boolean(false)"];
285 [label="Exit &&"];
}
286 [label="Exit when branch condition"];
}
287 [label="Synthetic else branch"];
288 [label="Enter when branch result"];
subgraph cluster_71 {
color=blue
289 [label="Enter block"];
290 [label="Access variable R|<local>/x|"];
291 [label="Function call: R|<local>/x|.R|/A.foo|()"];
292 [label="Exit block"];
}
293 [label="Exit when branch result"];
294 [label="Exit when"];
}
295 [label="Exit function test_14" style="filled" fillcolor=red];
}
276 -> {277};
277 -> {278};
278 -> {279};
279 -> {280};
280 -> {281};
281 -> {282};
282 -> {285 283};
283 -> {284};
284 -> {285};
285 -> {286};
286 -> {288 287};
287 -> {294};
288 -> {289};
289 -> {290};
290 -> {291};
291 -> {292};
292 -> {293};
293 -> {294};
294 -> {295};
}
@@ -0,0 +1,109 @@
// !DUMP_CFG
interface A {
fun foo()
fun bool(): Boolean
}
interface B : A {
fun bar()
}
interface C : A {
fun baz()
}
fun test_1(x: Any) {
if (x is B && x is C) {
x.foo()
x.bar()
x.baz()
}
}
fun test_2(x: Any) {
if (x is B || x is C) {
x.foo()
x.<!UNRESOLVED_REFERENCE!>bar<!>()
x.<!UNRESOLVED_REFERENCE!>baz<!>()
}
}
fun test_3(x: Any) {
if (!(x !is A)) {
x.foo()
}
}
fun test_4(x: Any) {
if (x !is String || x.length == 0) {
x.<!UNRESOLVED_REFERENCE!>length<!>
}
x.<!UNRESOLVED_REFERENCE!>length<!>
}
fun test_5(x: Any) {
if (x is A && x.bool()) {
x.foo()
}
}
fun test_6(x: Any) {
if ((x !is A).not()) {
x.foo()
}
}
// || and const
fun test_7(x: Any) {
if (x is A || false) {
// TODO: should be smartcast
x.<!UNRESOLVED_REFERENCE!>foo<!>()
}
}
fun test_8(x: Any) {
if (false || x is A) {
// TODO: should be smartcast
x.<!UNRESOLVED_REFERENCE!>foo<!>()
}
}
fun test_9(x: Any) {
if (x is A || true) {
x.<!UNRESOLVED_REFERENCE!>foo<!>()
}
}
fun test_10(x: Any) {
if (true || x is A) {
x.<!UNRESOLVED_REFERENCE!>foo<!>()
}
}
// && and const
fun test_11(x: Any, b: Boolean) {
if (false && x is A) {
x.<!UNRESOLVED_REFERENCE!>foo<!>()
}
}
fun test_12(x: Any, b: Boolean) {
if (x is A && false) {
x.foo()
}
}
fun test_13(x: Any, b: Boolean) {
if (true && x is A) {
x.foo()
}
}
fun test_14(x: Any, b: Boolean) {
if (x is A && false) {
x.foo()
}
}
@@ -0,0 +1,132 @@
FILE: booleanOperators.kt
public abstract interface A : R|kotlin/Any| {
public abstract fun foo(): R|kotlin/Unit|
public abstract fun bool(): R|kotlin/Boolean|
}
public abstract interface B : R|A| {
public abstract fun bar(): R|kotlin/Unit|
}
public abstract interface C : R|A| {
public abstract fun baz(): R|kotlin/Unit|
}
public final fun test_1(x: R|kotlin/Any|): R|kotlin/Unit| {
when () {
(R|<local>/x| is R|B|) && (R|<local>/x| is R|C|) -> {
R|<local>/x|.R|/A.foo|()
R|<local>/x|.R|/B.bar|()
R|<local>/x|.R|/C.baz|()
}
}
}
public final fun test_2(x: R|kotlin/Any|): R|kotlin/Unit| {
when () {
(R|<local>/x| is R|B|) || (R|<local>/x| is R|C|) -> {
R|<local>/x|.R|/A.foo|()
R|<local>/x|.<Unresolved name: bar>#()
R|<local>/x|.<Unresolved name: baz>#()
}
}
}
public final fun test_3(x: R|kotlin/Any|): R|kotlin/Unit| {
when () {
(R|<local>/x| !is R|A|).R|kotlin/Boolean.not|() -> {
R|<local>/x|.R|/A.foo|()
}
}
}
public final fun test_4(x: R|kotlin/Any|): R|kotlin/Unit| {
when () {
(R|<local>/x| !is R|kotlin/String|) || ==(R|<local>/x|.R|kotlin/String.length|, Int(0)) -> {
R|<local>/x|.<Unresolved name: length>#
}
}
R|<local>/x|.<Unresolved name: length>#
}
public final fun test_5(x: R|kotlin/Any|): R|kotlin/Unit| {
when () {
(R|<local>/x| is R|A|) && R|<local>/x|.R|/A.bool|() -> {
R|<local>/x|.R|/A.foo|()
}
}
}
public final fun test_6(x: R|kotlin/Any|): R|kotlin/Unit| {
when () {
(R|<local>/x| !is R|A|).R|kotlin/Boolean.not|() -> {
R|<local>/x|.R|/A.foo|()
}
}
}
public final fun test_7(x: R|kotlin/Any|): R|kotlin/Unit| {
when () {
(R|<local>/x| is R|A|) || Boolean(false) -> {
R|<local>/x|.<Unresolved name: foo>#()
}
}
}
public final fun test_8(x: R|kotlin/Any|): R|kotlin/Unit| {
when () {
Boolean(false) || (R|<local>/x| is R|A|) -> {
R|<local>/x|.<Unresolved name: foo>#()
}
}
}
public final fun test_9(x: R|kotlin/Any|): R|kotlin/Unit| {
when () {
(R|<local>/x| is R|A|) || Boolean(true) -> {
R|<local>/x|.<Unresolved name: foo>#()
}
}
}
public final fun test_10(x: R|kotlin/Any|): R|kotlin/Unit| {
when () {
Boolean(true) || (R|<local>/x| is R|A|) -> {
R|<local>/x|.<Unresolved name: foo>#()
}
}
}
public final fun test_11(x: R|kotlin/Any|, b: R|kotlin/Boolean|): R|kotlin/Unit| {
when () {
Boolean(false) && (R|<local>/x| is R|A|) -> {
R|<local>/x|.<Unresolved name: foo>#()
}
}
}
public final fun test_12(x: R|kotlin/Any|, b: R|kotlin/Boolean|): R|kotlin/Unit| {
when () {
(R|<local>/x| is R|A|) && Boolean(false) -> {
R|<local>/x|.R|/A.foo|()
}
}
}
public final fun test_13(x: R|kotlin/Any|, b: R|kotlin/Boolean|): R|kotlin/Unit| {
when () {
Boolean(true) && (R|<local>/x| is R|A|) -> {
R|<local>/x|.R|/A.foo|()
}
}
}
public final fun test_14(x: R|kotlin/Any|, b: R|kotlin/Boolean|): R|kotlin/Unit| {
when () {
(R|<local>/x| is R|A|) && Boolean(false) -> {
R|<local>/x|.R|/A.foo|()
}
}
}
@@ -0,0 +1,582 @@
digraph equalsToBoolean_kt {
graph [nodesep=3]
node [shape=box penwidth=2]
edge [penwidth=2]
subgraph cluster_0 {
color=red
0 [label="Enter function foo" style="filled" fillcolor=red];
1 [label="Exit function foo" style="filled" fillcolor=red];
}
0 -> {1};
subgraph cluster_1 {
color=red
2 [label="Enter function getter" style="filled" fillcolor=red];
3 [label="Exit function getter" style="filled" fillcolor=red];
}
2 -> {3};
subgraph cluster_2 {
color=red
4 [label="Enter property" style="filled" fillcolor=red];
5 [label="Exit property" style="filled" fillcolor=red];
}
4 -> {5};
subgraph cluster_3 {
color=red
6 [label="Enter function test_1" style="filled" fillcolor=red];
subgraph cluster_4 {
color=blue
7 [label="Enter when"];
subgraph cluster_5 {
color=blue
8 [label="Enter when branch condition "];
9 [label="Access variable R|<local>/b|"];
10 [label="Const: Boolean(true)"];
11 [label="Operator =="];
12 [label="Const: Boolean(true)"];
13 [label="Operator =="];
14 [label="Exit when branch condition"];
}
subgraph cluster_6 {
color=blue
15 [label="Enter when branch condition else"];
16 [label="Exit when branch condition"];
}
17 [label="Enter when branch result"];
subgraph cluster_7 {
color=blue
18 [label="Enter block"];
19 [label="Access variable R|<local>/b|"];
20 [label="Function call: R|<local>/b|.<Inapplicable(WRONG_RECEIVER): [kotlin/Boolean.not]>#()"];
21 [label="Exit block"];
}
22 [label="Exit when branch result"];
23 [label="Enter when branch result"];
subgraph cluster_8 {
color=blue
24 [label="Enter block"];
25 [label="Access variable R|<local>/b|"];
26 [label="Function call: R|<local>/b|.R|kotlin/Boolean.not|()"];
27 [label="Exit block"];
}
28 [label="Exit when branch result"];
29 [label="Exit when"];
}
30 [label="Exit function test_1" style="filled" fillcolor=red];
}
6 -> {7};
7 -> {8};
8 -> {9};
9 -> {10};
10 -> {11};
11 -> {12};
12 -> {13};
13 -> {14};
14 -> {23 15};
15 -> {16};
16 -> {17};
17 -> {18};
18 -> {19};
19 -> {20};
20 -> {21};
21 -> {22};
22 -> {29};
23 -> {24};
24 -> {25};
25 -> {26};
26 -> {27};
27 -> {28};
28 -> {29};
29 -> {30};
subgraph cluster_9 {
color=red
31 [label="Enter function test_2" style="filled" fillcolor=red];
subgraph cluster_10 {
color=blue
32 [label="Enter when"];
subgraph cluster_11 {
color=blue
33 [label="Enter when branch condition "];
34 [label="Access variable R|<local>/b|"];
35 [label="Const: Boolean(true)"];
36 [label="Operator =="];
37 [label="Const: Boolean(true)"];
38 [label="Operator !="];
39 [label="Exit when branch condition"];
}
subgraph cluster_12 {
color=blue
40 [label="Enter when branch condition else"];
41 [label="Exit when branch condition"];
}
42 [label="Enter when branch result"];
subgraph cluster_13 {
color=blue
43 [label="Enter block"];
44 [label="Access variable R|<local>/b|"];
45 [label="Function call: R|<local>/b|.R|kotlin/Boolean.not|()"];
46 [label="Exit block"];
}
47 [label="Exit when branch result"];
48 [label="Enter when branch result"];
subgraph cluster_14 {
color=blue
49 [label="Enter block"];
50 [label="Access variable R|<local>/b|"];
51 [label="Function call: R|<local>/b|.<Inapplicable(WRONG_RECEIVER): [kotlin/Boolean.not]>#()"];
52 [label="Exit block"];
}
53 [label="Exit when branch result"];
54 [label="Exit when"];
}
55 [label="Exit function test_2" style="filled" fillcolor=red];
}
31 -> {32};
32 -> {33};
33 -> {34};
34 -> {35};
35 -> {36};
36 -> {37};
37 -> {38};
38 -> {39};
39 -> {48 40};
40 -> {41};
41 -> {42};
42 -> {43};
43 -> {44};
44 -> {45};
45 -> {46};
46 -> {47};
47 -> {54};
48 -> {49};
49 -> {50};
50 -> {51};
51 -> {52};
52 -> {53};
53 -> {54};
54 -> {55};
subgraph cluster_15 {
color=red
56 [label="Enter function test_3" style="filled" fillcolor=red];
subgraph cluster_16 {
color=blue
57 [label="Enter when"];
subgraph cluster_17 {
color=blue
58 [label="Enter when branch condition "];
59 [label="Access variable R|<local>/b|"];
60 [label="Const: Boolean(true)"];
61 [label="Operator =="];
62 [label="Const: Boolean(false)"];
63 [label="Operator =="];
64 [label="Exit when branch condition"];
}
subgraph cluster_18 {
color=blue
65 [label="Enter when branch condition else"];
66 [label="Exit when branch condition"];
}
67 [label="Enter when branch result"];
subgraph cluster_19 {
color=blue
68 [label="Enter block"];
69 [label="Access variable R|<local>/b|"];
70 [label="Function call: R|<local>/b|.R|kotlin/Boolean.not|()"];
71 [label="Exit block"];
}
72 [label="Exit when branch result"];
73 [label="Enter when branch result"];
subgraph cluster_20 {
color=blue
74 [label="Enter block"];
75 [label="Access variable R|<local>/b|"];
76 [label="Function call: R|<local>/b|.<Inapplicable(WRONG_RECEIVER): [kotlin/Boolean.not]>#()"];
77 [label="Exit block"];
}
78 [label="Exit when branch result"];
79 [label="Exit when"];
}
80 [label="Exit function test_3" style="filled" fillcolor=red];
}
56 -> {57};
57 -> {58};
58 -> {59};
59 -> {60};
60 -> {61};
61 -> {62};
62 -> {63};
63 -> {64};
64 -> {73 65};
65 -> {66};
66 -> {67};
67 -> {68};
68 -> {69};
69 -> {70};
70 -> {71};
71 -> {72};
72 -> {79};
73 -> {74};
74 -> {75};
75 -> {76};
76 -> {77};
77 -> {78};
78 -> {79};
79 -> {80};
subgraph cluster_21 {
color=red
81 [label="Enter function test_4" style="filled" fillcolor=red];
subgraph cluster_22 {
color=blue
82 [label="Enter when"];
subgraph cluster_23 {
color=blue
83 [label="Enter when branch condition "];
84 [label="Access variable R|<local>/b|"];
85 [label="Const: Boolean(true)"];
86 [label="Operator =="];
87 [label="Const: Boolean(false)"];
88 [label="Operator !="];
89 [label="Exit when branch condition"];
}
subgraph cluster_24 {
color=blue
90 [label="Enter when branch condition else"];
91 [label="Exit when branch condition"];
}
92 [label="Enter when branch result"];
subgraph cluster_25 {
color=blue
93 [label="Enter block"];
94 [label="Access variable R|<local>/b|"];
95 [label="Function call: R|<local>/b|.<Inapplicable(WRONG_RECEIVER): [kotlin/Boolean.not]>#()"];
96 [label="Exit block"];
}
97 [label="Exit when branch result"];
98 [label="Enter when branch result"];
subgraph cluster_26 {
color=blue
99 [label="Enter block"];
100 [label="Access variable R|<local>/b|"];
101 [label="Function call: R|<local>/b|.R|kotlin/Boolean.not|()"];
102 [label="Exit block"];
}
103 [label="Exit when branch result"];
104 [label="Exit when"];
}
105 [label="Exit function test_4" style="filled" fillcolor=red];
}
81 -> {82};
82 -> {83};
83 -> {84};
84 -> {85};
85 -> {86};
86 -> {87};
87 -> {88};
88 -> {89};
89 -> {98 90};
90 -> {91};
91 -> {92};
92 -> {93};
93 -> {94};
94 -> {95};
95 -> {96};
96 -> {97};
97 -> {104};
98 -> {99};
99 -> {100};
100 -> {101};
101 -> {102};
102 -> {103};
103 -> {104};
104 -> {105};
subgraph cluster_27 {
color=red
106 [label="Enter function test_5" style="filled" fillcolor=red];
subgraph cluster_28 {
color=blue
107 [label="Enter when"];
subgraph cluster_29 {
color=blue
108 [label="Enter when branch condition "];
109 [label="Access variable R|<local>/b|"];
110 [label="Const: Boolean(true)"];
111 [label="Operator !="];
112 [label="Const: Boolean(true)"];
113 [label="Operator =="];
114 [label="Exit when branch condition"];
}
subgraph cluster_30 {
color=blue
115 [label="Enter when branch condition else"];
116 [label="Exit when branch condition"];
}
117 [label="Enter when branch result"];
subgraph cluster_31 {
color=blue
118 [label="Enter block"];
119 [label="Access variable R|<local>/b|"];
120 [label="Function call: R|<local>/b|.R|kotlin/Boolean.not|()"];
121 [label="Exit block"];
}
122 [label="Exit when branch result"];
123 [label="Enter when branch result"];
subgraph cluster_32 {
color=blue
124 [label="Enter block"];
125 [label="Access variable R|<local>/b|"];
126 [label="Function call: R|<local>/b|.<Inapplicable(WRONG_RECEIVER): [kotlin/Boolean.not]>#()"];
127 [label="Exit block"];
}
128 [label="Exit when branch result"];
129 [label="Exit when"];
}
130 [label="Exit function test_5" style="filled" fillcolor=red];
}
106 -> {107};
107 -> {108};
108 -> {109};
109 -> {110};
110 -> {111};
111 -> {112};
112 -> {113};
113 -> {114};
114 -> {123 115};
115 -> {116};
116 -> {117};
117 -> {118};
118 -> {119};
119 -> {120};
120 -> {121};
121 -> {122};
122 -> {129};
123 -> {124};
124 -> {125};
125 -> {126};
126 -> {127};
127 -> {128};
128 -> {129};
129 -> {130};
subgraph cluster_33 {
color=red
131 [label="Enter function test_6" style="filled" fillcolor=red];
subgraph cluster_34 {
color=blue
132 [label="Enter when"];
subgraph cluster_35 {
color=blue
133 [label="Enter when branch condition "];
134 [label="Access variable R|<local>/b|"];
135 [label="Const: Boolean(true)"];
136 [label="Operator !="];
137 [label="Const: Boolean(true)"];
138 [label="Operator !="];
139 [label="Exit when branch condition"];
}
subgraph cluster_36 {
color=blue
140 [label="Enter when branch condition else"];
141 [label="Exit when branch condition"];
}
142 [label="Enter when branch result"];
subgraph cluster_37 {
color=blue
143 [label="Enter block"];
144 [label="Access variable R|<local>/b|"];
145 [label="Function call: R|<local>/b|.<Inapplicable(WRONG_RECEIVER): [kotlin/Boolean.not]>#()"];
146 [label="Exit block"];
}
147 [label="Exit when branch result"];
148 [label="Enter when branch result"];
subgraph cluster_38 {
color=blue
149 [label="Enter block"];
150 [label="Access variable R|<local>/b|"];
151 [label="Function call: R|<local>/b|.R|kotlin/Boolean.not|()"];
152 [label="Exit block"];
}
153 [label="Exit when branch result"];
154 [label="Exit when"];
}
155 [label="Exit function test_6" style="filled" fillcolor=red];
}
131 -> {132};
132 -> {133};
133 -> {134};
134 -> {135};
135 -> {136};
136 -> {137};
137 -> {138};
138 -> {139};
139 -> {148 140};
140 -> {141};
141 -> {142};
142 -> {143};
143 -> {144};
144 -> {145};
145 -> {146};
146 -> {147};
147 -> {154};
148 -> {149};
149 -> {150};
150 -> {151};
151 -> {152};
152 -> {153};
153 -> {154};
154 -> {155};
subgraph cluster_39 {
color=red
156 [label="Enter function test_7" style="filled" fillcolor=red];
subgraph cluster_40 {
color=blue
157 [label="Enter when"];
subgraph cluster_41 {
color=blue
158 [label="Enter when branch condition "];
159 [label="Access variable R|<local>/b|"];
160 [label="Const: Boolean(true)"];
161 [label="Operator !="];
162 [label="Const: Boolean(false)"];
163 [label="Operator =="];
164 [label="Exit when branch condition"];
}
subgraph cluster_42 {
color=blue
165 [label="Enter when branch condition else"];
166 [label="Exit when branch condition"];
}
167 [label="Enter when branch result"];
subgraph cluster_43 {
color=blue
168 [label="Enter block"];
169 [label="Access variable R|<local>/b|"];
170 [label="Function call: R|<local>/b|.<Inapplicable(WRONG_RECEIVER): [kotlin/Boolean.not]>#()"];
171 [label="Exit block"];
}
172 [label="Exit when branch result"];
173 [label="Enter when branch result"];
subgraph cluster_44 {
color=blue
174 [label="Enter block"];
175 [label="Access variable R|<local>/b|"];
176 [label="Function call: R|<local>/b|.R|kotlin/Boolean.not|()"];
177 [label="Exit block"];
}
178 [label="Exit when branch result"];
179 [label="Exit when"];
}
180 [label="Exit function test_7" style="filled" fillcolor=red];
}
156 -> {157};
157 -> {158};
158 -> {159};
159 -> {160};
160 -> {161};
161 -> {162};
162 -> {163};
163 -> {164};
164 -> {173 165};
165 -> {166};
166 -> {167};
167 -> {168};
168 -> {169};
169 -> {170};
170 -> {171};
171 -> {172};
172 -> {179};
173 -> {174};
174 -> {175};
175 -> {176};
176 -> {177};
177 -> {178};
178 -> {179};
179 -> {180};
subgraph cluster_45 {
color=red
181 [label="Enter function test_8" style="filled" fillcolor=red];
subgraph cluster_46 {
color=blue
182 [label="Enter when"];
subgraph cluster_47 {
color=blue
183 [label="Enter when branch condition "];
184 [label="Access variable R|<local>/b|"];
185 [label="Const: Boolean(true)"];
186 [label="Operator !="];
187 [label="Const: Boolean(false)"];
188 [label="Operator !="];
189 [label="Exit when branch condition"];
}
subgraph cluster_48 {
color=blue
190 [label="Enter when branch condition else"];
191 [label="Exit when branch condition"];
}
192 [label="Enter when branch result"];
subgraph cluster_49 {
color=blue
193 [label="Enter block"];
194 [label="Access variable R|<local>/b|"];
195 [label="Function call: R|<local>/b|.R|kotlin/Boolean.not|()"];
196 [label="Exit block"];
}
197 [label="Exit when branch result"];
198 [label="Enter when branch result"];
subgraph cluster_50 {
color=blue
199 [label="Enter block"];
200 [label="Access variable R|<local>/b|"];
201 [label="Function call: R|<local>/b|.<Inapplicable(WRONG_RECEIVER): [kotlin/Boolean.not]>#()"];
202 [label="Exit block"];
}
203 [label="Exit when branch result"];
204 [label="Exit when"];
}
205 [label="Exit function test_8" style="filled" fillcolor=red];
}
181 -> {182};
182 -> {183};
183 -> {184};
184 -> {185};
185 -> {186};
186 -> {187};
187 -> {188};
188 -> {189};
189 -> {198 190};
190 -> {191};
191 -> {192};
192 -> {193};
193 -> {194};
194 -> {195};
195 -> {196};
196 -> {197};
197 -> {204};
198 -> {199};
199 -> {200};
200 -> {201};
201 -> {202};
202 -> {203};
203 -> {204};
204 -> {205};
}
@@ -0,0 +1,69 @@
// !DUMP_CFG
interface A {
fun foo()
val b: Boolean
}
fun test_1(b: Boolean?) {
if ((b == true) == true) {
b.not() // OK
} else {
b.<!INAPPLICABLE_CANDIDATE!>not<!>() // Bad
}
}
fun test_2(b: Boolean?) {
if ((b == true) != true) {
b.<!INAPPLICABLE_CANDIDATE!>not<!>() // Bad
} else {
b.not() // OK
}
}
fun test_3(b: Boolean?) {
if ((b == true) == false) {
b.<!INAPPLICABLE_CANDIDATE!>not<!>() // Bad
} else {
b.not() // OK
}
}
fun test_4(b: Boolean?) {
if ((b == true) != false) {
b.not() // OK
} else {
b.<!INAPPLICABLE_CANDIDATE!>not<!>() // Bad
}
}
fun test_5(b: Boolean?) {
if ((b != true) == true) {
b.<!INAPPLICABLE_CANDIDATE!>not<!>() // Bad
} else {
b.not() // OK
}
}
fun test_6(b: Boolean?) {
if ((b != true) != true) {
b.not() // OK
} else {
b.<!INAPPLICABLE_CANDIDATE!>not<!>() // Bad
}
}
fun test_7(b: Boolean?) {
if ((b != true) == false) {
b.not() // OK
} else {
b.<!INAPPLICABLE_CANDIDATE!>not<!>() // Bad
}
}
fun test_8(b: Boolean?) {
if ((b != true) != false) {
b.<!INAPPLICABLE_CANDIDATE!>not<!>() // Bad
} else {
b.not() // OK
}
}
@@ -0,0 +1,96 @@
FILE: equalsToBoolean.kt
public abstract interface A : R|kotlin/Any| {
public abstract fun foo(): R|kotlin/Unit|
public abstract val b: R|kotlin/Boolean|
public get(): R|kotlin/Boolean|
}
public final fun test_1(b: R|kotlin/Boolean?|): R|kotlin/Unit| {
when () {
==(==(R|<local>/b|, Boolean(true)), Boolean(true)) -> {
R|<local>/b|.R|kotlin/Boolean.not|()
}
else -> {
R|<local>/b|.<Inapplicable(WRONG_RECEIVER): [kotlin/Boolean.not]>#()
}
}
}
public final fun test_2(b: R|kotlin/Boolean?|): R|kotlin/Unit| {
when () {
!=(==(R|<local>/b|, Boolean(true)), Boolean(true)) -> {
R|<local>/b|.<Inapplicable(WRONG_RECEIVER): [kotlin/Boolean.not]>#()
}
else -> {
R|<local>/b|.R|kotlin/Boolean.not|()
}
}
}
public final fun test_3(b: R|kotlin/Boolean?|): R|kotlin/Unit| {
when () {
==(==(R|<local>/b|, Boolean(true)), Boolean(false)) -> {
R|<local>/b|.<Inapplicable(WRONG_RECEIVER): [kotlin/Boolean.not]>#()
}
else -> {
R|<local>/b|.R|kotlin/Boolean.not|()
}
}
}
public final fun test_4(b: R|kotlin/Boolean?|): R|kotlin/Unit| {
when () {
!=(==(R|<local>/b|, Boolean(true)), Boolean(false)) -> {
R|<local>/b|.R|kotlin/Boolean.not|()
}
else -> {
R|<local>/b|.<Inapplicable(WRONG_RECEIVER): [kotlin/Boolean.not]>#()
}
}
}
public final fun test_5(b: R|kotlin/Boolean?|): R|kotlin/Unit| {
when () {
==(!=(R|<local>/b|, Boolean(true)), Boolean(true)) -> {
R|<local>/b|.<Inapplicable(WRONG_RECEIVER): [kotlin/Boolean.not]>#()
}
else -> {
R|<local>/b|.R|kotlin/Boolean.not|()
}
}
}
public final fun test_6(b: R|kotlin/Boolean?|): R|kotlin/Unit| {
when () {
!=(!=(R|<local>/b|, Boolean(true)), Boolean(true)) -> {
R|<local>/b|.R|kotlin/Boolean.not|()
}
else -> {
R|<local>/b|.<Inapplicable(WRONG_RECEIVER): [kotlin/Boolean.not]>#()
}
}
}
public final fun test_7(b: R|kotlin/Boolean?|): R|kotlin/Unit| {
when () {
==(!=(R|<local>/b|, Boolean(true)), Boolean(false)) -> {
R|<local>/b|.R|kotlin/Boolean.not|()
}
else -> {
R|<local>/b|.<Inapplicable(WRONG_RECEIVER): [kotlin/Boolean.not]>#()
}
}
}
public final fun test_8(b: R|kotlin/Boolean?|): R|kotlin/Unit| {
when () {
!=(!=(R|<local>/b|, Boolean(true)), Boolean(false)) -> {
R|<local>/b|.<Inapplicable(WRONG_RECEIVER): [kotlin/Boolean.not]>#()
}
else -> {
R|<local>/b|.R|kotlin/Boolean.not|()
}
}
}
@@ -0,0 +1,426 @@
digraph jumpFromRhsOfOperator_kt {
graph [nodesep=3]
node [shape=box penwidth=2]
edge [penwidth=2]
subgraph cluster_0 {
color=red
0 [label="Enter function foo" style="filled" fillcolor=red];
1 [label="Exit function foo" style="filled" fillcolor=red];
}
0 -> {1};
subgraph cluster_1 {
color=red
2 [label="Enter function test_1" style="filled" fillcolor=red];
subgraph cluster_2 {
color=blue
3 [label="Enter ||"];
4 [label="Access variable R|<local>/a|"];
5 [label="Const: Null(null)"];
6 [label="Operator !="];
7 [label="Exit left part of ||"];
8 [label="Enter right part of ||"];
9 [label="Function call: R|java/lang/Exception.Exception|()"];
10 [label="Throw: throw R|java/lang/Exception.Exception|()"];
11 [label="Stub" style="filled" fillcolor=gray];
12 [label="Exit ||"];
}
13 [label="Access variable R|<local>/a|"];
14 [label="Function call: R|<local>/a|.R|/A.foo|()"];
15 [label="Exit function test_1" style="filled" fillcolor=red];
}
2 -> {3};
3 -> {4};
4 -> {5};
5 -> {6};
6 -> {7};
7 -> {12 8};
8 -> {9};
9 -> {10};
10 -> {15};
10 -> {11} [style=dotted];
11 -> {12} [style=dotted];
12 -> {13};
13 -> {14};
14 -> {15};
subgraph cluster_3 {
color=red
16 [label="Enter function teat_2" style="filled" fillcolor=red];
subgraph cluster_4 {
color=blue
17 [label="Enter &&"];
18 [label="Access variable R|<local>/a|"];
19 [label="Const: Null(null)"];
20 [label="Operator =="];
21 [label="Exit left part of &&"];
22 [label="Enter right part of &&"];
23 [label="Function call: R|java/lang/Exception.Exception|()"];
24 [label="Throw: throw R|java/lang/Exception.Exception|()"];
25 [label="Stub" style="filled" fillcolor=gray];
26 [label="Exit &&"];
}
27 [label="Access variable R|<local>/a|"];
28 [label="Function call: R|<local>/a|.R|/A.foo|()"];
29 [label="Exit function teat_2" style="filled" fillcolor=red];
}
16 -> {17};
17 -> {18};
18 -> {19};
19 -> {20};
20 -> {21};
21 -> {26 22};
22 -> {23};
23 -> {24};
24 -> {29};
24 -> {25} [style=dotted];
25 -> {26} [style=dotted];
26 -> {27};
27 -> {28};
28 -> {29};
subgraph cluster_5 {
color=red
30 [label="Enter function test_3" style="filled" fillcolor=red];
subgraph cluster_6 {
color=blue
31 [label="Enter when"];
subgraph cluster_7 {
color=blue
32 [label="Enter when branch condition "];
subgraph cluster_8 {
color=blue
33 [label="Enter ||"];
34 [label="Access variable R|<local>/a|"];
35 [label="Const: Null(null)"];
36 [label="Operator !="];
37 [label="Exit left part of ||"];
38 [label="Enter right part of ||"];
39 [label="Function call: R|java/lang/Exception.Exception|()"];
40 [label="Throw: throw R|java/lang/Exception.Exception|()"];
41 [label="Stub" style="filled" fillcolor=gray];
42 [label="Exit ||"];
}
43 [label="Exit when branch condition"];
}
44 [label="Synthetic else branch"];
45 [label="Enter when branch result"];
subgraph cluster_9 {
color=blue
46 [label="Enter block"];
47 [label="Access variable R|<local>/a|"];
48 [label="Function call: R|<local>/a|.R|/A.foo|()"];
49 [label="Exit block"];
}
50 [label="Exit when branch result"];
51 [label="Exit when"];
}
52 [label="Access variable R|<local>/a|"];
53 [label="Function call: R|<local>/a|.R|/A.foo|()"];
54 [label="Exit function test_3" style="filled" fillcolor=red];
}
30 -> {31};
31 -> {32};
32 -> {33};
33 -> {34};
34 -> {35};
35 -> {36};
36 -> {37};
37 -> {42 38};
38 -> {39};
39 -> {40};
40 -> {54};
40 -> {41} [style=dotted];
41 -> {42} [style=dotted];
42 -> {43};
43 -> {45 44};
44 -> {51};
45 -> {46};
46 -> {47};
47 -> {48};
48 -> {49};
49 -> {50};
50 -> {51};
51 -> {52};
52 -> {53};
53 -> {54};
subgraph cluster_10 {
color=red
55 [label="Enter function test_4" style="filled" fillcolor=red];
subgraph cluster_11 {
color=blue
56 [label="Enter when"];
subgraph cluster_12 {
color=blue
57 [label="Enter when branch condition "];
subgraph cluster_13 {
color=blue
58 [label="Enter &&"];
59 [label="Access variable R|<local>/a|"];
60 [label="Const: Null(null)"];
61 [label="Operator =="];
62 [label="Exit left part of &&"];
63 [label="Enter right part of &&"];
64 [label="Function call: R|java/lang/Exception.Exception|()"];
65 [label="Throw: throw R|java/lang/Exception.Exception|()"];
66 [label="Stub" style="filled" fillcolor=gray];
67 [label="Exit &&"];
}
68 [label="Exit when branch condition"];
}
69 [label="Synthetic else branch"];
70 [label="Enter when branch result"];
subgraph cluster_14 {
color=blue
71 [label="Enter block"];
72 [label="Access variable R|<local>/a|"];
73 [label="Function call: R|<local>/a|.R|/A.foo|()"];
74 [label="Exit block"];
}
75 [label="Exit when branch result"];
76 [label="Exit when"];
}
77 [label="Access variable R|<local>/a|"];
78 [label="Function call: R|<local>/a|.R|/A.foo|()"];
79 [label="Exit function test_4" style="filled" fillcolor=red];
}
55 -> {56};
56 -> {57};
57 -> {58};
58 -> {59};
59 -> {60};
60 -> {61};
61 -> {62};
62 -> {67 63};
63 -> {64};
64 -> {65};
65 -> {79};
65 -> {66} [style=dotted];
66 -> {67} [style=dotted];
67 -> {68};
68 -> {70 69};
69 -> {76};
70 -> {71};
71 -> {72};
72 -> {73};
73 -> {74};
74 -> {75};
75 -> {76};
76 -> {77};
77 -> {78};
78 -> {79};
subgraph cluster_15 {
color=red
80 [label="Enter function test_5" style="filled" fillcolor=red];
subgraph cluster_16 {
color=blue
81 [label="Enter ||"];
82 [label="Access variable R|<local>/a|"];
83 [label="Const: Null(null)"];
84 [label="Operator =="];
85 [label="Exit left part of ||"];
86 [label="Enter right part of ||"];
87 [label="Function call: R|java/lang/Exception.Exception|()"];
88 [label="Throw: throw R|java/lang/Exception.Exception|()"];
89 [label="Stub" style="filled" fillcolor=gray];
90 [label="Exit ||"];
}
91 [label="Access variable R|<local>/a|"];
92 [label="Function call: R|<local>/a|.<Inapplicable(WRONG_RECEIVER): [/A.foo]>#()"];
93 [label="Exit function test_5" style="filled" fillcolor=red];
}
80 -> {81};
81 -> {82};
82 -> {83};
83 -> {84};
84 -> {85};
85 -> {90 86};
86 -> {87};
87 -> {88};
88 -> {93};
88 -> {89} [style=dotted];
89 -> {90} [style=dotted];
90 -> {91};
91 -> {92};
92 -> {93};
subgraph cluster_17 {
color=red
94 [label="Enter function teat_6" style="filled" fillcolor=red];
subgraph cluster_18 {
color=blue
95 [label="Enter &&"];
96 [label="Access variable R|<local>/a|"];
97 [label="Const: Null(null)"];
98 [label="Operator !="];
99 [label="Exit left part of &&"];
100 [label="Enter right part of &&"];
101 [label="Function call: R|java/lang/Exception.Exception|()"];
102 [label="Throw: throw R|java/lang/Exception.Exception|()"];
103 [label="Stub" style="filled" fillcolor=gray];
104 [label="Exit &&"];
}
105 [label="Access variable R|<local>/a|"];
106 [label="Function call: R|<local>/a|.<Inapplicable(WRONG_RECEIVER): [/A.foo]>#()"];
107 [label="Exit function teat_6" style="filled" fillcolor=red];
}
94 -> {95};
95 -> {96};
96 -> {97};
97 -> {98};
98 -> {99};
99 -> {104 100};
100 -> {101};
101 -> {102};
102 -> {107};
102 -> {103} [style=dotted];
103 -> {104} [style=dotted];
104 -> {105};
105 -> {106};
106 -> {107};
subgraph cluster_19 {
color=red
108 [label="Enter function test_7" style="filled" fillcolor=red];
subgraph cluster_20 {
color=blue
109 [label="Enter when"];
subgraph cluster_21 {
color=blue
110 [label="Enter when branch condition "];
subgraph cluster_22 {
color=blue
111 [label="Enter ||"];
112 [label="Access variable R|<local>/a|"];
113 [label="Const: Null(null)"];
114 [label="Operator =="];
115 [label="Exit left part of ||"];
116 [label="Enter right part of ||"];
117 [label="Function call: R|java/lang/Exception.Exception|()"];
118 [label="Throw: throw R|java/lang/Exception.Exception|()"];
119 [label="Stub" style="filled" fillcolor=gray];
120 [label="Exit ||"];
}
121 [label="Exit when branch condition"];
}
122 [label="Synthetic else branch"];
123 [label="Enter when branch result"];
subgraph cluster_23 {
color=blue
124 [label="Enter block"];
125 [label="Access variable R|<local>/a|"];
126 [label="Function call: R|<local>/a|.<Inapplicable(WRONG_RECEIVER): [/A.foo]>#()"];
127 [label="Exit block"];
}
128 [label="Exit when branch result"];
129 [label="Exit when"];
}
130 [label="Access variable R|<local>/a|"];
131 [label="Function call: R|<local>/a|.<Inapplicable(WRONG_RECEIVER): [/A.foo]>#()"];
132 [label="Exit function test_7" style="filled" fillcolor=red];
}
108 -> {109};
109 -> {110};
110 -> {111};
111 -> {112};
112 -> {113};
113 -> {114};
114 -> {115};
115 -> {120 116};
116 -> {117};
117 -> {118};
118 -> {132};
118 -> {119} [style=dotted];
119 -> {120} [style=dotted];
120 -> {121};
121 -> {123 122};
122 -> {129};
123 -> {124};
124 -> {125};
125 -> {126};
126 -> {127};
127 -> {128};
128 -> {129};
129 -> {130};
130 -> {131};
131 -> {132};
subgraph cluster_24 {
color=red
133 [label="Enter function test_8" style="filled" fillcolor=red];
subgraph cluster_25 {
color=blue
134 [label="Enter when"];
subgraph cluster_26 {
color=blue
135 [label="Enter when branch condition "];
subgraph cluster_27 {
color=blue
136 [label="Enter &&"];
137 [label="Access variable R|<local>/a|"];
138 [label="Const: Null(null)"];
139 [label="Operator !="];
140 [label="Exit left part of &&"];
141 [label="Enter right part of &&"];
142 [label="Function call: R|java/lang/Exception.Exception|()"];
143 [label="Throw: throw R|java/lang/Exception.Exception|()"];
144 [label="Stub" style="filled" fillcolor=gray];
145 [label="Exit &&"];
}
146 [label="Exit when branch condition"];
}
147 [label="Synthetic else branch"];
148 [label="Enter when branch result"];
subgraph cluster_28 {
color=blue
149 [label="Enter block"];
150 [label="Access variable R|<local>/a|"];
151 [label="Function call: R|<local>/a|.<Inapplicable(WRONG_RECEIVER): [/A.foo]>#()"];
152 [label="Exit block"];
}
153 [label="Exit when branch result"];
154 [label="Exit when"];
}
155 [label="Access variable R|<local>/a|"];
156 [label="Function call: R|<local>/a|.<Inapplicable(WRONG_RECEIVER): [/A.foo]>#()"];
157 [label="Exit function test_8" style="filled" fillcolor=red];
}
133 -> {134};
134 -> {135};
135 -> {136};
136 -> {137};
137 -> {138};
138 -> {139};
139 -> {140};
140 -> {145 141};
141 -> {142};
142 -> {143};
143 -> {157};
143 -> {144} [style=dotted];
144 -> {145} [style=dotted];
145 -> {146};
146 -> {148 147};
147 -> {154};
148 -> {149};
149 -> {150};
150 -> {151};
151 -> {152};
152 -> {153};
153 -> {154};
154 -> {155};
155 -> {156};
156 -> {157};
}
@@ -0,0 +1,57 @@
// !DUMP_CFG
interface A {
fun foo()
}
// ------------------------- Should work -------------------------
fun test_1(a: A?) {
a != null || throw Exception()
a.foo()
}
fun teat_2(a: A?) {
a == null && throw Exception()
a.foo()
}
fun test_3(a: A?) {
if (a != null || throw Exception()) {
a.foo()
}
a.foo()
}
fun test_4(a: A?) {
if (a == null && throw Exception()) {
a.foo()
}
a.foo()
}
// ------------------------- Shouldn't work -------------------------
fun test_5(a: A?) {
a == null || throw Exception()
a.<!INAPPLICABLE_CANDIDATE!>foo<!>()
}
fun teat_6(a: A?) {
a != null && throw Exception()
a.<!INAPPLICABLE_CANDIDATE!>foo<!>()
}
fun test_7(a: A?) {
if (a == null || throw Exception()) {
a.<!INAPPLICABLE_CANDIDATE!>foo<!>()
}
a.<!INAPPLICABLE_CANDIDATE!>foo<!>()
}
fun test_8(a: A?) {
if (a != null && throw Exception()) {
a.<!INAPPLICABLE_CANDIDATE!>foo<!>()
}
a.<!INAPPLICABLE_CANDIDATE!>foo<!>()
}
@@ -0,0 +1,57 @@
FILE: jumpFromRhsOfOperator.kt
public abstract interface A : R|kotlin/Any| {
public abstract fun foo(): R|kotlin/Unit|
}
public final fun test_1(a: R|A?|): R|kotlin/Unit| {
!=(R|<local>/a|, Null(null)) || throw R|java/lang/Exception.Exception|()
R|<local>/a|.R|/A.foo|()
}
public final fun teat_2(a: R|A?|): R|kotlin/Unit| {
==(R|<local>/a|, Null(null)) && throw R|java/lang/Exception.Exception|()
R|<local>/a|.R|/A.foo|()
}
public final fun test_3(a: R|A?|): R|kotlin/Unit| {
when () {
!=(R|<local>/a|, Null(null)) || throw R|java/lang/Exception.Exception|() -> {
R|<local>/a|.R|/A.foo|()
}
}
R|<local>/a|.R|/A.foo|()
}
public final fun test_4(a: R|A?|): R|kotlin/Unit| {
when () {
==(R|<local>/a|, Null(null)) && throw R|java/lang/Exception.Exception|() -> {
R|<local>/a|.R|/A.foo|()
}
}
R|<local>/a|.R|/A.foo|()
}
public final fun test_5(a: R|A?|): R|kotlin/Unit| {
==(R|<local>/a|, Null(null)) || throw R|java/lang/Exception.Exception|()
R|<local>/a|.<Inapplicable(WRONG_RECEIVER): [/A.foo]>#()
}
public final fun teat_6(a: R|A?|): R|kotlin/Unit| {
!=(R|<local>/a|, Null(null)) && throw R|java/lang/Exception.Exception|()
R|<local>/a|.<Inapplicable(WRONG_RECEIVER): [/A.foo]>#()
}
public final fun test_7(a: R|A?|): R|kotlin/Unit| {
when () {
==(R|<local>/a|, Null(null)) || throw R|java/lang/Exception.Exception|() -> {
R|<local>/a|.<Inapplicable(WRONG_RECEIVER): [/A.foo]>#()
}
}
R|<local>/a|.<Inapplicable(WRONG_RECEIVER): [/A.foo]>#()
}
public final fun test_8(a: R|A?|): R|kotlin/Unit| {
when () {
!=(R|<local>/a|, Null(null)) && throw R|java/lang/Exception.Exception|() -> {
R|<local>/a|.<Inapplicable(WRONG_RECEIVER): [/A.foo]>#()
}
}
R|<local>/a|.<Inapplicable(WRONG_RECEIVER): [/A.foo]>#()
}