[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
@@ -53,23 +53,38 @@ digraph inAnonymousObject_kt {
}
21 [label="Exit anonymous object expression"];
22 [label="Variable declaration: lval obj: R|<anonymous>|"];
23 [label="Access variable R|<local>/obj|"];
24 [label="Function call: R|<local>/obj|.R|/<anonymous>.run|()" style="filled" fillcolor=yellow];
25 [label="Function call: R|<local>/d|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()" style="filled" fillcolor=yellow];
26 [label="Exit block"];
subgraph cluster_9 {
color=blue
23 [label="Function call arguments enter"];
24 [label="Access variable R|<local>/obj|"];
25 [label="Function call arguments exit"];
}
26 [label="Function call: R|<local>/obj|.R|/<anonymous>.run|()" style="filled" fillcolor=yellow];
subgraph cluster_10 {
color=blue
27 [label="Function call arguments enter"];
28 [label="Function call arguments exit"];
}
29 [label="Function call: R|<local>/d|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()" style="filled" fillcolor=yellow];
30 [label="Exit block"];
}
27 [label="Exit function foo" style="filled" fillcolor=red];
31 [label="Exit function foo" style="filled" fillcolor=red];
}
subgraph cluster_9 {
subgraph cluster_11 {
color=blue
28 [label="Enter function run" style="filled" fillcolor=red];
subgraph cluster_10 {
32 [label="Enter function run" style="filled" fillcolor=red];
subgraph cluster_12 {
color=blue
29 [label="Enter block"];
30 [label="Function call: R|<local>/c|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()" style="filled" fillcolor=yellow];
31 [label="Exit block"];
33 [label="Enter block"];
subgraph cluster_13 {
color=blue
34 [label="Function call arguments enter"];
35 [label="Function call arguments exit"];
}
36 [label="Function call: R|<local>/c|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()" style="filled" fillcolor=yellow];
37 [label="Exit block"];
}
32 [label="Exit function run" style="filled" fillcolor=red];
38 [label="Exit function run" style="filled" fillcolor=red];
}
2 -> {3};
3 -> {4};
@@ -79,7 +94,7 @@ digraph inAnonymousObject_kt {
6 -> {21} [style=dotted];
6 -> {7} [style=dashed];
7 -> {8};
7 -> {11 17 28} [color=red];
7 -> {11 17 32} [color=red];
7 -> {20} [style=dotted];
7 -> {8 11 17} [style=dashed];
8 -> {9};
@@ -97,17 +112,23 @@ digraph inAnonymousObject_kt {
18 -> {19};
19 -> {20};
20 -> {21};
20 -> {28} [color=green];
20 -> {28} [style=dashed];
20 -> {32} [color=green];
20 -> {32} [style=dashed];
21 -> {22};
22 -> {23};
23 -> {24};
24 -> {25};
25 -> {26};
26 -> {27};
27 -> {28};
28 -> {29};
29 -> {30};
30 -> {31};
31 -> {32};
32 -> {33};
33 -> {34};
34 -> {35};
35 -> {36};
36 -> {37};
37 -> {38};
}
@@ -22,79 +22,104 @@ digraph inLocalClass_kt {
5 [label="Exit block"];
}
6 [label="Local class declaration"];
7 [label="Function call: R|<local>/LocalClass.LocalClass|()" style="filled" fillcolor=yellow];
8 [label="Function call: R|<local>/LocalClass.LocalClass|().R|<local>/run|()" style="filled" fillcolor=yellow];
9 [label="Function call: R|<local>/e|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()" style="filled" fillcolor=yellow];
10 [label="Exit block"];
}
11 [label="Exit function foo" style="filled" fillcolor=red];
}
subgraph cluster_4 {
color=blue
12 [label="Enter class LocalClass" style="filled" fillcolor=red];
subgraph cluster_5 {
color=blue
13 [label="Enter property" style="filled" fillcolor=red];
14 [label="Access variable R|<local>/a|"];
15 [label="Exit property" style="filled" fillcolor=red];
}
subgraph cluster_6 {
color=blue
16 [label="Enter init block" style="filled" fillcolor=red];
subgraph cluster_7 {
subgraph cluster_4 {
color=blue
17 [label="Enter block"];
18 [label="Access variable R|<local>/c|"];
19 [label="Assignment: R|<local>/leaked|"];
20 [label="Exit block"];
7 [label="Function call arguments enter"];
subgraph cluster_5 {
color=blue
8 [label="Function call arguments enter"];
9 [label="Function call arguments exit"];
}
10 [label="Function call: R|<local>/LocalClass.LocalClass|()" style="filled" fillcolor=yellow];
11 [label="Function call arguments exit"];
}
21 [label="Exit init block" style="filled" fillcolor=red];
12 [label="Function call: R|<local>/LocalClass.LocalClass|().R|<local>/run|()" style="filled" fillcolor=yellow];
subgraph cluster_6 {
color=blue
13 [label="Function call arguments enter"];
14 [label="Function call arguments exit"];
}
15 [label="Function call: R|<local>/e|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()" style="filled" fillcolor=yellow];
16 [label="Exit block"];
}
17 [label="Exit function foo" style="filled" fillcolor=red];
}
subgraph cluster_7 {
color=blue
18 [label="Enter class LocalClass" style="filled" fillcolor=red];
subgraph cluster_8 {
color=blue
22 [label="Enter function <init>" style="filled" fillcolor=red];
23 [label="Delegated constructor call: super<R|kotlin/Any|>()" style="filled" fillcolor=yellow];
subgraph cluster_9 {
19 [label="Enter property" style="filled" fillcolor=red];
20 [label="Access variable R|<local>/a|"];
21 [label="Exit property" style="filled" fillcolor=red];
}
subgraph cluster_9 {
color=blue
22 [label="Enter init block" style="filled" fillcolor=red];
subgraph cluster_10 {
color=blue
24 [label="Enter block"];
25 [label="Function call: R|<local>/b|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()" style="filled" fillcolor=yellow];
23 [label="Enter block"];
24 [label="Access variable R|<local>/c|"];
25 [label="Assignment: R|<local>/leaked|"];
26 [label="Exit block"];
}
27 [label="Exit function <init>" style="filled" fillcolor=red];
27 [label="Exit init block" style="filled" fillcolor=red];
}
28 [label="Exit class LocalClass" style="filled" fillcolor=red];
}
subgraph cluster_10 {
color=blue
29 [label="Enter function run" style="filled" fillcolor=red];
subgraph cluster_11 {
color=blue
30 [label="Enter block"];
31 [label="Function call: R|<local>/d|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()" style="filled" fillcolor=yellow];
32 [label="Exit block"];
28 [label="Enter function <init>" style="filled" fillcolor=red];
29 [label="Delegated constructor call: super<R|kotlin/Any|>()" style="filled" fillcolor=yellow];
subgraph cluster_12 {
color=blue
30 [label="Enter block"];
subgraph cluster_13 {
color=blue
31 [label="Function call arguments enter"];
32 [label="Function call arguments exit"];
}
33 [label="Function call: R|<local>/b|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()" style="filled" fillcolor=yellow];
34 [label="Exit block"];
}
35 [label="Exit function <init>" style="filled" fillcolor=red];
}
33 [label="Exit function run" style="filled" fillcolor=red];
36 [label="Exit class LocalClass" style="filled" fillcolor=red];
}
subgraph cluster_14 {
color=blue
37 [label="Enter function run" style="filled" fillcolor=red];
subgraph cluster_15 {
color=blue
38 [label="Enter block"];
subgraph cluster_16 {
color=blue
39 [label="Function call arguments enter"];
40 [label="Function call arguments exit"];
}
41 [label="Function call: R|<local>/d|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()" style="filled" fillcolor=yellow];
42 [label="Exit block"];
}
43 [label="Exit function run" style="filled" fillcolor=red];
}
2 -> {3};
3 -> {4};
4 -> {5};
5 -> {6};
6 -> {7 12};
6 -> {12} [style=dashed];
6 -> {7 18};
6 -> {18} [style=dashed];
7 -> {8};
8 -> {9};
9 -> {10};
10 -> {11};
11 -> {12};
12 -> {13};
12 -> {16 22 29} [color=red];
12 -> {28} [style=dotted];
12 -> {13 16 22} [style=dashed];
13 -> {14};
14 -> {15};
15 -> {16} [color=green];
15 -> {16};
16 -> {17};
17 -> {18};
18 -> {19};
18 -> {22 28 37} [color=red];
18 -> {36} [style=dotted];
18 -> {19 22 28} [style=dashed];
19 -> {20};
20 -> {21};
21 -> {22} [color=green];
@@ -104,11 +129,21 @@ digraph inLocalClass_kt {
25 -> {26};
26 -> {27};
27 -> {28} [color=green];
28 -> {29} [color=green];
28 -> {29} [style=dashed];
28 -> {29};
29 -> {30};
30 -> {31};
31 -> {32};
32 -> {33};
33 -> {34};
34 -> {35};
35 -> {36} [color=green];
36 -> {37} [color=green];
36 -> {37} [style=dashed];
37 -> {38};
38 -> {39};
39 -> {40};
40 -> {41};
41 -> {42};
42 -> {43};
}
@@ -22,39 +22,67 @@ digraph inLocalFunction_kt {
5 [label="Exit block"];
}
6 [label="Local function declaration"];
7 [label="Function call: R|<local>/localFun|()" style="filled" fillcolor=yellow];
8 [label="Function call: R|<local>/b|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()" style="filled" fillcolor=yellow];
9 [label="Exit block"];
subgraph cluster_4 {
color=blue
7 [label="Function call arguments enter"];
8 [label="Function call arguments exit"];
}
9 [label="Function call: R|<local>/localFun|()" style="filled" fillcolor=yellow];
subgraph cluster_5 {
color=blue
10 [label="Function call arguments enter"];
11 [label="Function call arguments exit"];
}
12 [label="Function call: R|<local>/b|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()" style="filled" fillcolor=yellow];
13 [label="Exit block"];
}
10 [label="Exit function foo" style="filled" fillcolor=red];
14 [label="Exit function foo" style="filled" fillcolor=red];
}
subgraph cluster_4 {
subgraph cluster_6 {
color=blue
11 [label="Enter function localFun" style="filled" fillcolor=red];
subgraph cluster_5 {
15 [label="Enter function localFun" style="filled" fillcolor=red];
subgraph cluster_7 {
color=blue
12 [label="Enter block"];
13 [label="Access variable R|<local>/a|"];
14 [label="Function call: R|<local>/a|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()" style="filled" fillcolor=yellow];
15 [label="Function call: R|<local>/a|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()" style="filled" fillcolor=yellow];
16 [label="Exit block"];
16 [label="Enter block"];
subgraph cluster_8 {
color=blue
17 [label="Function call arguments enter"];
18 [label="Access variable R|<local>/a|"];
19 [label="Function call arguments exit"];
}
20 [label="Function call: R|<local>/a|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()" style="filled" fillcolor=yellow];
subgraph cluster_9 {
color=blue
21 [label="Function call arguments enter"];
22 [label="Function call arguments exit"];
}
23 [label="Function call: R|<local>/a|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()" style="filled" fillcolor=yellow];
24 [label="Exit block"];
}
17 [label="Exit function localFun" style="filled" fillcolor=red];
25 [label="Exit function localFun" style="filled" fillcolor=red];
}
2 -> {3};
3 -> {4};
4 -> {5};
5 -> {6};
6 -> {7 11};
6 -> {11} [style=dashed];
6 -> {7 15};
6 -> {15} [style=dashed];
7 -> {8};
8 -> {9};
9 -> {10};
10 -> {11};
11 -> {12};
12 -> {13};
13 -> {14};
14 -> {15};
15 -> {16};
16 -> {17};
17 -> {18};
18 -> {19};
19 -> {20};
20 -> {21};
21 -> {22};
22 -> {23};
23 -> {24};
24 -> {25};
}
@@ -55,28 +55,43 @@ digraph toLocalVariables_kt {
17 [label="Enter block"];
18 [label="Access variable R|<local>/y|"];
19 [label="Variable declaration: lval yCopy: R|() -> kotlin/Unit|"];
20 [label="Function call: R|<local>/yCopy|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()" style="filled" fillcolor=yellow];
21 [label="Exit block"];
subgraph cluster_10 {
color=blue
20 [label="Function call arguments enter"];
21 [label="Function call arguments exit"];
}
22 [label="Function call: R|<local>/yCopy|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()" style="filled" fillcolor=yellow];
23 [label="Exit block"];
}
22 [label="Exit when branch result"];
23 [label="Enter when branch result"];
subgraph cluster_10 {
24 [label="Exit when branch result"];
25 [label="Enter when branch result"];
subgraph cluster_11 {
color=blue
24 [label="Enter block"];
25 [label="Access variable R|<local>/x|"];
26 [label="Function call: R|/bar|(...)" style="filled" fillcolor=yellow];
27 [label="Exit block"];
26 [label="Enter block"];
subgraph cluster_12 {
color=blue
27 [label="Function call arguments enter"];
28 [label="Access variable R|<local>/x|"];
29 [label="Function call arguments exit"];
}
30 [label="Function call: R|/bar|(...)" style="filled" fillcolor=yellow];
31 [label="Exit block"];
}
28 [label="Exit when branch result"];
29 [label="Exit when"];
32 [label="Exit when branch result"];
33 [label="Exit when"];
}
30 [label="Variable declaration: lval zCopy: R|() -> kotlin/Unit|"];
31 [label="Access variable R|<local>/z|"];
32 [label="Assignment: R|<local>/zCopy|"];
33 [label="Function call: R|<local>/zCopy|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()" style="filled" fillcolor=yellow];
34 [label="Exit block"];
34 [label="Variable declaration: lval zCopy: R|() -> kotlin/Unit|"];
35 [label="Access variable R|<local>/z|"];
36 [label="Assignment: R|<local>/zCopy|"];
subgraph cluster_13 {
color=blue
37 [label="Function call arguments enter"];
38 [label="Function call arguments exit"];
}
39 [label="Function call: R|<local>/zCopy|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()" style="filled" fillcolor=yellow];
40 [label="Exit block"];
}
35 [label="Exit function foo" style="filled" fillcolor=red];
41 [label="Exit function foo" style="filled" fillcolor=red];
}
6 -> {7};
7 -> {8};
@@ -85,7 +100,7 @@ digraph toLocalVariables_kt {
10 -> {11};
11 -> {12};
12 -> {13};
13 -> {14 23};
13 -> {14 25};
14 -> {15};
15 -> {16};
16 -> {17};
@@ -94,9 +109,9 @@ digraph toLocalVariables_kt {
19 -> {20};
20 -> {21};
21 -> {22};
22 -> {29};
22 -> {23};
23 -> {24};
24 -> {25};
24 -> {33};
25 -> {26};
26 -> {27};
27 -> {28};
@@ -107,5 +122,11 @@ digraph toLocalVariables_kt {
32 -> {33};
33 -> {34};
34 -> {35};
35 -> {36};
36 -> {37};
37 -> {38};
38 -> {39};
39 -> {40};
40 -> {41};
}