Files
Kirill Rakhman 69a7bf7f68 [FIR] Add equality constraint from expected type for some synthetic function calls
This fixes some cases where we infer some type variable inside one
of the branches to Nothing instead of the expected type because Nothing
appeared in some other branch.

Specifically, we add an equality instead of a subtype constraint during
completion of calls to synthetic functions for if/when, try and !!.
We don't do it when the call contains a (possibly nested) elvis or is
inside the RHS of an assignment.
Otherwise, we would prevent some smart-casts.

#KT-65882 Fixed
2024-03-05 17:38:59 +00:00

188 lines
7.6 KiB
Plaintext
Vendored

digraph plusAssignWithLambdaInRhs_kt {
graph [nodesep=3]
node [shape=box penwidth=2]
edge [penwidth=2]
subgraph cluster_0 {
color=red
0 [label="Enter file plusAssignWithLambdaInRhs.kt" style="filled" fillcolor=red];
1 [label="Exit file plusAssignWithLambdaInRhs.kt" style="filled" fillcolor=red];
}
0 -> {1} [color=green];
subgraph cluster_1 {
color=red
2 [label="Enter function test" style="filled" fillcolor=red];
subgraph cluster_2 {
color=blue
3 [label="Enter block"];
4 [label="Const: Null(null)"];
5 [label="Check not null: Null(null)!!" style="filled" fillcolor=yellow];
6 [label="Variable declaration: lval list: R|kotlin/collections/MutableList<kotlin/Function1<kotlin/String, kotlin/String>>|"];
7 [label="Access variable R|<local>/list|"];
8 [label="Postponed enter to lambda"];
subgraph cluster_3 {
color=blue
9 [label="Enter function <anonymous>" style="filled" fillcolor=red];
subgraph cluster_4 {
color=blue
10 [label="Enter block"];
11 [label="Access variable R|<local>/it|"];
12 [label="Exit block"];
}
13 [label="Exit function <anonymous>" style="filled" fillcolor=red];
}
14 [label="Postponed exit from lambda"];
15 [label="Function call: R|<local>/list|.R|kotlin/collections/plusAssign|<R|(kotlin/String) -> kotlin/String|>(...)" style="filled" fillcolor=yellow];
16 [label="Exit block"];
}
17 [label="Exit function test" style="filled" fillcolor=red];
}
2 -> {3};
3 -> {4};
4 -> {5};
5 -> {6};
6 -> {7};
7 -> {8};
8 -> {9 14 15};
8 -> {9} [style=dashed];
9 -> {10};
10 -> {11};
11 -> {12};
12 -> {13};
14 -> {15} [label="Postponed"];
15 -> {16};
16 -> {17};
subgraph cluster_5 {
color=red
18 [label="Enter class A" style="filled" fillcolor=red];
subgraph cluster_6 {
color=blue
19 [label="Enter function <init>" style="filled" fillcolor=red];
20 [label="Delegated constructor call: super<R|kotlin/Any|>()" style="filled" fillcolor=yellow];
21 [label="Exit function <init>" style="filled" fillcolor=red];
}
subgraph cluster_7 {
color=blue
22 [label="Enter property" style="filled" fillcolor=red];
23 [label="Access variable R|<local>/executor|"];
24 [label="Exit property" style="filled" fillcolor=red];
}
25 [label="Exit class A" style="filled" fillcolor=red];
}
18 -> {19} [color=green];
18 -> {25} [style=dotted];
18 -> {19 22} [style=dashed];
19 -> {20};
20 -> {21};
21 -> {22} [color=green];
22 -> {23};
23 -> {24};
24 -> {25} [color=green];
subgraph cluster_8 {
color=red
26 [label="Enter function postpone" style="filled" fillcolor=red];
subgraph cluster_9 {
color=blue
27 [label="Enter block"];
subgraph cluster_10 {
color=blue
28 [label="Function call arguments enter"];
29 [label="Function call arguments exit"];
}
30 [label="Function call: R|kotlin/collections/mutableListOf|<R|() -> kotlin/Unit|>()" style="filled" fillcolor=yellow];
31 [label="Variable declaration: lval queue: R|kotlin/collections/MutableList<kotlin/Function0<kotlin/Unit>>|"];
subgraph cluster_11 {
color=blue
32 [label="Function call arguments enter"];
33 [label="Postponed enter to lambda"];
subgraph cluster_12 {
color=blue
34 [label="Enter function <anonymous>" style="filled" fillcolor=red];
subgraph cluster_13 {
color=blue
35 [label="Enter block"];
36 [label="Access variable R|<local>/queue|"];
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"];
subgraph cluster_16 {
color=blue
40 [label="Function call arguments enter"];
subgraph cluster_17 {
color=blue
41 [label="Function call arguments enter"];
42 [label="Function call arguments exit"];
}
43 [label="Function call: R|<local>/computation|.R|SubstitutionOverride<kotlin/Function0.invoke: R|T|>|()" style="filled" fillcolor=yellow];
44 [label="Function call arguments exit"];
}
45 [label="Function call: R|<local>/resolve|.R|SubstitutionOverride<kotlin/Function1.invoke: R|kotlin/Unit|>|(...)" style="filled" fillcolor=yellow];
46 [label="Exit block"];
}
47 [label="Exit function <anonymous>" style="filled" fillcolor=red];
}
48 [label="Postponed exit from lambda"];
49 [label="Function call: R|<local>/queue|.R|kotlin/collections/plusAssign|<R|() -> kotlin/Unit|>(...)" style="filled" fillcolor=yellow];
50 [label="Exit block"];
}
51 [label="Exit function <anonymous>" style="filled" fillcolor=red];
}
52 [label="Function call arguments exit"];
}
53 [label="Postponed exit from lambda"];
54 [label="Function call: R|/A.A|<R|T|>(...)" style="filled" fillcolor=yellow];
55 [label="Jump: ^postpone R|/A.A|<R|T|>(<L> = A@fun <anonymous>(resolve: R|(T) -> kotlin/Unit|): R|kotlin/Unit| <inline=NoInline> {
R|<local>/queue|.R|kotlin/collections/plusAssign|<R|() -> kotlin/Unit|>(fun <anonymous>(): R|kotlin/Unit| <inline=NoInline> {
R|<local>/resolve|.R|SubstitutionOverride<kotlin/Function1.invoke: R|kotlin/Unit|>|(R|<local>/computation|.R|SubstitutionOverride<kotlin/Function0.invoke: R|T|>|())
}
)
}
)"];
56 [label="Stub" style="filled" fillcolor=gray];
57 [label="Exit block" style="filled" fillcolor=gray];
}
58 [label="Exit function postpone" style="filled" fillcolor=red];
}
26 -> {27};
27 -> {28};
28 -> {29};
29 -> {30};
30 -> {31};
31 -> {32};
32 -> {33};
33 -> {34 52 53};
33 -> {34} [style=dashed];
34 -> {35};
35 -> {36};
36 -> {37};
37 -> {38 48 49};
37 -> {38} [style=dashed];
38 -> {39};
39 -> {40};
40 -> {41};
41 -> {42};
42 -> {43};
43 -> {44};
44 -> {45};
45 -> {46};
46 -> {47};
48 -> {49} [label="Postponed"];
49 -> {50};
50 -> {51};
52 -> {54};
53 -> {54} [label="Postponed"];
54 -> {55};
55 -> {58};
55 -> {56} [style=dotted];
56 -> {57} [style=dotted];
57 -> {58} [style=dotted];
}