FIR DFA: deprioritize branches with no reassignments in flow unions

callBothLambdas({ x = "..." }, { x is Int })
  // the assignment always executes, so x is String | (String & Int);
  // the latter is always a subtype of the former so it can be ignored
This commit is contained in:
pyos
2022-11-07 15:18:46 +01:00
committed by teamcity
parent fd609416c6
commit 3436535e7a
5 changed files with 442 additions and 314 deletions
@@ -853,16 +853,16 @@ digraph flowFromInplaceLambda2_kt {
303 [label="Postponed enter to lambda"];
subgraph cluster_71 {
color=blue
320 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
321 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
subgraph cluster_72 {
color=blue
321 [label="Enter block"];
322 [label="Const: Null(null)"];
323 [label="Assignment: R|<local>/p|"];
324 [label="Function call: R|/n|<R|kotlin/Nothing?|>()"];
325 [label="Exit block"];
322 [label="Enter block"];
323 [label="Const: Null(null)"];
324 [label="Assignment: R|<local>/p|"];
325 [label="Function call: R|/n|<R|kotlin/Nothing?|>()"];
326 [label="Exit block"];
}
326 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
327 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
}
304 [label="Postponed exit from lambda"];
305 [label="Function call: R|kotlin/run|<R|kotlin/Nothing?|>(...)"];
@@ -871,32 +871,33 @@ digraph flowFromInplaceLambda2_kt {
308 [label="Postponed enter to lambda"];
subgraph cluster_73 {
color=blue
327 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
328 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
subgraph cluster_74 {
color=blue
328 [label="Enter block"];
329 [label="Access variable R|<local>/p|"];
330 [label="Smart cast: R|<local>/p|"];
331 [label="Access variable <Inapplicable(UNSTABLE_SMARTCAST): kotlin/String.length>#"];
332 [label="Const: Int(123)"];
333 [label="Exit block"];
329 [label="Enter block"];
330 [label="Access variable R|<local>/p|"];
331 [label="Smart cast: R|<local>/p|"];
332 [label="Access variable <Inapplicable(UNSTABLE_SMARTCAST): kotlin/String.length>#"];
333 [label="Const: Int(123)"];
334 [label="Exit block"];
}
334 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
335 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
}
309 [label="Postponed exit from lambda"];
310 [label="Function call: R|kotlin/run|<R|kotlin/Int|>(...)"];
311 [label="Call arguments union" style="filled" fillcolor=yellow];
312 [label="Function call: R|/foo|<R|kotlin/Int|>(...)"];
313 [label="Access variable R|<local>/p|"];
314 [label="Access variable <Inapplicable(UNSAFE_CALL): kotlin/String.length>#"];
315 [label="Exit block"];
314 [label="Smart cast: R|<local>/p|"];
315 [label="Access variable <Inapplicable(UNSAFE_CALL): kotlin/String.length>#"];
316 [label="Exit block"];
}
316 [label="Exit when branch result"];
317 [label="Exit when"];
317 [label="Exit when branch result"];
318 [label="Exit when"];
}
318 [label="Exit block"];
319 [label="Exit block"];
}
319 [label="Exit function test7" style="filled" fillcolor=red];
320 [label="Exit function test7" style="filled" fillcolor=red];
}
290 -> {291};
291 -> {292};
@@ -908,19 +909,19 @@ digraph flowFromInplaceLambda2_kt {
297 -> {298};
298 -> {299};
299 -> {301 300};
300 -> {317};
300 -> {318};
301 -> {302};
302 -> {303};
303 -> {320};
303 -> {321};
303 -> {304} [color=red];
303 -> {320} [style=dashed];
303 -> {321} [style=dashed];
304 -> {305};
305 -> {306};
306 -> {307};
307 -> {308};
308 -> {327};
308 -> {328};
308 -> {309} [color=red];
308 -> {327} [style=dashed];
308 -> {328} [style=dashed];
309 -> {310};
310 -> {311};
311 -> {312};
@@ -931,22 +932,23 @@ digraph flowFromInplaceLambda2_kt {
316 -> {317};
317 -> {318};
318 -> {319};
320 -> {321};
319 -> {320};
321 -> {322};
322 -> {323};
323 -> {324};
324 -> {325};
325 -> {326};
326 -> {311} [color=red];
326 -> {304} [color=green];
327 -> {328};
326 -> {327};
327 -> {311} [color=red];
327 -> {304} [color=green];
328 -> {329};
329 -> {330};
330 -> {331};
331 -> {332};
332 -> {333};
333 -> {334};
334 -> {311} [color=red];
334 -> {309} [color=green];
334 -> {335};
335 -> {311} [color=red];
335 -> {309} [color=green];
}