[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
@@ -59,30 +59,40 @@ digraph inPlaceLambdas_kt {
subgraph cluster_9 {
color=blue
19 [label="Enter block"];
20 [label="Postponed enter to lambda"];
subgraph cluster_10 {
color=blue
21 [label="Enter function <anonymous>" style="filled" fillcolor=red];
20 [label="Function call arguments enter"];
21 [label="Postponed enter to lambda"];
subgraph cluster_11 {
color=blue
22 [label="Enter block"];
23 [label="Access variable R|<local>/x|"];
24 [label="Smart cast: R|<local>/x|"];
25 [label="Function call: R|<local>/x|.R|/A.foo|()" style="filled" fillcolor=yellow];
26 [label="Exit block"];
22 [label="Enter function <anonymous>" style="filled" fillcolor=red];
subgraph cluster_12 {
color=blue
23 [label="Enter block"];
subgraph cluster_13 {
color=blue
24 [label="Function call arguments enter"];
25 [label="Access variable R|<local>/x|"];
26 [label="Smart cast: R|<local>/x|"];
27 [label="Function call arguments exit"];
}
28 [label="Function call: R|<local>/x|.R|/A.foo|()" style="filled" fillcolor=yellow];
29 [label="Exit block"];
}
30 [label="Exit function <anonymous>" style="filled" fillcolor=red];
}
27 [label="Exit function <anonymous>" style="filled" fillcolor=red];
31 [label="Function call arguments exit"];
}
28 [label="Postponed exit from lambda"];
29 [label="Function call: R|kotlin/run|<R|kotlin/Unit|>(...)" style="filled" fillcolor=yellow];
30 [label="Exit block"];
32 [label="Postponed exit from lambda"];
33 [label="Function call: R|kotlin/run|<R|kotlin/Unit|>(...)" style="filled" fillcolor=yellow];
34 [label="Exit block"];
}
31 [label="Exit when branch result"];
32 [label="Exit when"];
35 [label="Exit when branch result"];
36 [label="Exit when"];
}
33 [label="Exit block"];
37 [label="Exit block"];
}
34 [label="Exit function test_1" style="filled" fillcolor=red];
38 [label="Exit function test_1" style="filled" fillcolor=red];
}
10 -> {11};
11 -> {12};
@@ -91,13 +101,13 @@ digraph inPlaceLambdas_kt {
14 -> {15};
15 -> {16};
16 -> {17 18};
17 -> {32};
17 -> {36};
18 -> {19};
19 -> {20};
20 -> {21 29};
20 -> {28} [style=dotted];
20 -> {21} [style=dashed];
21 -> {22};
20 -> {21};
21 -> {22 31};
21 -> {32} [style=dotted];
21 -> {22} [style=dashed];
22 -> {23};
23 -> {24};
24 -> {25};
@@ -106,131 +116,156 @@ digraph inPlaceLambdas_kt {
27 -> {28};
28 -> {29};
29 -> {30};
30 -> {31};
31 -> {32};
30 -> {32};
31 -> {33};
32 -> {33};
33 -> {34};
subgraph cluster_12 {
color=red
35 [label="Enter function test_2" style="filled" fillcolor=red];
subgraph cluster_13 {
color=blue
36 [label="Enter block"];
37 [label="Postponed enter to lambda"];
subgraph cluster_14 {
color=blue
38 [label="Enter function <anonymous>" style="filled" fillcolor=red];
subgraph cluster_15 {
color=blue
39 [label="Enter block"];
40 [label="Access variable R|<local>/x|"];
41 [label="Type operator: (R|<local>/x| as R|B|)"];
42 [label="Exit block"];
}
43 [label="Exit function <anonymous>" style="filled" fillcolor=red];
}
44 [label="Postponed exit from lambda"];
45 [label="Function call: R|kotlin/run|<R|B|>(...)" style="filled" fillcolor=yellow];
46 [label="Access variable R|<local>/x|"];
47 [label="Smart cast: R|<local>/x|"];
48 [label="Function call: R|<local>/x|.R|/B.bar|()" style="filled" fillcolor=yellow];
49 [label="Exit block"];
}
50 [label="Exit function test_2" style="filled" fillcolor=red];
}
34 -> {35};
35 -> {36};
36 -> {37};
37 -> {38 45};
37 -> {44} [style=dotted];
37 -> {38} [style=dashed];
38 -> {39};
37 -> {38};
subgraph cluster_14 {
color=red
39 [label="Enter function test_2" style="filled" fillcolor=red];
subgraph cluster_15 {
color=blue
40 [label="Enter block"];
subgraph cluster_16 {
color=blue
41 [label="Function call arguments enter"];
42 [label="Postponed enter to lambda"];
subgraph cluster_17 {
color=blue
43 [label="Enter function <anonymous>" style="filled" fillcolor=red];
subgraph cluster_18 {
color=blue
44 [label="Enter block"];
45 [label="Access variable R|<local>/x|"];
46 [label="Type operator: (R|<local>/x| as R|B|)"];
47 [label="Exit block"];
}
48 [label="Exit function <anonymous>" style="filled" fillcolor=red];
}
49 [label="Function call arguments exit"];
}
50 [label="Postponed exit from lambda"];
51 [label="Function call: R|kotlin/run|<R|B|>(...)" style="filled" fillcolor=yellow];
subgraph cluster_19 {
color=blue
52 [label="Function call arguments enter"];
53 [label="Access variable R|<local>/x|"];
54 [label="Smart cast: R|<local>/x|"];
55 [label="Function call arguments exit"];
}
56 [label="Function call: R|<local>/x|.R|/B.bar|()" style="filled" fillcolor=yellow];
57 [label="Exit block"];
}
58 [label="Exit function test_2" style="filled" fillcolor=red];
}
39 -> {40};
40 -> {41};
41 -> {42};
42 -> {43};
42 -> {43 49};
42 -> {50} [style=dotted];
42 -> {43} [style=dashed];
43 -> {44};
44 -> {45};
45 -> {46};
46 -> {47};
47 -> {48};
48 -> {49};
49 -> {50};
subgraph cluster_16 {
color=red
51 [label="Enter function test_3" style="filled" fillcolor=red];
subgraph cluster_17 {
color=blue
52 [label="Enter block"];
subgraph cluster_18 {
color=blue
53 [label="Enter when"];
subgraph cluster_19 {
color=blue
54 [label="Enter when branch condition "];
55 [label="Access variable R|<local>/x|"];
56 [label="Type operator: (R|<local>/x| is R|A|)"];
57 [label="Exit when branch condition"];
}
58 [label="Synthetic else branch"];
59 [label="Enter when branch result"];
subgraph cluster_20 {
color=blue
60 [label="Enter block"];
61 [label="Postponed enter to lambda"];
subgraph cluster_21 {
color=blue
62 [label="Enter function <anonymous>" style="filled" fillcolor=red];
subgraph cluster_22 {
color=blue
63 [label="Enter block"];
64 [label="Access variable R|<local>/x|"];
65 [label="Smart cast: R|<local>/x|"];
66 [label="Function call: R|<local>/x|.R|/A.foo|()" style="filled" fillcolor=yellow];
67 [label="Access variable R|<local>/x|"];
68 [label="Smart cast: R|<local>/x|"];
69 [label="Type operator: (R|<local>/x| as R|B|)"];
70 [label="Exit block"];
}
71 [label="Exit function <anonymous>" style="filled" fillcolor=red];
}
72 [label="Postponed exit from lambda"];
73 [label="Function call: R|kotlin/run|<R|B|>(...)" style="filled" fillcolor=yellow];
74 [label="Access variable R|<local>/x|"];
75 [label="Smart cast: R|<local>/x|"];
76 [label="Function call: R|<local>/x|.R|/B.bar|()" style="filled" fillcolor=yellow];
77 [label="Exit block"];
}
78 [label="Exit when branch result"];
79 [label="Exit when"];
}
80 [label="Exit block"];
}
81 [label="Exit function test_3" style="filled" fillcolor=red];
}
48 -> {50};
49 -> {51};
50 -> {51};
51 -> {52};
52 -> {53};
53 -> {54};
54 -> {55};
55 -> {56};
56 -> {57};
57 -> {58 59};
58 -> {79};
57 -> {58};
subgraph cluster_20 {
color=red
59 [label="Enter function test_3" style="filled" fillcolor=red];
subgraph cluster_21 {
color=blue
60 [label="Enter block"];
subgraph cluster_22 {
color=blue
61 [label="Enter when"];
subgraph cluster_23 {
color=blue
62 [label="Enter when branch condition "];
63 [label="Access variable R|<local>/x|"];
64 [label="Type operator: (R|<local>/x| is R|A|)"];
65 [label="Exit when branch condition"];
}
66 [label="Synthetic else branch"];
67 [label="Enter when branch result"];
subgraph cluster_24 {
color=blue
68 [label="Enter block"];
subgraph cluster_25 {
color=blue
69 [label="Function call arguments enter"];
70 [label="Postponed enter to lambda"];
subgraph cluster_26 {
color=blue
71 [label="Enter function <anonymous>" style="filled" fillcolor=red];
subgraph cluster_27 {
color=blue
72 [label="Enter block"];
subgraph cluster_28 {
color=blue
73 [label="Function call arguments enter"];
74 [label="Access variable R|<local>/x|"];
75 [label="Smart cast: R|<local>/x|"];
76 [label="Function call arguments exit"];
}
77 [label="Function call: R|<local>/x|.R|/A.foo|()" style="filled" fillcolor=yellow];
78 [label="Access variable R|<local>/x|"];
79 [label="Smart cast: R|<local>/x|"];
80 [label="Type operator: (R|<local>/x| as R|B|)"];
81 [label="Exit block"];
}
82 [label="Exit function <anonymous>" style="filled" fillcolor=red];
}
83 [label="Function call arguments exit"];
}
84 [label="Postponed exit from lambda"];
85 [label="Function call: R|kotlin/run|<R|B|>(...)" style="filled" fillcolor=yellow];
subgraph cluster_29 {
color=blue
86 [label="Function call arguments enter"];
87 [label="Access variable R|<local>/x|"];
88 [label="Smart cast: R|<local>/x|"];
89 [label="Function call arguments exit"];
}
90 [label="Function call: R|<local>/x|.R|/B.bar|()" style="filled" fillcolor=yellow];
91 [label="Exit block"];
}
92 [label="Exit when branch result"];
93 [label="Exit when"];
}
94 [label="Exit block"];
}
95 [label="Exit function test_3" style="filled" fillcolor=red];
}
59 -> {60};
60 -> {61};
61 -> {62 73};
61 -> {72} [style=dotted];
61 -> {62} [style=dashed];
61 -> {62};
62 -> {63};
63 -> {64};
64 -> {65};
65 -> {66};
66 -> {67};
65 -> {66 67};
66 -> {93};
67 -> {68};
68 -> {69};
69 -> {70};
70 -> {71};
70 -> {71 83};
70 -> {84} [style=dotted];
70 -> {71} [style=dashed];
71 -> {72};
72 -> {73};
73 -> {74};
@@ -241,5 +276,19 @@ digraph inPlaceLambdas_kt {
78 -> {79};
79 -> {80};
80 -> {81};
81 -> {82};
82 -> {84};
83 -> {85};
84 -> {85};
85 -> {86};
86 -> {87};
87 -> {88};
88 -> {89};
89 -> {90};
90 -> {91};
91 -> {92};
92 -> {93};
93 -> {94};
94 -> {95};
}
@@ -144,70 +144,75 @@ digraph lambdaInWhenBranch_kt {
subgraph cluster_18 {
color=blue
49 [label="Enter block"];
50 [label="Const: String()"];
51 [label="Postponed enter to lambda"];
subgraph cluster_19 {
color=blue
52 [label="Enter function <anonymous>" style="filled" fillcolor=red];
50 [label="Function call arguments enter"];
51 [label="Const: String()"];
52 [label="Postponed enter to lambda"];
subgraph cluster_20 {
color=blue
53 [label="Enter block"];
54 [label="Access variable R|<local>/it|"];
55 [label="Exit block"];
53 [label="Enter function <anonymous>" style="filled" fillcolor=red];
subgraph cluster_21 {
color=blue
54 [label="Enter block"];
55 [label="Access variable R|<local>/it|"];
56 [label="Exit block"];
}
57 [label="Exit function <anonymous>" style="filled" fillcolor=red];
}
56 [label="Exit function <anonymous>" style="filled" fillcolor=red];
58 [label="Function call arguments exit"];
}
57 [label="Postponed exit from lambda"];
58 [label="Function call: String().R|kotlin/let|<R|kotlin/String|, R|kotlin/String|>(...)" style="filled" fillcolor=yellow];
59 [label="Exit block"];
59 [label="Postponed exit from lambda"];
60 [label="Function call: String().R|kotlin/let|<R|kotlin/String|, R|kotlin/String|>(...)" style="filled" fillcolor=yellow];
61 [label="Exit block"];
}
60 [label="Exit when branch result"];
61 [label="Exit when"];
62 [label="Exit when branch result"];
63 [label="Exit when"];
}
62 [label="Access variable R|<local>/p|"];
63 [label="Access variable <Unresolved name: t>#"];
subgraph cluster_21 {
64 [label="Access variable R|<local>/p|"];
65 [label="Access variable <Unresolved name: t>#"];
subgraph cluster_22 {
color=blue
64 [label="Enter when"];
65 [label="Access variable R|<local>/p|"];
subgraph cluster_22 {
color=blue
66 [label="Enter when branch condition "];
67 [label="Exit $subj"];
68 [label="Type operator: ($subj$ is R|SubClass1|)"];
69 [label="Exit when branch condition"];
}
66 [label="Enter when"];
67 [label="Access variable R|<local>/p|"];
subgraph cluster_23 {
color=blue
70 [label="Enter when branch condition "];
71 [label="Exit $subj"];
72 [label="Type operator: ($subj$ is R|SubClass2|)"];
73 [label="Exit when branch condition"];
68 [label="Enter when branch condition "];
69 [label="Exit $subj"];
70 [label="Type operator: ($subj$ is R|SubClass1|)"];
71 [label="Exit when branch condition"];
}
74 [label="Enter when branch result"];
subgraph cluster_24 {
color=blue
75 [label="Enter block"];
76 [label="Const: String(2)"];
77 [label="Exit block"];
72 [label="Enter when branch condition "];
73 [label="Exit $subj"];
74 [label="Type operator: ($subj$ is R|SubClass2|)"];
75 [label="Exit when branch condition"];
}
78 [label="Exit when branch result"];
79 [label="Enter when branch result"];
76 [label="Enter when branch result"];
subgraph cluster_25 {
color=blue
80 [label="Enter block"];
81 [label="Access variable R|<local>/p|"];
82 [label="Smart cast: R|<local>/p|"];
83 [label="Access variable R|/SubClass1.t|"];
84 [label="Exit block"];
77 [label="Enter block"];
78 [label="Const: String(2)"];
79 [label="Exit block"];
}
85 [label="Exit when branch result"];
86 [label="Exit when"];
80 [label="Exit when branch result"];
81 [label="Enter when branch result"];
subgraph cluster_26 {
color=blue
82 [label="Enter block"];
83 [label="Access variable R|<local>/p|"];
84 [label="Smart cast: R|<local>/p|"];
85 [label="Access variable R|/SubClass1.t|"];
86 [label="Exit block"];
}
87 [label="Exit when branch result"];
88 [label="Exit when"];
}
87 [label="Access variable R|kotlin/String.length|"];
88 [label="Exit block"];
89 [label="Access variable R|kotlin/String.length|"];
90 [label="Exit block"];
}
89 [label="Exit function foo" style="filled" fillcolor=red];
91 [label="Exit function foo" style="filled" fillcolor=red];
}
31 -> {32};
32 -> {33};
@@ -225,22 +230,22 @@ digraph lambdaInWhenBranch_kt {
44 -> {45};
45 -> {46};
46 -> {47};
47 -> {61};
47 -> {63};
48 -> {49};
49 -> {50};
50 -> {51};
51 -> {52 58};
51 -> {57} [style=dotted];
51 -> {52} [style=dashed];
52 -> {53};
51 -> {52};
52 -> {53 58};
52 -> {59} [style=dotted];
52 -> {53} [style=dashed];
53 -> {54};
54 -> {55};
55 -> {56};
56 -> {57};
57 -> {58} [color=green];
57 -> {61} [color=red];
58 -> {59};
59 -> {60};
57 -> {59};
58 -> {60};
59 -> {60} [color=green];
59 -> {63} [color=red];
60 -> {61};
61 -> {62};
62 -> {63};
@@ -250,18 +255,18 @@ digraph lambdaInWhenBranch_kt {
66 -> {67};
67 -> {68};
68 -> {69};
69 -> {70 79};
69 -> {70};
70 -> {71};
71 -> {72};
71 -> {72 81};
72 -> {73};
73 -> {74};
74 -> {75};
75 -> {76};
76 -> {77};
77 -> {78};
78 -> {86};
78 -> {79};
79 -> {80};
80 -> {81};
80 -> {88};
81 -> {82};
82 -> {83};
83 -> {84};
@@ -270,5 +275,7 @@ digraph lambdaInWhenBranch_kt {
86 -> {87};
87 -> {88};
88 -> {89};
89 -> {90};
90 -> {91};
}
@@ -32,15 +32,20 @@ digraph smartcastOnLambda_kt {
subgraph cluster_5 {
color=blue
12 [label="Enter block"];
13 [label="Function call: R|<local>/func|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()" style="filled" fillcolor=yellow];
14 [label="Exit block"];
subgraph cluster_6 {
color=blue
13 [label="Function call arguments enter"];
14 [label="Function call arguments exit"];
}
15 [label="Function call: R|<local>/func|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()" style="filled" fillcolor=yellow];
16 [label="Exit block"];
}
15 [label="Exit when branch result"];
16 [label="Exit when"];
17 [label="Exit when branch result"];
18 [label="Exit when"];
}
17 [label="Exit block"];
19 [label="Exit block"];
}
18 [label="Exit function test" style="filled" fillcolor=red];
20 [label="Exit function test" style="filled" fillcolor=red];
}
2 -> {3};
3 -> {4};
@@ -50,7 +55,7 @@ digraph smartcastOnLambda_kt {
7 -> {8};
8 -> {9};
9 -> {10 11};
10 -> {16};
10 -> {18};
11 -> {12};
12 -> {13};
13 -> {14};
@@ -58,5 +63,7 @@ digraph smartcastOnLambda_kt {
15 -> {16};
16 -> {17};
17 -> {18};
18 -> {19};
19 -> {20};
}