FIR DFA: take all statements from ?. if result is non-null.

I.e. a?.f(b as T) != null => b is T.

This also allows to remove the copyAllInformationFrom hack by moving the
edge directly in the control flow graph.
This commit is contained in:
pyos
2022-11-19 19:13:27 +01:00
committed by teamcity
parent 3392e066df
commit 16b8811697
14 changed files with 278 additions and 245 deletions
@@ -484,12 +484,12 @@ digraph nullability_kt {
165 [label="Access variable R|<local>/q|"];
166 [label="Enter safe call"];
167 [label="Access variable R|/Q.data|"];
168 [label="Exit safe call"];
169 [label="Enter safe call"];
170 [label="Access variable R|/MyData.s|"];
171 [label="Exit safe call"];
172 [label="Enter safe call"];
173 [label="Function call: $subj$.R|kotlin/Int.inc|()"];
168 [label="Enter safe call"];
169 [label="Access variable R|/MyData.s|"];
170 [label="Enter safe call"];
171 [label="Function call: $subj$.R|kotlin/Int.inc|()"];
172 [label="Exit safe call"];
173 [label="Exit safe call"];
174 [label="Exit safe call"];
175 [label="Const: Null(null)"];
176 [label="Equality operator !="];
@@ -528,13 +528,13 @@ digraph nullability_kt {
162 -> {163};
163 -> {164};
164 -> {165};
165 -> {166 168};
165 -> {166 172};
166 -> {167};
167 -> {168};
168 -> {169 171};
169 -> {170};
167 -> {172 168};
168 -> {169};
169 -> {173 170};
170 -> {171};
171 -> {172 174};
171 -> {174};
172 -> {173};
173 -> {174};
174 -> {175};
@@ -573,18 +573,18 @@ digraph nullability_kt {
203 [label="Access variable R|<local>/q|"];
204 [label="Enter safe call"];
205 [label="Access variable R|/Q.data|"];
206 [label="Exit safe call"];
207 [label="Enter safe call"];
208 [label="Access variable R|/MyData.s|"];
209 [label="Exit safe call"];
210 [label="Enter safe call"];
211 [label="Function call: $subj$.R|kotlin/Int.inc|()"];
212 [label="Exit safe call"];
213 [label="Exit lhs of ?:"];
214 [label="Enter rhs of ?:"];
215 [label="Jump: ^test_6 Unit"];
216 [label="Stub" style="filled" fillcolor=gray];
217 [label="Lhs of ?: is not null"];
206 [label="Enter safe call"];
207 [label="Access variable R|/MyData.s|"];
208 [label="Enter safe call"];
209 [label="Function call: $subj$.R|kotlin/Int.inc|()"];
210 [label="Exit safe call"];
211 [label="Exit lhs of ?:"];
212 [label="Lhs of ?: is not null"];
213 [label="Exit safe call"];
214 [label="Exit safe call"];
215 [label="Enter rhs of ?:"];
216 [label="Jump: ^test_6 Unit"];
217 [label="Stub" style="filled" fillcolor=gray];
218 [label="Exit ?:"];
219 [label="Access variable R|<local>/q|"];
220 [label="Smart cast: R|<local>/q|"];
@@ -607,24 +607,22 @@ digraph nullability_kt {
}
201 -> {202};
202 -> {203};
203 -> {204 206};
203 -> {204 213};
204 -> {205};
205 -> {206};
206 -> {207 209};
207 -> {208};
205 -> {213 206};
206 -> {207};
207 -> {214 208};
208 -> {209};
209 -> {210};
209 -> {212} [color=red];
209 -> {214} [color=green];
210 -> {211};
211 -> {212};
212 -> {213};
213 -> {217 214};
211 -> {212 215};
212 -> {218};
213 -> {214};
214 -> {215};
215 -> {235};
215 -> {216} [style=dotted];
216 -> {218} [style=dotted];
217 -> {218};
215 -> {216};
216 -> {235};
216 -> {217} [style=dotted];
217 -> {218} [style=dotted];
218 -> {219};
219 -> {220};
220 -> {221};
@@ -658,12 +656,12 @@ digraph nullability_kt {
240 [label="Access variable R|<local>/q|"];
241 [label="Enter safe call"];
242 [label="Function call: $subj$.R|/Q.fdata|()"];
243 [label="Exit safe call"];
244 [label="Enter safe call"];
245 [label="Function call: $subj$.R|/MyData.fs|()"];
246 [label="Exit safe call"];
247 [label="Enter safe call"];
248 [label="Function call: $subj$.R|kotlin/Int.inc|()"];
243 [label="Enter safe call"];
244 [label="Function call: $subj$.R|/MyData.fs|()"];
245 [label="Enter safe call"];
246 [label="Function call: $subj$.R|kotlin/Int.inc|()"];
247 [label="Exit safe call"];
248 [label="Exit safe call"];
249 [label="Exit safe call"];
250 [label="Const: Null(null)"];
251 [label="Equality operator !="];
@@ -699,13 +697,13 @@ digraph nullability_kt {
237 -> {238};
238 -> {239};
239 -> {240};
240 -> {241 243};
240 -> {241 247};
241 -> {242};
242 -> {243};
243 -> {244 246};
244 -> {245};
242 -> {247 243};
243 -> {244};
244 -> {248 245};
245 -> {246};
246 -> {247 249};
246 -> {249};
247 -> {248};
248 -> {249};
249 -> {250};
@@ -1164,12 +1162,12 @@ digraph nullability_kt {
436 [label="Access variable R|<local>/q|"];
437 [label="Enter safe call"];
438 [label="Access variable R|/QImpl.data|"];
439 [label="Exit safe call"];
440 [label="Enter safe call"];
441 [label="Access variable R|/MyData.s|"];
442 [label="Exit safe call"];
443 [label="Enter safe call"];
444 [label="Function call: $subj$.R|kotlin/Int.inc|()"];
439 [label="Enter safe call"];
440 [label="Access variable R|/MyData.s|"];
441 [label="Enter safe call"];
442 [label="Function call: $subj$.R|kotlin/Int.inc|()"];
443 [label="Exit safe call"];
444 [label="Exit safe call"];
445 [label="Exit safe call"];
446 [label="Const: Null(null)"];
447 [label="Equality operator !="];
@@ -1248,13 +1246,13 @@ digraph nullability_kt {
433 -> {434};
434 -> {435};
435 -> {436};
436 -> {437 439};
436 -> {437 443};
437 -> {438};
438 -> {439};
439 -> {440 442};
440 -> {441};
438 -> {443 439};
439 -> {440};
440 -> {444 441};
441 -> {442};
442 -> {443 445};
442 -> {445};
443 -> {444};
444 -> {445};
445 -> {446};
@@ -1330,12 +1328,12 @@ digraph nullability_kt {
507 [label="Access variable R|<local>/q|"];
508 [label="Enter safe call"];
509 [label="Access variable R|/QImplWithCustomGetter.data|"];
510 [label="Exit safe call"];
511 [label="Enter safe call"];
512 [label="Access variable R|/MyData.s|"];
513 [label="Exit safe call"];
514 [label="Enter safe call"];
515 [label="Function call: $subj$.R|kotlin/Int.inc|()"];
510 [label="Enter safe call"];
511 [label="Access variable R|/MyData.s|"];
512 [label="Enter safe call"];
513 [label="Function call: $subj$.R|kotlin/Int.inc|()"];
514 [label="Exit safe call"];
515 [label="Exit safe call"];
516 [label="Exit safe call"];
517 [label="Const: Null(null)"];
518 [label="Equality operator !="];
@@ -1374,13 +1372,13 @@ digraph nullability_kt {
504 -> {505};
505 -> {506};
506 -> {507};
507 -> {508 510};
507 -> {508 514};
508 -> {509};
509 -> {510};
510 -> {511 513};
511 -> {512};
509 -> {514 510};
510 -> {511};
511 -> {515 512};
512 -> {513};
513 -> {514 516};
513 -> {516};
514 -> {515};
515 -> {516};
516 -> {517};
@@ -1425,12 +1423,12 @@ digraph nullability_kt {
547 [label="Access variable R|<local>/q|"];
548 [label="Enter safe call"];
549 [label="Access variable R|/QImplMutable.data|"];
550 [label="Exit safe call"];
551 [label="Enter safe call"];
552 [label="Access variable R|/MyData.s|"];
553 [label="Exit safe call"];
554 [label="Enter safe call"];
555 [label="Function call: $subj$.R|kotlin/Int.inc|()"];
550 [label="Enter safe call"];
551 [label="Access variable R|/MyData.s|"];
552 [label="Enter safe call"];
553 [label="Function call: $subj$.R|kotlin/Int.inc|()"];
554 [label="Exit safe call"];
555 [label="Exit safe call"];
556 [label="Exit safe call"];
557 [label="Const: Null(null)"];
558 [label="Equality operator !="];
@@ -1469,13 +1467,13 @@ digraph nullability_kt {
544 -> {545};
545 -> {546};
546 -> {547};
547 -> {548 550};
547 -> {548 554};
548 -> {549};
549 -> {550};
550 -> {551 553};
551 -> {552};
549 -> {554 550};
550 -> {551};
551 -> {555 552};
552 -> {553};
553 -> {554 556};
553 -> {556};
554 -> {555};
555 -> {556};
556 -> {557};