[FIR] Properly support smartcasts on stable when subjects in when conditions

^KT-49860 Fixed
This commit is contained in:
Dmitriy Novozhilov
2021-11-24 17:14:21 +03:00
committed by teamcityserver
parent 20425fb458
commit 330574cab6
41 changed files with 1225 additions and 791 deletions
@@ -16,48 +16,50 @@ digraph implicitReceiverAsWhenSubject_kt {
subgraph cluster_3 {
color=blue
4 [label="Enter when branch condition "];
5 [label="Type operator: ($subj$ is R|kotlin/collections/List<*>|)"];
6 [label="Exit when branch condition"];
5 [label="Exit $subj"];
6 [label="Type operator: ($subj$ is R|kotlin/collections/List<*>|)"];
7 [label="Exit when branch condition"];
}
subgraph cluster_4 {
color=blue
7 [label="Enter when branch condition "];
8 [label="Type operator: ($subj$ is R|kotlin/String|)"];
9 [label="Exit when branch condition"];
8 [label="Enter when branch condition "];
9 [label="Exit $subj"];
10 [label="Type operator: ($subj$ is R|kotlin/String|)"];
11 [label="Exit when branch condition"];
}
subgraph cluster_5 {
color=blue
10 [label="Enter when branch condition else"];
11 [label="Exit when branch condition"];
12 [label="Enter when branch condition else"];
13 [label="Exit when branch condition"];
}
12 [label="Enter when branch result"];
14 [label="Enter when branch result"];
subgraph cluster_6 {
color=blue
13 [label="Enter block"];
14 [label="Const: Int(0)"];
15 [label="Exit block"];
15 [label="Enter block"];
16 [label="Const: Int(0)"];
17 [label="Exit block"];
}
16 [label="Exit when branch result"];
17 [label="Enter when branch result"];
18 [label="Exit when branch result"];
19 [label="Enter when branch result"];
subgraph cluster_7 {
color=blue
18 [label="Enter block"];
19 [label="Access variable R|kotlin/String.length|"];
20 [label="Exit block"];
20 [label="Enter block"];
21 [label="Access variable R|kotlin/String.length|"];
22 [label="Exit block"];
}
21 [label="Exit when branch result"];
22 [label="Enter when branch result"];
23 [label="Exit when branch result"];
24 [label="Enter when branch result"];
subgraph cluster_8 {
color=blue
23 [label="Enter block"];
24 [label="Access variable this@R|/test_1|"];
25 [label="Access variable R|SubstitutionOverride<kotlin/collections/List.size: R|kotlin/Int|>|"];
26 [label="Exit block"];
25 [label="Enter block"];
26 [label="Access variable this@R|/test_1|"];
27 [label="Access variable R|SubstitutionOverride<kotlin/collections/List.size: R|kotlin/Int|>|"];
28 [label="Exit block"];
}
27 [label="Exit when branch result"];
28 [label="Exit when"];
29 [label="Exit when branch result"];
30 [label="Exit when"];
}
29 [label="Jump: ^test_1 when (this@R|/test_1|) {
31 [label="Jump: ^test_1 when (this@R|/test_1|) {
($subj$ is R|kotlin/collections/List<*>|) -> {
this@R|/test_1|.R|SubstitutionOverride<kotlin/collections/List.size: R|kotlin/Int|>|
}
@@ -69,10 +71,10 @@ digraph implicitReceiverAsWhenSubject_kt {
}
}
"];
30 [label="Stub" style="filled" fillcolor=gray];
31 [label="Exit block" style="filled" fillcolor=gray];
32 [label="Stub" style="filled" fillcolor=gray];
33 [label="Exit block" style="filled" fillcolor=gray];
}
32 [label="Exit function test_1" style="filled" fillcolor=red];
34 [label="Exit function test_1" style="filled" fillcolor=red];
}
0 -> {1};
1 -> {2};
@@ -80,94 +82,98 @@ digraph implicitReceiverAsWhenSubject_kt {
3 -> {4};
4 -> {5};
5 -> {6};
6 -> {22 7};
7 -> {8};
6 -> {7};
7 -> {24 8};
8 -> {9};
9 -> {17 10};
9 -> {10};
10 -> {11};
11 -> {12};
11 -> {19 12};
12 -> {13};
13 -> {14};
14 -> {15};
15 -> {16};
16 -> {28};
16 -> {17};
17 -> {18};
18 -> {19};
18 -> {30};
19 -> {20};
20 -> {21};
21 -> {28};
21 -> {22};
22 -> {23};
23 -> {24};
23 -> {30};
24 -> {25};
25 -> {26};
26 -> {27};
27 -> {28};
28 -> {29};
29 -> {32};
29 -> {30} [style=dotted];
30 -> {31} [style=dotted];
29 -> {30};
30 -> {31};
31 -> {34};
31 -> {32} [style=dotted];
32 -> {33} [style=dotted];
33 -> {34} [style=dotted];
subgraph cluster_9 {
color=red
33 [label="Enter function test_2" style="filled" fillcolor=red];
35 [label="Enter function test_2" style="filled" fillcolor=red];
subgraph cluster_10 {
color=blue
34 [label="Enter block"];
36 [label="Enter block"];
subgraph cluster_11 {
color=blue
35 [label="Enter when"];
36 [label="Access variable this@R|/test_2|"];
37 [label="Variable declaration: lval x: R|kotlin/Any|"];
37 [label="Enter when"];
38 [label="Access variable this@R|/test_2|"];
39 [label="Variable declaration: lval x: R|kotlin/Any|"];
subgraph cluster_12 {
color=blue
38 [label="Enter when branch condition "];
39 [label="Type operator: ($subj$ is R|kotlin/collections/List<*>|)"];
40 [label="Exit when branch condition"];
40 [label="Enter when branch condition "];
41 [label="Exit $subj"];
42 [label="Type operator: ($subj$ is R|kotlin/collections/List<*>|)"];
43 [label="Exit when branch condition"];
}
subgraph cluster_13 {
color=blue
41 [label="Enter when branch condition "];
42 [label="Type operator: ($subj$ is R|kotlin/String|)"];
43 [label="Exit when branch condition"];
44 [label="Enter when branch condition "];
45 [label="Exit $subj"];
46 [label="Type operator: ($subj$ is R|kotlin/String|)"];
47 [label="Exit when branch condition"];
}
subgraph cluster_14 {
color=blue
44 [label="Enter when branch condition else"];
45 [label="Exit when branch condition"];
48 [label="Enter when branch condition else"];
49 [label="Exit when branch condition"];
}
46 [label="Enter when branch result"];
50 [label="Enter when branch result"];
subgraph cluster_15 {
color=blue
47 [label="Enter block"];
48 [label="Const: Int(0)"];
49 [label="Exit block"];
51 [label="Enter block"];
52 [label="Const: Int(0)"];
53 [label="Exit block"];
}
50 [label="Exit when branch result"];
51 [label="Enter when branch result"];
54 [label="Exit when branch result"];
55 [label="Enter when branch result"];
subgraph cluster_16 {
color=blue
52 [label="Enter block"];
53 [label="Access variable R|<local>/x|"];
54 [label="Access variable R|kotlin/String.length|"];
55 [label="Access variable R|kotlin/String.length|"];
56 [label="Exit block"];
56 [label="Enter block"];
57 [label="Access variable R|<local>/x|"];
58 [label="Access variable R|kotlin/String.length|"];
59 [label="Access variable R|kotlin/String.length|"];
60 [label="Exit block"];
}
57 [label="Exit when branch result"];
58 [label="Enter when branch result"];
61 [label="Exit when branch result"];
62 [label="Enter when branch result"];
subgraph cluster_17 {
color=blue
59 [label="Enter block"];
60 [label="Access variable R|<local>/x|"];
61 [label="Access variable R|SubstitutionOverride<kotlin/collections/List.size: R|kotlin/Int|>|"];
62 [label="Access variable this@R|/test_2|"];
63 [label="Access variable R|SubstitutionOverride<kotlin/collections/List.size: R|kotlin/Int|>|"];
64 [label="Exit block"];
63 [label="Enter block"];
64 [label="Access variable R|<local>/x|"];
65 [label="Access variable R|SubstitutionOverride<kotlin/collections/List.size: R|kotlin/Int|>|"];
66 [label="Access variable this@R|/test_2|"];
67 [label="Access variable R|SubstitutionOverride<kotlin/collections/List.size: R|kotlin/Int|>|"];
68 [label="Exit block"];
}
65 [label="Exit when branch result"];
66 [label="Exit when"];
69 [label="Exit when branch result"];
70 [label="Exit when"];
}
67 [label="Jump: ^test_2 when (lval x: R|kotlin/Any| = this@R|/test_2|) {
71 [label="Jump: ^test_2 when (lval x: R|kotlin/Any| = this@R|/test_2|) {
($subj$ is R|kotlin/collections/List<*>|) -> {
R|<local>/x|.R|SubstitutionOverride<kotlin/collections/List.size: R|kotlin/Int|>|
this@R|/test_2|.R|SubstitutionOverride<kotlin/collections/List.size: R|kotlin/Int|>|
@@ -181,48 +187,50 @@ digraph implicitReceiverAsWhenSubject_kt {
}
}
"];
68 [label="Stub" style="filled" fillcolor=gray];
69 [label="Exit block" style="filled" fillcolor=gray];
72 [label="Stub" style="filled" fillcolor=gray];
73 [label="Exit block" style="filled" fillcolor=gray];
}
70 [label="Exit function test_2" style="filled" fillcolor=red];
74 [label="Exit function test_2" style="filled" fillcolor=red];
}
33 -> {34};
34 -> {35};
35 -> {36};
36 -> {37};
37 -> {38};
38 -> {39};
39 -> {40};
40 -> {58 41};
40 -> {41};
41 -> {42};
42 -> {43};
43 -> {51 44};
43 -> {62 44};
44 -> {45};
45 -> {46};
46 -> {47};
47 -> {48};
47 -> {55 48};
48 -> {49};
49 -> {50};
50 -> {66};
50 -> {51};
51 -> {52};
52 -> {53};
53 -> {54};
54 -> {55};
54 -> {70};
55 -> {56};
56 -> {57};
57 -> {66};
57 -> {58};
58 -> {59};
59 -> {60};
60 -> {61};
61 -> {62};
61 -> {70};
62 -> {63};
63 -> {64};
64 -> {65};
65 -> {66};
66 -> {67};
67 -> {70};
67 -> {68} [style=dotted];
68 -> {69} [style=dotted];
69 -> {70} [style=dotted];
67 -> {68};
68 -> {69};
69 -> {70};
70 -> {71};
71 -> {74};
71 -> {72} [style=dotted];
72 -> {73} [style=dotted];
73 -> {74} [style=dotted];
}