[FIR-TEST] Move analysis tests to separate module

This commit is contained in:
Dmitriy Novozhilov
2020-03-18 15:10:46 +03:00
parent 3a479d5d16
commit cc07ae96b3
1477 changed files with 1001 additions and 980 deletions
@@ -0,0 +1,240 @@
digraph binaryOperations_kt {
graph [nodesep=3]
node [shape=box penwidth=2]
edge [penwidth=2]
subgraph cluster_0 {
color=red
0 [label="Enter function test_1" style="filled" fillcolor=red];
subgraph cluster_1 {
color=blue
1 [label="Enter when"];
subgraph cluster_2 {
color=blue
2 [label="Enter when branch condition "];
subgraph cluster_3 {
color=blue
3 [label="Enter ||"];
4 [label="Access variable R|<local>/b1|"];
5 [label="Exit left part of ||"];
6 [label="Enter right part of ||"];
7 [label="Access variable R|<local>/b2|"];
8 [label="Exit ||"];
}
9 [label="Exit when branch condition"];
}
10 [label="Synthetic else branch"];
11 [label="Enter when branch result"];
subgraph cluster_4 {
color=blue
12 [label="Enter block"];
13 [label="Const: Int(1)"];
14 [label="Exit block"];
}
15 [label="Exit when branch result"];
16 [label="Exit when"];
}
17 [label="Exit function test_1" style="filled" fillcolor=red];
}
0 -> {1};
1 -> {2};
2 -> {3};
3 -> {4};
4 -> {5};
5 -> {8 6};
6 -> {7};
7 -> {8};
8 -> {9};
9 -> {11 10};
10 -> {16};
11 -> {12};
12 -> {13};
13 -> {14};
14 -> {15};
15 -> {16};
16 -> {17};
subgraph cluster_5 {
color=red
18 [label="Enter function test_2" style="filled" fillcolor=red];
subgraph cluster_6 {
color=blue
19 [label="Enter when"];
subgraph cluster_7 {
color=blue
20 [label="Enter when branch condition "];
subgraph cluster_8 {
color=blue
21 [label="Enter &&"];
22 [label="Access variable R|<local>/b1|"];
23 [label="Exit left part of &&"];
24 [label="Enter right part of &&"];
25 [label="Access variable R|<local>/b2|"];
26 [label="Exit &&"];
}
27 [label="Exit when branch condition"];
}
28 [label="Synthetic else branch"];
29 [label="Enter when branch result"];
subgraph cluster_9 {
color=blue
30 [label="Enter block"];
31 [label="Const: Int(1)"];
32 [label="Exit block"];
}
33 [label="Exit when branch result"];
34 [label="Exit when"];
}
35 [label="Exit function test_2" style="filled" fillcolor=red];
}
18 -> {19};
19 -> {20};
20 -> {21};
21 -> {22};
22 -> {23};
23 -> {26 24};
24 -> {25};
25 -> {26};
26 -> {27};
27 -> {29 28};
28 -> {34};
29 -> {30};
30 -> {31};
31 -> {32};
32 -> {33};
33 -> {34};
34 -> {35};
subgraph cluster_10 {
color=red
36 [label="Enter function test_3" style="filled" fillcolor=red];
subgraph cluster_11 {
color=blue
37 [label="Enter when"];
subgraph cluster_12 {
color=blue
38 [label="Enter when branch condition "];
subgraph cluster_13 {
color=blue
39 [label="Enter ||"];
subgraph cluster_14 {
color=blue
40 [label="Enter &&"];
41 [label="Access variable R|<local>/b1|"];
42 [label="Exit left part of &&"];
43 [label="Enter right part of &&"];
44 [label="Access variable R|<local>/b2|"];
45 [label="Exit &&"];
}
46 [label="Exit left part of ||"];
47 [label="Enter right part of ||"];
48 [label="Access variable R|<local>/b3|"];
49 [label="Exit ||"];
}
50 [label="Exit when branch condition"];
}
51 [label="Synthetic else branch"];
52 [label="Enter when branch result"];
subgraph cluster_15 {
color=blue
53 [label="Enter block"];
54 [label="Const: Int(1)"];
55 [label="Exit block"];
}
56 [label="Exit when branch result"];
57 [label="Exit when"];
}
58 [label="Exit function test_3" style="filled" fillcolor=red];
}
36 -> {37};
37 -> {38};
38 -> {39};
39 -> {40};
40 -> {41};
41 -> {42};
42 -> {45 43};
43 -> {44};
44 -> {45};
45 -> {46};
46 -> {49 47};
47 -> {48};
48 -> {49};
49 -> {50};
50 -> {52 51};
51 -> {57};
52 -> {53};
53 -> {54};
54 -> {55};
55 -> {56};
56 -> {57};
57 -> {58};
subgraph cluster_16 {
color=red
59 [label="Enter function test_4" style="filled" fillcolor=red];
subgraph cluster_17 {
color=blue
60 [label="Enter when"];
subgraph cluster_18 {
color=blue
61 [label="Enter when branch condition "];
subgraph cluster_19 {
color=blue
62 [label="Enter ||"];
63 [label="Access variable R|<local>/b1|"];
64 [label="Exit left part of ||"];
65 [label="Enter right part of ||"];
subgraph cluster_20 {
color=blue
66 [label="Enter &&"];
67 [label="Access variable R|<local>/b2|"];
68 [label="Exit left part of &&"];
69 [label="Enter right part of &&"];
70 [label="Access variable R|<local>/b3|"];
71 [label="Exit &&"];
}
72 [label="Exit ||"];
}
73 [label="Exit when branch condition"];
}
74 [label="Synthetic else branch"];
75 [label="Enter when branch result"];
subgraph cluster_21 {
color=blue
76 [label="Enter block"];
77 [label="Const: Int(1)"];
78 [label="Exit block"];
}
79 [label="Exit when branch result"];
80 [label="Exit when"];
}
81 [label="Exit function test_4" style="filled" fillcolor=red];
}
59 -> {60};
60 -> {61};
61 -> {62};
62 -> {63};
63 -> {64};
64 -> {72 65};
65 -> {66};
66 -> {67};
67 -> {68};
68 -> {71 69};
69 -> {70};
70 -> {71};
71 -> {72};
72 -> {73};
73 -> {75 74};
74 -> {80};
75 -> {76};
76 -> {77};
77 -> {78};
78 -> {79};
79 -> {80};
80 -> {81};
}
@@ -0,0 +1,24 @@
// !DUMP_CFG
fun test_1(b1: Boolean, b2: Boolean) {
if (b1 || b2) {
1
}
}
fun test_2(b1: Boolean, b2: Boolean) {
if (b1 && b2) {
1
}
}
fun test_3(b1: Boolean, b2: Boolean, b3: Boolean) {
if (b1 && b2 || b3) {
1
}
}
fun test_4(b1: Boolean, b2: Boolean, b3: Boolean) {
if (b1 || b2 && b3) {
1
}
}
@@ -0,0 +1,33 @@
FILE: binaryOperations.kt
public final fun test_1(b1: R|kotlin/Boolean|, b2: R|kotlin/Boolean|): R|kotlin/Unit| {
when () {
R|<local>/b1| || R|<local>/b2| -> {
Int(1)
}
}
}
public final fun test_2(b1: R|kotlin/Boolean|, b2: R|kotlin/Boolean|): R|kotlin/Unit| {
when () {
R|<local>/b1| && R|<local>/b2| -> {
Int(1)
}
}
}
public final fun test_3(b1: R|kotlin/Boolean|, b2: R|kotlin/Boolean|, b3: R|kotlin/Boolean|): R|kotlin/Unit| {
when () {
R|<local>/b1| && R|<local>/b2| || R|<local>/b3| -> {
Int(1)
}
}
}
public final fun test_4(b1: R|kotlin/Boolean|, b2: R|kotlin/Boolean|, b3: R|kotlin/Boolean|): R|kotlin/Unit| {
when () {
R|<local>/b1| || R|<local>/b2| && R|<local>/b3| -> {
Int(1)
}
}
}
@@ -0,0 +1,426 @@
digraph booleanOperatorsWithConsts_kt {
graph [nodesep=3]
node [shape=box penwidth=2]
edge [penwidth=2]
subgraph cluster_0 {
color=red
0 [label="Enter function test_1" style="filled" fillcolor=red];
subgraph cluster_1 {
color=blue
1 [label="Enter when"];
subgraph cluster_2 {
color=blue
2 [label="Enter when branch condition "];
subgraph cluster_3 {
color=blue
3 [label="Enter ||"];
4 [label="Access variable R|<local>/b|"];
5 [label="Exit left part of ||"];
6 [label="Enter right part of ||"];
7 [label="Const: Boolean(false)"];
8 [label="Exit ||"];
}
9 [label="Exit when branch condition"];
}
10 [label="Synthetic else branch"];
11 [label="Enter when branch result"];
subgraph cluster_4 {
color=blue
12 [label="Enter block"];
13 [label="Const: Int(1)"];
14 [label="Exit block"];
}
15 [label="Exit when branch result"];
16 [label="Exit when"];
}
17 [label="Exit function test_1" style="filled" fillcolor=red];
}
0 -> {1};
1 -> {2};
2 -> {3};
3 -> {4};
4 -> {5};
5 -> {8 6};
6 -> {7};
7 -> {8};
8 -> {9};
9 -> {11 10};
10 -> {16};
11 -> {12};
12 -> {13};
13 -> {14};
14 -> {15};
15 -> {16};
16 -> {17};
subgraph cluster_5 {
color=red
18 [label="Enter function test_2" style="filled" fillcolor=red];
subgraph cluster_6 {
color=blue
19 [label="Enter when"];
subgraph cluster_7 {
color=blue
20 [label="Enter when branch condition "];
subgraph cluster_8 {
color=blue
21 [label="Enter ||"];
22 [label="Const: Boolean(false)"];
23 [label="Exit left part of ||"];
24 [label="Enter right part of ||"];
25 [label="Access variable R|<local>/b|"];
26 [label="Exit ||"];
}
27 [label="Exit when branch condition"];
}
28 [label="Synthetic else branch"];
29 [label="Enter when branch result"];
subgraph cluster_9 {
color=blue
30 [label="Enter block"];
31 [label="Const: Int(1)"];
32 [label="Exit block"];
}
33 [label="Exit when branch result"];
34 [label="Exit when"];
}
35 [label="Exit function test_2" style="filled" fillcolor=red];
}
18 -> {19};
19 -> {20};
20 -> {21};
21 -> {22};
22 -> {23};
23 -> {24};
23 -> {26} [style=dotted];
24 -> {25};
25 -> {26};
26 -> {27};
27 -> {29 28};
28 -> {34};
29 -> {30};
30 -> {31};
31 -> {32};
32 -> {33};
33 -> {34};
34 -> {35};
subgraph cluster_10 {
color=red
36 [label="Enter function test_3" style="filled" fillcolor=red];
subgraph cluster_11 {
color=blue
37 [label="Enter when"];
subgraph cluster_12 {
color=blue
38 [label="Enter when branch condition "];
subgraph cluster_13 {
color=blue
39 [label="Enter ||"];
40 [label="Access variable R|<local>/b|"];
41 [label="Exit left part of ||"];
42 [label="Enter right part of ||"];
43 [label="Const: Boolean(true)"];
44 [label="Exit ||"];
}
45 [label="Exit when branch condition"];
}
46 [label="Synthetic else branch"];
47 [label="Enter when branch result"];
subgraph cluster_14 {
color=blue
48 [label="Enter block"];
49 [label="Const: Int(1)"];
50 [label="Exit block"];
}
51 [label="Exit when branch result"];
52 [label="Exit when"];
}
53 [label="Exit function test_3" style="filled" fillcolor=red];
}
36 -> {37};
37 -> {38};
38 -> {39};
39 -> {40};
40 -> {41};
41 -> {44 42};
42 -> {43};
43 -> {44};
44 -> {45};
45 -> {47 46};
46 -> {52};
47 -> {48};
48 -> {49};
49 -> {50};
50 -> {51};
51 -> {52};
52 -> {53};
subgraph cluster_15 {
color=red
54 [label="Enter function test_4" style="filled" fillcolor=red];
subgraph cluster_16 {
color=blue
55 [label="Enter when"];
subgraph cluster_17 {
color=blue
56 [label="Enter when branch condition "];
subgraph cluster_18 {
color=blue
57 [label="Enter ||"];
58 [label="Const: Boolean(true)"];
59 [label="Exit left part of ||"];
60 [label="Enter right part of ||" style="filled" fillcolor=gray];
61 [label="Access variable R|<local>/b|" style="filled" fillcolor=gray];
62 [label="Exit ||"];
}
63 [label="Exit when branch condition"];
}
64 [label="Synthetic else branch"];
65 [label="Enter when branch result"];
subgraph cluster_19 {
color=blue
66 [label="Enter block"];
67 [label="Const: Int(1)"];
68 [label="Exit block"];
}
69 [label="Exit when branch result"];
70 [label="Exit when"];
}
71 [label="Exit function test_4" style="filled" fillcolor=red];
}
54 -> {55};
55 -> {56};
56 -> {57};
57 -> {58};
58 -> {59};
59 -> {62};
59 -> {60} [style=dotted];
60 -> {61} [style=dotted];
61 -> {62} [style=dotted];
62 -> {63};
63 -> {65 64};
64 -> {70};
65 -> {66};
66 -> {67};
67 -> {68};
68 -> {69};
69 -> {70};
70 -> {71};
subgraph cluster_20 {
color=red
72 [label="Enter function test_5" style="filled" fillcolor=red];
subgraph cluster_21 {
color=blue
73 [label="Enter when"];
subgraph cluster_22 {
color=blue
74 [label="Enter when branch condition "];
subgraph cluster_23 {
color=blue
75 [label="Enter &&"];
76 [label="Access variable R|<local>/b|"];
77 [label="Exit left part of &&"];
78 [label="Enter right part of &&"];
79 [label="Const: Boolean(false)"];
80 [label="Exit &&"];
}
81 [label="Exit when branch condition"];
}
82 [label="Synthetic else branch"];
83 [label="Enter when branch result"];
subgraph cluster_24 {
color=blue
84 [label="Enter block"];
85 [label="Const: Int(1)"];
86 [label="Exit block"];
}
87 [label="Exit when branch result"];
88 [label="Exit when"];
}
89 [label="Exit function test_5" style="filled" fillcolor=red];
}
72 -> {73};
73 -> {74};
74 -> {75};
75 -> {76};
76 -> {77};
77 -> {80 78};
78 -> {79};
79 -> {80};
80 -> {81};
81 -> {83 82};
82 -> {88};
83 -> {84};
84 -> {85};
85 -> {86};
86 -> {87};
87 -> {88};
88 -> {89};
subgraph cluster_25 {
color=red
90 [label="Enter function test_6" style="filled" fillcolor=red];
subgraph cluster_26 {
color=blue
91 [label="Enter when"];
subgraph cluster_27 {
color=blue
92 [label="Enter when branch condition "];
subgraph cluster_28 {
color=blue
93 [label="Enter &&"];
94 [label="Const: Boolean(false)"];
95 [label="Exit left part of &&"];
96 [label="Enter right part of &&" style="filled" fillcolor=gray];
97 [label="Access variable R|<local>/b|" style="filled" fillcolor=gray];
98 [label="Exit &&"];
}
99 [label="Exit when branch condition"];
}
100 [label="Synthetic else branch"];
101 [label="Enter when branch result"];
subgraph cluster_29 {
color=blue
102 [label="Enter block"];
103 [label="Const: Int(1)"];
104 [label="Exit block"];
}
105 [label="Exit when branch result"];
106 [label="Exit when"];
}
107 [label="Exit function test_6" style="filled" fillcolor=red];
}
90 -> {91};
91 -> {92};
92 -> {93};
93 -> {94};
94 -> {95};
95 -> {98};
95 -> {96} [style=dotted];
96 -> {97} [style=dotted];
97 -> {98} [style=dotted];
98 -> {99};
99 -> {101 100};
100 -> {106};
101 -> {102};
102 -> {103};
103 -> {104};
104 -> {105};
105 -> {106};
106 -> {107};
subgraph cluster_30 {
color=red
108 [label="Enter function test_7" style="filled" fillcolor=red];
subgraph cluster_31 {
color=blue
109 [label="Enter when"];
subgraph cluster_32 {
color=blue
110 [label="Enter when branch condition "];
subgraph cluster_33 {
color=blue
111 [label="Enter &&"];
112 [label="Access variable R|<local>/b|"];
113 [label="Exit left part of &&"];
114 [label="Enter right part of &&"];
115 [label="Const: Boolean(true)"];
116 [label="Exit &&"];
}
117 [label="Exit when branch condition"];
}
118 [label="Synthetic else branch"];
119 [label="Enter when branch result"];
subgraph cluster_34 {
color=blue
120 [label="Enter block"];
121 [label="Const: Int(1)"];
122 [label="Exit block"];
}
123 [label="Exit when branch result"];
124 [label="Exit when"];
}
125 [label="Exit function test_7" style="filled" fillcolor=red];
}
108 -> {109};
109 -> {110};
110 -> {111};
111 -> {112};
112 -> {113};
113 -> {116 114};
114 -> {115};
115 -> {116};
116 -> {117};
117 -> {119 118};
118 -> {124};
119 -> {120};
120 -> {121};
121 -> {122};
122 -> {123};
123 -> {124};
124 -> {125};
subgraph cluster_35 {
color=red
126 [label="Enter function test_8" style="filled" fillcolor=red];
subgraph cluster_36 {
color=blue
127 [label="Enter when"];
subgraph cluster_37 {
color=blue
128 [label="Enter when branch condition "];
subgraph cluster_38 {
color=blue
129 [label="Enter &&"];
130 [label="Const: Boolean(true)"];
131 [label="Exit left part of &&"];
132 [label="Enter right part of &&"];
133 [label="Access variable R|<local>/b|"];
134 [label="Exit &&"];
}
135 [label="Exit when branch condition"];
}
136 [label="Synthetic else branch"];
137 [label="Enter when branch result"];
subgraph cluster_39 {
color=blue
138 [label="Enter block"];
139 [label="Const: Int(1)"];
140 [label="Exit block"];
}
141 [label="Exit when branch result"];
142 [label="Exit when"];
}
143 [label="Exit function test_8" style="filled" fillcolor=red];
}
126 -> {127};
127 -> {128};
128 -> {129};
129 -> {130};
130 -> {131};
131 -> {132};
131 -> {134} [style=dotted];
132 -> {133};
133 -> {134};
134 -> {135};
135 -> {137 136};
136 -> {142};
137 -> {138};
138 -> {139};
139 -> {140};
140 -> {141};
141 -> {142};
142 -> {143};
}
@@ -0,0 +1,48 @@
// !DUMP_CFG
fun test_1(b: Boolean) {
if (b || false) {
1
}
}
fun test_2(b: Boolean) {
if (false || b) {
1
}
}
fun test_3(b: Boolean) {
if (b || true) {
1
}
}
fun test_4(b: Boolean) {
if (true || b) {
1
}
}
fun test_5(b: Boolean) {
if (b && false) {
1
}
}
fun test_6(b: Boolean) {
if (false && b) {
1
}
}
fun test_7(b: Boolean) {
if (b && true) {
1
}
}
fun test_8(b: Boolean) {
if (true && b) {
1
}
}
@@ -0,0 +1,65 @@
FILE: booleanOperatorsWithConsts.kt
public final fun test_1(b: R|kotlin/Boolean|): R|kotlin/Unit| {
when () {
R|<local>/b| || Boolean(false) -> {
Int(1)
}
}
}
public final fun test_2(b: R|kotlin/Boolean|): R|kotlin/Unit| {
when () {
Boolean(false) || R|<local>/b| -> {
Int(1)
}
}
}
public final fun test_3(b: R|kotlin/Boolean|): R|kotlin/Unit| {
when () {
R|<local>/b| || Boolean(true) -> {
Int(1)
}
}
}
public final fun test_4(b: R|kotlin/Boolean|): R|kotlin/Unit| {
when () {
Boolean(true) || R|<local>/b| -> {
Int(1)
}
}
}
public final fun test_5(b: R|kotlin/Boolean|): R|kotlin/Unit| {
when () {
R|<local>/b| && Boolean(false) -> {
Int(1)
}
}
}
public final fun test_6(b: R|kotlin/Boolean|): R|kotlin/Unit| {
when () {
Boolean(false) && R|<local>/b| -> {
Int(1)
}
}
}
public final fun test_7(b: R|kotlin/Boolean|): R|kotlin/Unit| {
when () {
R|<local>/b| && Boolean(true) -> {
Int(1)
}
}
}
public final fun test_8(b: R|kotlin/Boolean|): R|kotlin/Unit| {
when () {
Boolean(true) && R|<local>/b| -> {
Int(1)
}
}
}
@@ -0,0 +1,266 @@
digraph complex_kt {
graph [nodesep=3]
node [shape=box penwidth=2]
edge [penwidth=2]
subgraph cluster_0 {
color=red
0 [label="Enter function close" style="filled" fillcolor=red];
1 [label="Exit function close" style="filled" fillcolor=red];
}
0 -> {1};
subgraph cluster_1 {
color=red
2 [label="Enter function addSuppressed" style="filled" fillcolor=red];
3 [label="Exit function addSuppressed" style="filled" fillcolor=red];
}
2 -> {3};
subgraph cluster_2 {
color=red
4 [label="Enter function closeFinally" style="filled" fillcolor=red];
subgraph cluster_3 {
color=blue
5 [label="Enter when"];
subgraph cluster_4 {
color=blue
6 [label="Enter when branch condition "];
7 [label="Access variable this@R|/closeFinally|"];
8 [label="Const: Null(null)"];
9 [label="Operator =="];
10 [label="Exit when branch condition"];
}
subgraph cluster_5 {
color=blue
11 [label="Enter when branch condition "];
12 [label="Access variable R|<local>/cause|"];
13 [label="Const: Null(null)"];
14 [label="Operator =="];
15 [label="Exit when branch condition"];
}
subgraph cluster_6 {
color=blue
16 [label="Enter when branch condition else"];
17 [label="Exit when branch condition"];
}
18 [label="Enter when branch result"];
subgraph cluster_7 {
color=blue
19 [label="Enter block"];
subgraph cluster_8 {
color=blue
20 [label="Try expression enter"];
subgraph cluster_9 {
color=blue
21 [label="Try main block enter"];
subgraph cluster_10 {
color=blue
22 [label="Enter block"];
23 [label="Function call: this@R|/closeFinally|.R|/AutoCloseable.close|()"];
24 [label="Exit block"];
}
25 [label="Try main block exit"];
}
subgraph cluster_11 {
color=blue
26 [label="Catch enter"];
subgraph cluster_12 {
color=blue
27 [label="Enter block"];
28 [label="Access variable R|<local>/cause|"];
29 [label="Access variable R|<local>/closeException|"];
30 [label="Function call: R|<local>/cause|.R|/addSuppressed|(...)"];
31 [label="Exit block"];
}
32 [label="Catch exit"];
}
33 [label="Try expression exit"];
}
34 [label="Exit block"];
}
35 [label="Exit when branch result"];
36 [label="Enter when branch result"];
subgraph cluster_13 {
color=blue
37 [label="Enter block"];
38 [label="Function call: this@R|/closeFinally|.R|/AutoCloseable.close|()"];
39 [label="Exit block"];
}
40 [label="Exit when branch result"];
41 [label="Enter when branch result"];
subgraph cluster_14 {
color=blue
42 [label="Enter block"];
43 [label="Exit block"];
}
44 [label="Exit when branch result"];
45 [label="Exit when"];
}
46 [label="Jump: ^closeFinally when () {
==(this@R|/closeFinally|, Null(null)) -> {
}
==(R|<local>/cause|, Null(null)) -> {
this@R|/closeFinally|.R|/AutoCloseable.close|()
}
else -> {
try {
this@R|/closeFinally|.R|/AutoCloseable.close|()
}
catch (closeException: R|kotlin/Throwable|) {
R|<local>/cause|.R|/addSuppressed|(R|<local>/closeException|)
}
}
}
"];
47 [label="Stub" style="filled" fillcolor=gray];
48 [label="Exit function closeFinally" style="filled" fillcolor=red];
}
4 -> {5};
5 -> {6};
6 -> {7};
7 -> {8};
8 -> {9};
9 -> {10};
10 -> {41 11};
11 -> {12};
12 -> {13};
13 -> {14};
14 -> {15};
15 -> {36 16};
16 -> {17};
17 -> {18};
18 -> {19};
19 -> {20};
20 -> {21};
21 -> {48 26 22};
22 -> {23};
23 -> {24};
24 -> {25};
25 -> {33};
26 -> {48 27};
27 -> {28};
28 -> {29};
29 -> {30};
30 -> {31};
31 -> {32};
32 -> {33};
33 -> {34};
34 -> {35};
35 -> {45};
36 -> {37};
37 -> {38};
38 -> {39};
39 -> {40};
40 -> {45};
41 -> {42};
42 -> {43};
43 -> {44};
44 -> {45};
45 -> {46};
46 -> {48};
46 -> {47} [style=dotted];
47 -> {48} [style=dotted];
subgraph cluster_15 {
color=red
49 [label="Enter function firstIsInstanceOrNull" style="filled" fillcolor=red];
50 [label="Access variable this@R|/firstIsInstanceOrNull|"];
51 [label="Function call: this@R|/firstIsInstanceOrNull|.R|FakeOverride<kotlin/collections/List.iterator: R|kotlin/collections/Iterator<kotlin/Any?>|>|()"];
52 [label="Variable declaration: lval <iterator>: R|kotlin/collections/Iterator<kotlin/Any?>|"];
subgraph cluster_16 {
color=blue
53 [label="Enter while loop"];
subgraph cluster_17 {
color=blue
54 [label="Enter loop condition"];
55 [label="Access variable R|<local>/<iterator>|"];
56 [label="Function call: R|<local>/<iterator>|.R|kotlin/collections/Iterator.hasNext|()"];
57 [label="Exit loop condition"];
}
subgraph cluster_18 {
color=blue
58 [label="Enter loop block"];
subgraph cluster_19 {
color=blue
59 [label="Enter block"];
60 [label="Access variable R|<local>/<iterator>|"];
61 [label="Function call: R|<local>/<iterator>|.R|FakeOverride<kotlin/collections/Iterator.next: R|kotlin/Any?|>|()"];
62 [label="Variable declaration: lval element: R|kotlin/Any?|"];
subgraph cluster_20 {
color=blue
63 [label="Enter when"];
subgraph cluster_21 {
color=blue
64 [label="Enter when branch condition "];
65 [label="Access variable R|<local>/element|"];
66 [label="Type operator: (R|<local>/element| is R|T|)"];
67 [label="Exit when branch condition"];
}
68 [label="Synthetic else branch"];
69 [label="Enter when branch result"];
subgraph cluster_22 {
color=blue
70 [label="Enter block"];
71 [label="Access variable R|<local>/element|"];
72 [label="Jump: ^firstIsInstanceOrNull R|<local>/element|"];
73 [label="Stub" style="filled" fillcolor=gray];
74 [label="Exit block" style="filled" fillcolor=gray];
}
75 [label="Exit when branch result" style="filled" fillcolor=gray];
76 [label="Exit when"];
}
77 [label="Exit block"];
}
78 [label="Exit loop block"];
}
79 [label="Exit whileloop"];
}
80 [label="Const: Null(null)"];
81 [label="Jump: ^firstIsInstanceOrNull Null(null)"];
82 [label="Stub" style="filled" fillcolor=gray];
83 [label="Exit function firstIsInstanceOrNull" style="filled" fillcolor=red];
}
49 -> {50};
50 -> {51};
51 -> {52};
52 -> {53};
53 -> {54};
54 -> {55};
55 -> {56};
56 -> {57};
57 -> {79 58};
58 -> {59};
59 -> {60};
60 -> {61};
61 -> {62};
62 -> {63};
63 -> {64};
64 -> {65};
65 -> {66};
66 -> {67};
67 -> {69 68};
68 -> {76};
69 -> {70};
70 -> {71};
71 -> {72};
72 -> {83};
72 -> {73} [style=dotted];
73 -> {74} [style=dotted];
74 -> {75} [style=dotted];
75 -> {76} [style=dotted];
76 -> {77};
77 -> {78};
78 -> {54};
79 -> {80};
80 -> {81};
81 -> {83};
81 -> {82} [style=dotted];
82 -> {83} [style=dotted];
}
@@ -0,0 +1,22 @@
// !DUMP_CFG
interface AutoCloseable {
fun close()
}
fun Throwable.addSuppressed(other: Throwable) {}
internal fun AutoCloseable?.closeFinally(cause: Throwable?) = when {
this == null -> {}
cause == null -> close()
else ->
try {
close()
} catch (closeException: Throwable) {
cause.addSuppressed(closeException)
}
}
inline fun <reified T : Any> List<*>.firstIsInstanceOrNull(): T? {
for (element in this) if (element is T) return element
return null
}
@@ -0,0 +1,40 @@
FILE: complex.kt
public abstract interface AutoCloseable : R|kotlin/Any| {
public abstract fun close(): R|kotlin/Unit|
}
public final fun R|kotlin/Throwable|.addSuppressed(other: R|kotlin/Throwable|): R|kotlin/Unit| {
}
internal final fun R|AutoCloseable?|.closeFinally(cause: R|kotlin/Throwable?|): R|kotlin/Unit| {
^closeFinally when () {
==(this@R|/closeFinally|, Null(null)) -> {
}
==(R|<local>/cause|, Null(null)) -> {
this@R|/closeFinally|.R|/AutoCloseable.close|()
}
else -> {
try {
this@R|/closeFinally|.R|/AutoCloseable.close|()
}
catch (closeException: R|kotlin/Throwable|) {
R|<local>/cause|.R|/addSuppressed|(R|<local>/closeException|)
}
}
}
}
public final inline fun <reified T : R|kotlin/Any|> R|kotlin/collections/List<*>|.firstIsInstanceOrNull(): R|T?| {
lval <iterator>: R|kotlin/collections/Iterator<kotlin/Any?>| = this@R|/firstIsInstanceOrNull|.R|FakeOverride<kotlin/collections/List.iterator: R|kotlin/collections/Iterator<kotlin/Any?>|>|()
while(R|<local>/<iterator>|.R|kotlin/collections/Iterator.hasNext|()) {
lval element: R|kotlin/Any?| = R|<local>/<iterator>|.R|FakeOverride<kotlin/collections/Iterator.next: R|kotlin/Any?|>|()
when () {
(R|<local>/element| is R|T|) -> {
^firstIsInstanceOrNull R|<local>/element|
}
}
}
^firstIsInstanceOrNull Null(null)
}
@@ -0,0 +1,63 @@
digraph emptyWhen_kt {
graph [nodesep=3]
node [shape=box penwidth=2]
edge [penwidth=2]
subgraph cluster_0 {
color=red
0 [label="Enter function test_1" style="filled" fillcolor=red];
subgraph cluster_1 {
color=blue
1 [label="Enter when"];
2 [label="Synthetic else branch"];
3 [label="Exit when"];
}
4 [label="Exit function test_1" style="filled" fillcolor=red];
}
0 -> {1};
1 -> {2};
2 -> {3};
3 -> {4};
subgraph cluster_2 {
color=red
5 [label="Enter function test_2" style="filled" fillcolor=red];
subgraph cluster_3 {
color=blue
6 [label="Enter when"];
7 [label="Access variable R|<local>/x|"];
8 [label="Synthetic else branch"];
9 [label="Exit when"];
}
10 [label="Exit function test_2" style="filled" fillcolor=red];
}
5 -> {6};
6 -> {7};
7 -> {8};
8 -> {9};
9 -> {10};
subgraph cluster_4 {
color=red
11 [label="Enter function test_3" style="filled" fillcolor=red];
subgraph cluster_5 {
color=blue
12 [label="Enter when"];
13 [label="Access variable R|<local>/x|"];
14 [label="Variable declaration: lval y: R|kotlin/Int|"];
15 [label="Synthetic else branch"];
16 [label="Exit when"];
}
17 [label="Exit function test_3" style="filled" fillcolor=red];
}
11 -> {12};
12 -> {13};
13 -> {14};
14 -> {15};
15 -> {16};
16 -> {17};
}
@@ -0,0 +1,12 @@
// !DUMP_CFG
fun test_1() {
when {}
}
fun test_2(x: Int) {
when (x) {}
}
fun test_3(x: Int) {
when (val y = x) {}
}
@@ -0,0 +1,16 @@
FILE: emptyWhen.kt
public final fun test_1(): R|kotlin/Unit| {
when () {
}
}
public final fun test_2(x: R|kotlin/Int|): R|kotlin/Unit| {
when (R|<local>/x|) {
}
}
public final fun test_3(x: R|kotlin/Int|): R|kotlin/Unit| {
when (lval y: R|kotlin/Int| = R|<local>/x|) {
}
}
@@ -0,0 +1,451 @@
digraph flowFromInplaceLambda_kt {
graph [nodesep=3]
node [shape=box penwidth=2]
edge [penwidth=2]
subgraph cluster_0 {
color=red
0 [label="Enter function takeInt" style="filled" fillcolor=red];
1 [label="Exit function takeInt" style="filled" fillcolor=red];
}
0 -> {1};
subgraph cluster_1 {
color=red
2 [label="Enter function select" style="filled" fillcolor=red];
3 [label="Access variable R|<local>/x|"];
4 [label="Const: Int(0)"];
5 [label="Function call: R|<local>/x|.R|FakeOverride<kotlin/Array.get: R|K|>|(...)"];
6 [label="Jump: ^select R|<local>/x|.R|FakeOverride<kotlin/Array.get: R|K|>|(Int(0))"];
7 [label="Stub" style="filled" fillcolor=gray];
8 [label="Exit function select" style="filled" fillcolor=red];
}
2 -> {3};
3 -> {4};
4 -> {5};
5 -> {6};
6 -> {8};
6 -> {7} [style=dotted];
7 -> {8} [style=dotted];
subgraph cluster_2 {
color=red
9 [label="Enter function id" style="filled" fillcolor=red];
10 [label="Access variable R|<local>/x|"];
11 [label="Jump: ^id R|<local>/x|"];
12 [label="Stub" style="filled" fillcolor=gray];
13 [label="Exit function id" style="filled" fillcolor=red];
}
9 -> {10};
10 -> {11};
11 -> {13};
11 -> {12} [style=dotted];
12 -> {13} [style=dotted];
subgraph cluster_3 {
color=red
14 [label="Enter function materialize" style="filled" fillcolor=red];
15 [label="Const: Null(null)"];
16 [label="Check not null: Null(null)!!"];
17 [label="Jump: ^materialize Null(null)!!"];
18 [label="Stub" style="filled" fillcolor=gray];
19 [label="Exit function materialize" style="filled" fillcolor=red];
}
14 -> {15};
15 -> {16};
16 -> {17};
17 -> {19};
17 -> {18} [style=dotted];
18 -> {19} [style=dotted];
subgraph cluster_4 {
color=red
20 [label="Enter function myRun" style="filled" fillcolor=red];
21 [label="Function call: R|<local>/block|.R|FakeOverride<kotlin/Function0.invoke: R|R|>|()"];
22 [label="Jump: ^myRun R|<local>/block|.R|FakeOverride<kotlin/Function0.invoke: R|R|>|()"];
23 [label="Stub" style="filled" fillcolor=gray];
24 [label="Exit function myRun" style="filled" fillcolor=red];
}
20 -> {21};
21 -> {22};
22 -> {24};
22 -> {23} [style=dotted];
23 -> {24} [style=dotted];
subgraph cluster_5 {
color=red
25 [label="Enter function test_1" style="filled" fillcolor=red];
26 [label="Postponed enter to lambda"];
subgraph cluster_6 {
color=blue
27 [label="Enter function anonymousFunction"];
28 [label="Access variable R|<local>/x|"];
29 [label="Type operator: (R|<local>/x| as R|kotlin/Int|)"];
30 [label="Exit function anonymousFunction"];
}
31 [label="Call arguments union" style="filled" fillcolor=yellow];
32 [label="Postponed exit from lambda"];
33 [label="Function call: R|kotlin/run|<R|kotlin/Int|>(...)"];
34 [label="Access variable R|<local>/x|"];
35 [label="Function call: R|/takeInt|(...)"];
36 [label="Exit function test_1" style="filled" fillcolor=red];
}
25 -> {26};
26 -> {27};
26 -> {32} [color=red];
27 -> {28};
28 -> {29};
29 -> {30};
30 -> {32} [color=green];
30 -> {31} [color=red];
31 -> {33} [color=red];
32 -> {33} [color=green];
33 -> {34};
34 -> {35};
35 -> {36};
subgraph cluster_7 {
color=red
37 [label="Enter function test_2" style="filled" fillcolor=red];
38 [label="Postponed enter to lambda"];
subgraph cluster_8 {
color=blue
39 [label="Enter function anonymousFunction"];
40 [label="Access variable R|<local>/y|"];
41 [label="Function call: R|<local>/y|.<Unresolved name: inc>#()"];
42 [label="Access variable R|<local>/x|"];
43 [label="Type operator: (R|<local>/x| as R|kotlin/Int|)"];
44 [label="Exit function anonymousFunction"];
}
45 [label="Postponed exit from lambda"];
46 [label="Function call: R|kotlin/run|<R|kotlin/Int|>(...)"];
47 [label="Call arguments union" style="filled" fillcolor=yellow];
48 [label="Function call: R|/id|<R|kotlin/Int|>(...)"];
49 [label="Access variable R|<local>/y|"];
50 [label="Type operator: (R|<local>/y| as R|kotlin/Int|)"];
51 [label="Postponed enter to lambda"];
subgraph cluster_9 {
color=blue
52 [label="Enter function anonymousFunction"];
53 [label="Access variable R|<local>/x|"];
54 [label="Function call: R|<local>/x|.R|kotlin/Int.inc|()"];
55 [label="Access variable R|<local>/y|"];
56 [label="Function call: R|<local>/y|.R|kotlin/Int.inc|()"];
57 [label="Const: Int(1)"];
58 [label="Exit function anonymousFunction"];
}
59 [label="Postponed exit from lambda"];
60 [label="Function call: R|kotlin/run|<R|kotlin/Int|>(...)"];
61 [label="Call arguments union" style="filled" fillcolor=yellow];
62 [label="Function call: R|/select|<R|kotlin/Int|>(...)"];
63 [label="Variable declaration: lval a: R|kotlin/Int|"];
64 [label="Access variable R|<local>/x|"];
65 [label="Function call: R|/takeInt|(...)"];
66 [label="Access variable R|<local>/y|"];
67 [label="Function call: R|/takeInt|(...)"];
68 [label="Access variable R|<local>/a|"];
69 [label="Function call: R|/takeInt|(...)"];
70 [label="Exit function test_2" style="filled" fillcolor=red];
}
37 -> {38};
38 -> {39};
38 -> {45} [color=red];
39 -> {40};
40 -> {41};
41 -> {42};
42 -> {43};
43 -> {44};
44 -> {45} [color=green];
44 -> {47} [color=red];
45 -> {46};
46 -> {47};
47 -> {48};
48 -> {49};
49 -> {50};
50 -> {51};
51 -> {52};
51 -> {59} [color=red];
52 -> {53};
53 -> {54};
54 -> {55};
55 -> {56};
56 -> {57};
57 -> {58};
58 -> {59} [color=green];
58 -> {61} [color=red];
59 -> {60};
60 -> {61};
61 -> {62};
62 -> {63};
63 -> {64};
64 -> {65};
65 -> {66};
66 -> {67};
67 -> {68};
68 -> {69};
69 -> {70};
subgraph cluster_10 {
color=red
71 [label="Enter function test_3" style="filled" fillcolor=red];
72 [label="Postponed enter to lambda"];
subgraph cluster_11 {
color=blue
73 [label="Enter function anonymousFunction"];
74 [label="Access variable R|<local>/y|"];
75 [label="Function call: R|<local>/y|.<Unresolved name: inc>#()"];
76 [label="Access variable R|<local>/x|"];
77 [label="Type operator: (R|<local>/x| as R|kotlin/Int|)"];
78 [label="Function call: R|/materialize|<R|kotlin/Int|>()"];
79 [label="Exit function anonymousFunction"];
}
80 [label="Postponed exit from lambda"];
81 [label="Function call: R|kotlin/run|<R|kotlin/Int|>(...)"];
82 [label="Function call: R|/id|<R|kotlin/Int|>(...)"];
83 [label="Postponed enter to lambda"];
subgraph cluster_12 {
color=blue
84 [label="Enter function anonymousFunction"];
85 [label="Access variable R|<local>/y|"];
86 [label="Type operator: (R|<local>/y| as R|kotlin/Int|)"];
87 [label="Access variable R|<local>/x|"];
88 [label="Function call: R|<local>/x|.<Unresolved name: inc>#()"];
89 [label="Access variable R|<local>/y|"];
90 [label="Function call: R|<local>/y|.R|kotlin/Int.inc|()"];
91 [label="Const: Int(1)"];
92 [label="Exit function anonymousFunction"];
}
93 [label="Postponed exit from lambda"];
94 [label="Function call: R|kotlin/run|<R|kotlin/Int|>(...)"];
95 [label="Call arguments union" style="filled" fillcolor=yellow];
96 [label="Function call: R|/select|<R|kotlin/Int|>(...)"];
97 [label="Variable declaration: lval a: R|kotlin/Int|"];
98 [label="Access variable R|<local>/x|"];
99 [label="Function call: R|/takeInt|(...)"];
100 [label="Access variable R|<local>/y|"];
101 [label="Function call: R|/takeInt|(...)"];
102 [label="Access variable R|<local>/a|"];
103 [label="Function call: R|/takeInt|(...)"];
104 [label="Exit function test_3" style="filled" fillcolor=red];
}
71 -> {72};
72 -> {73};
72 -> {80} [color=red];
73 -> {74};
74 -> {75};
75 -> {76};
76 -> {77};
77 -> {78};
78 -> {79};
79 -> {80} [color=green];
79 -> {95} [color=red];
80 -> {81};
81 -> {82};
82 -> {83};
83 -> {84};
83 -> {93} [color=red];
84 -> {85};
85 -> {86};
86 -> {87};
87 -> {88};
88 -> {89};
89 -> {90};
90 -> {91};
91 -> {92};
92 -> {93} [color=green];
92 -> {95} [color=red];
93 -> {94};
94 -> {95};
95 -> {96};
96 -> {97};
97 -> {98};
98 -> {99};
99 -> {100};
100 -> {101};
101 -> {102};
102 -> {103};
103 -> {104};
subgraph cluster_13 {
color=red
105 [label="Enter function test_4" style="filled" fillcolor=red];
106 [label="Postponed enter to lambda"];
107 [label="Postponed exit from lambda"];
108 [label="Function call: R|/myRun|<R|kotlin/Int|>(...)"];
109 [label="Function call: R|/id|<R|kotlin/Int|>(...)"];
110 [label="Access variable R|<local>/y|"];
111 [label="Type operator: (R|<local>/y| as R|kotlin/Int|)"];
112 [label="Postponed enter to lambda"];
113 [label="Postponed exit from lambda"];
114 [label="Function call: R|/myRun|<R|kotlin/Int|>(...)"];
115 [label="Function call: R|/select|<R|kotlin/Int|>(...)"];
116 [label="Variable declaration: lval a: R|kotlin/Int|"];
117 [label="Access variable R|<local>/x|"];
118 [label="Access variable R|<local>/x|"];
119 [label="Access variable R|<local>/x|"];
120 [label="Function call: <Inapplicable(INAPPLICABLE): [/takeInt]>#(...)"];
121 [label="Access variable R|<local>/y|"];
122 [label="Function call: R|/takeInt|(...)"];
123 [label="Access variable R|<local>/a|"];
124 [label="Function call: R|/takeInt|(...)"];
125 [label="Exit function test_4" style="filled" fillcolor=red];
}
105 -> {106};
106 -> {107 107} [color=green];
107 -> {108};
108 -> {109};
109 -> {110};
110 -> {111};
111 -> {112};
112 -> {113 113} [color=green];
113 -> {114};
114 -> {115};
115 -> {116};
116 -> {117};
117 -> {118};
118 -> {119};
119 -> {120};
120 -> {121};
121 -> {122};
122 -> {123};
123 -> {124};
124 -> {125};
subgraph cluster_14 {
color=red
126 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
127 [label="Access variable R|<local>/y|"];
128 [label="Function call: R|<local>/y|.<Unresolved name: inc>#()"];
129 [label="Access variable R|<local>/x|"];
130 [label="Type operator: (R|<local>/x| as R|kotlin/Int|)"];
131 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
}
126 -> {127};
127 -> {128};
128 -> {129};
129 -> {130};
130 -> {131};
subgraph cluster_15 {
color=red
132 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
133 [label="Access variable R|<local>/x|"];
134 [label="Function call: R|<local>/x|.<Unresolved name: inc>#()"];
135 [label="Access variable R|<local>/y|"];
136 [label="Function call: R|<local>/y|.R|kotlin/Int.inc|()"];
137 [label="Const: Int(1)"];
138 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
}
132 -> {133};
133 -> {134};
134 -> {135};
135 -> {136};
136 -> {137};
137 -> {138};
subgraph cluster_16 {
color=red
139 [label="Enter function test_5" style="filled" fillcolor=red];
140 [label="Postponed enter to lambda"];
subgraph cluster_17 {
color=blue
141 [label="Enter function anonymousFunction"];
142 [label="Function call: R|/materialize|<R|kotlin/Int|>()"];
143 [label="Exit function anonymousFunction"];
}
144 [label="Postponed exit from lambda"];
145 [label="Function call: R|kotlin/run|<R|kotlin/Int|>(...)"];
146 [label="Postponed enter to lambda"];
subgraph cluster_18 {
color=blue
147 [label="Enter function anonymousFunction"];
148 [label="Function call: R|/materialize|<R|kotlin/Int|>()"];
149 [label="Exit function anonymousFunction"];
}
150 [label="Postponed exit from lambda"];
151 [label="Function call: R|kotlin/run|<R|kotlin/Int|>(...)"];
152 [label="Call arguments union" style="filled" fillcolor=yellow];
153 [label="Function call: R|/select|<R|kotlin/Int|>(...)"];
154 [label="Variable declaration: lval x: R|kotlin/Int|"];
155 [label="Access variable R|<local>/x|"];
156 [label="Function call: R|/takeInt|(...)"];
157 [label="Exit function test_5" style="filled" fillcolor=red];
}
139 -> {140};
140 -> {141};
140 -> {144} [color=red];
141 -> {142};
142 -> {143};
143 -> {144} [color=green];
143 -> {152} [color=red];
144 -> {145};
145 -> {146};
146 -> {147};
146 -> {150} [color=red];
147 -> {148};
148 -> {149};
149 -> {150} [color=green];
149 -> {152} [color=red];
150 -> {151};
151 -> {152};
152 -> {153};
153 -> {154};
154 -> {155};
155 -> {156};
156 -> {157};
subgraph cluster_19 {
color=red
158 [label="Enter function test_6" style="filled" fillcolor=red];
159 [label="Postponed enter to lambda"];
160 [label="Postponed exit from lambda"];
161 [label="Function call: R|/myRun|<R|kotlin/String|>(...)"];
162 [label="Function call: R|/id|<R|kotlin/String|>(...)"];
163 [label="Variable declaration: lval x: R|kotlin/String|"];
164 [label="Exit function test_6" style="filled" fillcolor=red];
}
158 -> {159};
159 -> {160 160} [color=green];
160 -> {161};
161 -> {162};
162 -> {163};
163 -> {164};
subgraph cluster_20 {
color=red
165 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
166 [label="Postponed enter to lambda"];
subgraph cluster_21 {
color=blue
167 [label="Enter function anonymousFunction"];
168 [label="Function call: R|/materialize|<R|kotlin/String|>()"];
169 [label="Exit function anonymousFunction"];
}
170 [label="Postponed exit from lambda"];
171 [label="Function call: R|kotlin/run|<R|kotlin/String|>(...)"];
172 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
}
165 -> {166};
166 -> {167};
166 -> {170} [color=red];
167 -> {168};
168 -> {169};
169 -> {170} [color=green];
170 -> {171};
171 -> {172};
}
@@ -0,0 +1,93 @@
// !DUMP_CFG
fun takeInt(x: Int) {}
fun <K> select(vararg x: K): K = x[0]
fun <T> id(x: T): T = x
fun <K> materialize(): K = null!!
fun <R> myRun(block: () -> R): R = block()
fun test_1(x: Any) {
run {
x as Int
}
takeInt(x) // OK
}
fun test_2(x: Any, y: Any) {
val a = select(
id(
run {
y.<!UNRESOLVED_REFERENCE!>inc<!>() // Bad
x as Int
}
),
y as Int,
run {
x.inc() // Should be "Bad" but "OK" is fine
y.inc() // OK
1
}
)
takeInt(x) // OK
takeInt(y) // OK
takeInt(a) // OK
}
fun test_3(x: Any, y: Any) {
val a = select(
id(
run {
y.<!UNRESOLVED_REFERENCE!>inc<!>() // Bad
x as Int
materialize()
}
),
run {
y as Int
x.<!UNRESOLVED_REFERENCE!>inc<!>() // Bad
y.inc() // OK
1
}
)
takeInt(x) // OK
takeInt(y) // OK
takeInt(a) // OK
}
fun test_4(x: Any, y: Any) {
val a = select(
id(
myRun {
y.<!UNRESOLVED_REFERENCE!>inc<!>() // Bad
x as Int
}
),
y as Int,
myRun {
x.<!UNRESOLVED_REFERENCE!>inc<!>() // Bad
y.inc() // OK
1
}
)
<!INAPPLICABLE_CANDIDATE!>takeInt<!>(x) // Bad
takeInt(y) // OK
takeInt(a) // Bad
}
fun test_5() {
val x: Int = select(run { materialize() }, run { materialize() })
takeInt(x)
}
fun test_6() {
val x: String = id(
myRun {
run {
materialize()
}
}
)
}
@@ -0,0 +1,88 @@
FILE: flowFromInplaceLambda.kt
public final fun takeInt(x: R|kotlin/Int|): R|kotlin/Unit| {
}
public final fun <K> select(vararg x: R|kotlin/Array<out K>|): R|K| {
^select R|<local>/x|.R|FakeOverride<kotlin/Array.get: R|K|>|(Int(0))
}
public final fun <T> id(x: R|T|): R|T| {
^id R|<local>/x|
}
public final fun <K> materialize(): R|K| {
^materialize Null(null)!!
}
public final fun <R> myRun(block: R|() -> R|): R|R| {
^myRun R|<local>/block|.R|FakeOverride<kotlin/Function0.invoke: R|R|>|()
}
public final fun test_1(x: R|kotlin/Any|): R|kotlin/Unit| {
R|kotlin/run|<R|kotlin/Int|>(<L> = run@fun <anonymous>(): R|kotlin/Int| <kind=EXACTLY_ONCE> {
^ (R|<local>/x| as R|kotlin/Int|)
}
)
R|/takeInt|(R|<local>/x|)
}
public final fun test_2(x: R|kotlin/Any|, y: R|kotlin/Any|): R|kotlin/Unit| {
lval a: R|kotlin/Int| = R|/select|<R|kotlin/Int|>(vararg(R|/id|<R|kotlin/Int|>(R|kotlin/run|<R|kotlin/Int|>(<L> = run@fun <anonymous>(): R|kotlin/Int| <kind=EXACTLY_ONCE> {
R|<local>/y|.<Unresolved name: inc>#()
^ (R|<local>/x| as R|kotlin/Int|)
}
)), (R|<local>/y| as R|kotlin/Int|), R|kotlin/run|<R|kotlin/Int|>(<L> = run@fun <anonymous>(): R|kotlin/Int| <kind=EXACTLY_ONCE> {
R|<local>/x|.R|kotlin/Int.inc|()
R|<local>/y|.R|kotlin/Int.inc|()
^ Int(1)
}
)))
R|/takeInt|(R|<local>/x|)
R|/takeInt|(R|<local>/y|)
R|/takeInt|(R|<local>/a|)
}
public final fun test_3(x: R|kotlin/Any|, y: R|kotlin/Any|): R|kotlin/Unit| {
lval a: R|kotlin/Int| = R|/select|<R|kotlin/Int|>(vararg(R|/id|<R|kotlin/Int|>(R|kotlin/run|<R|kotlin/Int|>(<L> = run@fun <anonymous>(): R|kotlin/Int| <kind=EXACTLY_ONCE> {
R|<local>/y|.<Unresolved name: inc>#()
(R|<local>/x| as R|kotlin/Int|)
^ R|/materialize|<R|kotlin/Int|>()
}
)), R|kotlin/run|<R|kotlin/Int|>(<L> = run@fun <anonymous>(): R|kotlin/Int| <kind=EXACTLY_ONCE> {
(R|<local>/y| as R|kotlin/Int|)
R|<local>/x|.<Unresolved name: inc>#()
R|<local>/y|.R|kotlin/Int.inc|()
^ Int(1)
}
)))
R|/takeInt|(R|<local>/x|)
R|/takeInt|(R|<local>/y|)
R|/takeInt|(R|<local>/a|)
}
public final fun test_4(x: R|kotlin/Any|, y: R|kotlin/Any|): R|kotlin/Unit| {
lval a: R|kotlin/Int| = R|/select|<R|kotlin/Int|>(vararg(R|/id|<R|kotlin/Int|>(R|/myRun|<R|kotlin/Int|>(<L> = myRun@fun <anonymous>(): R|kotlin/Int| {
R|<local>/y|.<Unresolved name: inc>#()
^ (R|<local>/x| as R|kotlin/Int|)
}
)), (R|<local>/y| as R|kotlin/Int|), R|/myRun|<R|kotlin/Int|>(<L> = myRun@fun <anonymous>(): R|kotlin/Int| {
R|<local>/x|.<Unresolved name: inc>#()
R|<local>/y|.R|kotlin/Int.inc|()
^ Int(1)
}
)))
<Inapplicable(INAPPLICABLE): [/takeInt]>#(R|<local>/x|)
R|/takeInt|(R|<local>/y|)
R|/takeInt|(R|<local>/a|)
}
public final fun test_5(): R|kotlin/Unit| {
lval x: R|kotlin/Int| = R|/select|<R|kotlin/Int|>(vararg(R|kotlin/run|<R|kotlin/Int|>(<L> = run@fun <anonymous>(): R|kotlin/Int| <kind=EXACTLY_ONCE> {
^ R|/materialize|<R|kotlin/Int|>()
}
), R|kotlin/run|<R|kotlin/Int|>(<L> = run@fun <anonymous>(): R|kotlin/Int| <kind=EXACTLY_ONCE> {
^ R|/materialize|<R|kotlin/Int|>()
}
)))
R|/takeInt|(R|<local>/x|)
}
public final fun test_6(): R|kotlin/Unit| {
lval x: R|kotlin/String| = R|/id|<R|kotlin/String|>(R|/myRun|<R|kotlin/String|>(<L> = myRun@fun <anonymous>(): R|kotlin/String| {
^ R|kotlin/run|<R|kotlin/String|>(<L> = run@fun <anonymous>(): R|kotlin/String| <kind=EXACTLY_ONCE> {
^ R|/materialize|<R|kotlin/String|>()
}
)
}
))
}
@@ -0,0 +1,26 @@
digraph initBlock_kt {
graph [nodesep=3]
node [shape=box penwidth=2]
edge [penwidth=2]
subgraph cluster_0 {
color=red
0 [label="Enter function <init>" style="filled" fillcolor=red];
1 [label="Delegated constructor call: super<R|kotlin/Any|>()"];
2 [label="Exit function <init>" style="filled" fillcolor=red];
}
0 -> {1};
1 -> {2};
subgraph cluster_1 {
color=red
3 [label="Enter function <init>" style="filled" fillcolor=red];
4 [label="Delegated constructor call: super<R|kotlin/Any|>()"];
5 [label="Exit function <init>" style="filled" fillcolor=red];
}
3 -> {4};
4 -> {5};
}
@@ -0,0 +1,14 @@
// !DUMP_CFG
class Foo {
init {
val x = 1
}
}
class Bar {
init {
val x = 1
throw Exception()
val y = 2
}
}
@@ -0,0 +1,23 @@
FILE: initBlock.kt
public final class Foo : R|kotlin/Any| {
public constructor(): R|Foo| {
super<R|kotlin/Any|>()
}
init {
lval x: R|kotlin/Int| = Int(1)
}
}
public final class Bar : R|kotlin/Any| {
public constructor(): R|Bar| {
super<R|kotlin/Any|>()
}
init {
lval x: R|kotlin/Int| = Int(1)
throw R|java/lang/Exception.Exception|()
lval y: R|kotlin/Int| = Int(2)
}
}
@@ -0,0 +1,32 @@
digraph initBlockAndInPlaceLambda_kt {
graph [nodesep=3]
node [shape=box penwidth=2]
edge [penwidth=2]
subgraph cluster_0 {
color=red
0 [label="Enter function getter" style="filled" fillcolor=red];
1 [label="Exit function getter" style="filled" fillcolor=red];
}
0 -> {1};
subgraph cluster_1 {
color=red
2 [label="Enter property" style="filled" fillcolor=red];
3 [label="Exit property" style="filled" fillcolor=red];
}
2 -> {3};
subgraph cluster_2 {
color=red
4 [label="Enter function <init>" style="filled" fillcolor=red];
5 [label="Delegated constructor call: super<R|kotlin/Any|>()"];
6 [label="Exit function <init>" style="filled" fillcolor=red];
}
4 -> {5};
5 -> {6};
}
@@ -0,0 +1,14 @@
// !DUMP_CFG
interface B
interface A {
val b: B?
}
class C(a: A, b: b) {
init {
val c = a.b?.let {
C(a, it)
}
}
}
@@ -0,0 +1,21 @@
FILE: initBlockAndInPlaceLambda.kt
public abstract interface B : R|kotlin/Any| {
}
public abstract interface A : R|kotlin/Any| {
public abstract val b: R|B?|
public get(): R|B?|
}
public final class C : R|kotlin/Any| {
public constructor(a: R|A|, b: R|ERROR CLASS: Symbol not found, for `b`|): R|C| {
super<R|kotlin/Any|>()
}
init {
lval c: R|C?| = R|<local>/a|.R|/A.b|?.R|kotlin/let|<R|B|, R|C|>(<L> = let@fun <anonymous>(it: R|B|): R|C| <kind=EXACTLY_ONCE> {
^ R|/C.C|(R|<local>/a|, R|<local>/it|)
}
)
}
}
@@ -0,0 +1,196 @@
digraph inplaceLambdaInControlFlowExpressions_kt {
graph [nodesep=3]
node [shape=box penwidth=2]
edge [penwidth=2]
subgraph cluster_0 {
color=red
0 [label="Enter function materialize" style="filled" fillcolor=red];
1 [label="Const: Null(null)"];
2 [label="Check not null: Null(null)!!"];
3 [label="Jump: ^materialize Null(null)!!"];
4 [label="Stub" style="filled" fillcolor=gray];
5 [label="Exit function materialize" style="filled" fillcolor=red];
}
0 -> {1};
1 -> {2};
2 -> {3};
3 -> {5};
3 -> {4} [style=dotted];
4 -> {5} [style=dotted];
subgraph cluster_1 {
color=red
6 [label="Enter function test_1" style="filled" fillcolor=red];
subgraph cluster_2 {
color=blue
7 [label="Enter when"];
subgraph cluster_3 {
color=blue
8 [label="Enter when branch condition "];
9 [label="Const: Boolean(true)"];
10 [label="Exit when branch condition"];
}
subgraph cluster_4 {
color=blue
11 [label="Enter when branch condition else"];
12 [label="Exit when branch condition"];
}
13 [label="Enter when branch result"];
subgraph cluster_5 {
color=blue
14 [label="Enter block"];
15 [label="Const: String()"];
16 [label="Exit block"];
}
17 [label="Exit when branch result"];
18 [label="Enter when branch result"];
subgraph cluster_6 {
color=blue
19 [label="Enter block"];
20 [label="Postponed enter to lambda"];
subgraph cluster_7 {
color=blue
21 [label="Enter function anonymousFunction"];
22 [label="Function call: R|/materialize|<R|kotlin/String|>()"];
23 [label="Exit function anonymousFunction"];
}
24 [label="Postponed exit from lambda"];
25 [label="Function call: R|kotlin/run|<R|kotlin/String|>(...)"];
26 [label="Exit block"];
}
27 [label="Exit when branch result"];
28 [label="Exit when"];
}
29 [label="Call arguments union" style="filled" fillcolor=yellow];
30 [label="Variable declaration: lval x: R|kotlin/String|"];
31 [label="Exit function test_1" style="filled" fillcolor=red];
}
6 -> {7};
7 -> {8};
8 -> {9};
9 -> {10};
10 -> {18 11};
11 -> {12};
12 -> {13};
13 -> {14};
14 -> {15};
15 -> {16};
16 -> {17};
17 -> {28};
18 -> {19};
19 -> {20};
20 -> {21};
20 -> {24} [color=red];
21 -> {22};
22 -> {23};
23 -> {24} [color=green];
23 -> {29} [color=red];
24 -> {25};
25 -> {26};
26 -> {27};
27 -> {28};
28 -> {29};
29 -> {30};
30 -> {31};
subgraph cluster_8 {
color=red
32 [label="Enter function test_2" style="filled" fillcolor=red];
subgraph cluster_9 {
color=blue
33 [label="Try expression enter"];
subgraph cluster_10 {
color=blue
34 [label="Try main block enter"];
subgraph cluster_11 {
color=blue
35 [label="Enter block"];
36 [label="Postponed enter to lambda"];
subgraph cluster_12 {
color=blue
37 [label="Enter function anonymousFunction"];
38 [label="Function call: R|/materialize|<R|kotlin/String|>()"];
39 [label="Exit function anonymousFunction"];
}
40 [label="Postponed exit from lambda"];
41 [label="Function call: R|kotlin/run|<R|kotlin/String|>(...)"];
42 [label="Exit block"];
}
43 [label="Try main block exit"];
}
subgraph cluster_13 {
color=blue
44 [label="Catch enter"];
subgraph cluster_14 {
color=blue
45 [label="Enter block"];
46 [label="Const: String()"];
47 [label="Exit block"];
}
48 [label="Catch exit"];
}
49 [label="Try expression exit"];
}
50 [label="Call arguments union" style="filled" fillcolor=yellow];
51 [label="Variable declaration: lval x: R|kotlin/String|"];
52 [label="Exit function test_2" style="filled" fillcolor=red];
}
32 -> {33};
33 -> {34};
34 -> {52 44 35};
35 -> {36};
36 -> {37};
36 -> {40} [color=red];
37 -> {38};
38 -> {39};
39 -> {40} [color=green];
39 -> {50} [color=red];
40 -> {41};
41 -> {42};
42 -> {43};
43 -> {49};
44 -> {52 45};
45 -> {46};
46 -> {47};
47 -> {48};
48 -> {49};
49 -> {50};
50 -> {51};
51 -> {52};
subgraph cluster_15 {
color=red
53 [label="Enter function test_3" style="filled" fillcolor=red];
54 [label="Postponed enter to lambda"];
subgraph cluster_16 {
color=blue
55 [label="Enter function anonymousFunction"];
56 [label="Function call: R|/materialize|<R|kotlin/String?|>()"];
57 [label="Exit function anonymousFunction"];
}
58 [label="Postponed exit from lambda"];
59 [label="Function call: R|kotlin/run|<R|kotlin/String?|>(...)"];
60 [label="Check not null: R|kotlin/run|<R|kotlin/String?|>(...)!!"];
61 [label="Call arguments union" style="filled" fillcolor=yellow];
62 [label="Variable declaration: lval x: R|kotlin/String|"];
63 [label="Exit function test_3" style="filled" fillcolor=red];
}
53 -> {54};
54 -> {55};
54 -> {58} [color=red];
55 -> {56};
56 -> {57};
57 -> {58} [color=green];
57 -> {61} [color=red];
58 -> {59};
59 -> {60};
60 -> {61};
61 -> {62};
62 -> {63};
}
@@ -0,0 +1,25 @@
// !DUMP_CFG
fun <K> materialize(): K = null!!
fun test_1() {
val x = if (true) {
run { materialize() }
} else {
""
}
}
fun test_2() {
val x = try {
run {
materialize()
}
} catch (e: Exception) {
""
}
}
fun test_3() {
val x: String = run { materialize() }!!
}
@@ -0,0 +1,36 @@
FILE: inplaceLambdaInControlFlowExpressions.kt
public final fun <K> materialize(): R|K| {
^materialize Null(null)!!
}
public final fun test_1(): R|kotlin/Unit| {
lval x: R|kotlin/String| = when () {
Boolean(true) -> {
R|kotlin/run|<R|kotlin/String|>(<L> = run@fun <anonymous>(): R|kotlin/String| <kind=EXACTLY_ONCE> {
^ R|/materialize|<R|kotlin/String|>()
}
)
}
else -> {
String()
}
}
}
public final fun test_2(): R|kotlin/Unit| {
lval x: R|kotlin/String| = try {
R|kotlin/run|<R|kotlin/String|>(<L> = run@fun <anonymous>(): R|kotlin/String| <kind=EXACTLY_ONCE> {
^ R|/materialize|<R|kotlin/String|>()
}
)
}
catch (e: R|kotlin/Exception|) {
String()
}
}
public final fun test_3(): R|kotlin/Unit| {
lval x: R|kotlin/String| = R|kotlin/run|<R|kotlin/String?|>(<L> = run@fun <anonymous>(): R|kotlin/String?| <kind=EXACTLY_ONCE> {
^ R|/materialize|<R|kotlin/String?|>()
}
)!!
}
@@ -0,0 +1,362 @@
digraph jumps_kt {
graph [nodesep=3]
node [shape=box penwidth=2]
edge [penwidth=2]
subgraph cluster_0 {
color=red
0 [label="Enter function test_1" style="filled" fillcolor=red];
subgraph cluster_1 {
color=blue
1 [label="Enter when"];
subgraph cluster_2 {
color=blue
2 [label="Enter when branch condition "];
3 [label="Access variable R|<local>/x|"];
4 [label="Const: Null(null)"];
5 [label="Operator =="];
6 [label="Exit when branch condition"];
}
subgraph cluster_3 {
color=blue
7 [label="Enter when branch condition else"];
8 [label="Exit when branch condition"];
}
9 [label="Enter when branch result"];
subgraph cluster_4 {
color=blue
10 [label="Enter block"];
11 [label="Access variable R|<local>/x|"];
12 [label="Exit block"];
}
13 [label="Exit when branch result"];
14 [label="Enter when branch result"];
subgraph cluster_5 {
color=blue
15 [label="Enter block"];
16 [label="Function call: R|java/lang/Exception.Exception|()"];
17 [label="Throw: throw R|java/lang/Exception.Exception|()"];
18 [label="Stub" style="filled" fillcolor=gray];
19 [label="Exit block" style="filled" fillcolor=gray];
}
20 [label="Exit when branch result" style="filled" fillcolor=gray];
21 [label="Exit when"];
}
22 [label="Variable declaration: lval y: R|kotlin/Int|"];
23 [label="Access variable R|<local>/y|"];
24 [label="Function call: R|<local>/y|.R|kotlin/Int.inc|()"];
25 [label="Access variable R|<local>/x|"];
26 [label="Function call: R|<local>/x|.R|kotlin/Int.inc|()"];
27 [label="Exit function test_1" style="filled" fillcolor=red];
}
0 -> {1};
1 -> {2};
2 -> {3};
3 -> {4};
4 -> {5};
5 -> {6};
6 -> {14 7};
7 -> {8};
8 -> {9};
9 -> {10};
10 -> {11};
11 -> {12};
12 -> {13};
13 -> {21};
14 -> {15};
15 -> {16};
16 -> {17};
17 -> {27};
17 -> {18} [style=dotted];
18 -> {19} [style=dotted];
19 -> {20} [style=dotted];
20 -> {21} [style=dotted];
21 -> {22};
22 -> {23};
23 -> {24};
24 -> {25};
25 -> {26};
26 -> {27};
subgraph cluster_6 {
color=red
28 [label="Enter function test_2" style="filled" fillcolor=red];
subgraph cluster_7 {
color=blue
29 [label="Enter when"];
subgraph cluster_8 {
color=blue
30 [label="Enter when branch condition "];
31 [label="Access variable R|<local>/x|"];
32 [label="Const: Null(null)"];
33 [label="Operator =="];
34 [label="Exit when branch condition"];
}
subgraph cluster_9 {
color=blue
35 [label="Enter when branch condition else"];
36 [label="Exit when branch condition"];
}
37 [label="Enter when branch result"];
subgraph cluster_10 {
color=blue
38 [label="Enter block"];
39 [label="Access variable R|<local>/x|"];
40 [label="Exit block"];
}
41 [label="Exit when branch result"];
42 [label="Enter when branch result"];
subgraph cluster_11 {
color=blue
43 [label="Enter block"];
44 [label="Access variable R|<local>/x|"];
45 [label="Exit block"];
}
46 [label="Exit when branch result"];
47 [label="Exit when"];
}
48 [label="Variable declaration: lval y: R|kotlin/Int?|"];
49 [label="Access variable R|<local>/y|"];
50 [label="Function call: R|<local>/y|.<Inapplicable(WRONG_RECEIVER): [kotlin/Int.inc]>#()"];
51 [label="Exit function test_2" style="filled" fillcolor=red];
}
28 -> {29};
29 -> {30};
30 -> {31};
31 -> {32};
32 -> {33};
33 -> {34};
34 -> {42 35};
35 -> {36};
36 -> {37};
37 -> {38};
38 -> {39};
39 -> {40};
40 -> {41};
41 -> {47};
42 -> {43};
43 -> {44};
44 -> {45};
45 -> {46};
46 -> {47};
47 -> {48};
48 -> {49};
49 -> {50};
50 -> {51};
subgraph cluster_12 {
color=red
52 [label="Enter function test_3" style="filled" fillcolor=red];
subgraph cluster_13 {
color=blue
53 [label="Enter while loop"];
subgraph cluster_14 {
color=blue
54 [label="Enter loop condition"];
55 [label="Const: Boolean(true)"];
56 [label="Exit loop condition"];
}
subgraph cluster_15 {
color=blue
57 [label="Enter loop block"];
subgraph cluster_16 {
color=blue
58 [label="Enter block"];
59 [label="Access variable R|<local>/x|"];
60 [label="Type operator: (R|<local>/x| as R|kotlin/Int|)"];
61 [label="Jump: break@@@[Boolean(true)] "];
62 [label="Stub" style="filled" fillcolor=gray];
63 [label="Exit block" style="filled" fillcolor=gray];
}
64 [label="Exit loop block" style="filled" fillcolor=gray];
}
65 [label="Exit whileloop"];
}
66 [label="Access variable R|<local>/x|"];
67 [label="Function call: R|<local>/x|.R|kotlin/Int.inc|()"];
68 [label="Exit function test_3" style="filled" fillcolor=red];
}
52 -> {53};
53 -> {54};
54 -> {55};
55 -> {56};
56 -> {57};
56 -> {65} [style=dotted];
57 -> {58};
58 -> {59};
59 -> {60};
60 -> {61};
61 -> {65};
61 -> {62} [style=dotted];
62 -> {63} [style=dotted];
63 -> {64} [style=dotted];
64 -> {54} [style=dotted];
65 -> {66};
66 -> {67};
67 -> {68};
subgraph cluster_17 {
color=red
69 [label="Enter function test_4" style="filled" fillcolor=red];
subgraph cluster_18 {
color=blue
70 [label="Enter do-while loop"];
subgraph cluster_19 {
color=blue
71 [label="Enter loop block"];
subgraph cluster_20 {
color=blue
72 [label="Enter block"];
73 [label="Access variable R|<local>/x|"];
74 [label="Type operator: (R|<local>/x| as R|kotlin/Int|)"];
75 [label="Jump: break@@@[Boolean(true)] "];
76 [label="Stub" style="filled" fillcolor=gray];
77 [label="Exit block" style="filled" fillcolor=gray];
}
78 [label="Exit loop block" style="filled" fillcolor=gray];
}
subgraph cluster_21 {
color=blue
79 [label="Enter loop condition" style="filled" fillcolor=gray];
80 [label="Const: Boolean(true)" style="filled" fillcolor=gray];
81 [label="Exit loop condition" style="filled" fillcolor=gray];
}
82 [label="Exit do-whileloop"];
}
83 [label="Access variable R|<local>/x|"];
84 [label="Function call: R|<local>/x|.R|kotlin/Int.inc|()"];
85 [label="Exit function test_4" style="filled" fillcolor=red];
}
69 -> {70};
70 -> {71};
71 -> {72};
72 -> {73};
73 -> {74};
74 -> {75};
75 -> {82};
75 -> {76} [style=dotted];
76 -> {77} [style=dotted];
77 -> {78} [style=dotted];
78 -> {79} [style=dotted];
79 -> {80} [style=dotted];
80 -> {81} [style=dotted];
81 -> {71 82} [style=dotted];
82 -> {83};
83 -> {84};
84 -> {85};
subgraph cluster_22 {
color=red
86 [label="Enter function test_5" style="filled" fillcolor=red];
subgraph cluster_23 {
color=blue
87 [label="Enter while loop"];
subgraph cluster_24 {
color=blue
88 [label="Enter loop condition"];
89 [label="Access variable R|<local>/b|"];
90 [label="Exit loop condition"];
}
subgraph cluster_25 {
color=blue
91 [label="Enter loop block"];
subgraph cluster_26 {
color=blue
92 [label="Enter block"];
subgraph cluster_27 {
color=blue
93 [label="Enter when"];
subgraph cluster_28 {
color=blue
94 [label="Enter when branch condition "];
95 [label="Access variable R|<local>/b|"];
96 [label="Exit when branch condition"];
}
97 [label="Synthetic else branch"];
98 [label="Enter when branch result"];
subgraph cluster_29 {
color=blue
99 [label="Enter block"];
100 [label="Jump: continue@@@[R|<local>/b|] "];
101 [label="Stub" style="filled" fillcolor=gray];
102 [label="Exit block" style="filled" fillcolor=gray];
}
103 [label="Exit when branch result" style="filled" fillcolor=gray];
104 [label="Exit when"];
}
105 [label="Exit block"];
}
106 [label="Exit loop block"];
}
107 [label="Exit whileloop"];
}
108 [label="Exit function test_5" style="filled" fillcolor=red];
}
86 -> {87};
87 -> {88};
88 -> {89};
89 -> {90};
90 -> {107 91};
91 -> {92};
92 -> {93};
93 -> {94};
94 -> {95};
95 -> {96};
96 -> {98 97};
97 -> {104};
98 -> {99};
99 -> {100};
100 -> {87};
100 -> {101} [style=dotted];
101 -> {102} [style=dotted];
102 -> {103} [style=dotted];
103 -> {104} [style=dotted];
104 -> {105};
105 -> {106};
106 -> {88};
107 -> {108};
subgraph cluster_30 {
color=red
109 [label="Enter function run" style="filled" fillcolor=red];
110 [label="Function call: R|<local>/block|.R|FakeOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()"];
111 [label="Exit function run" style="filled" fillcolor=red];
}
109 -> {110};
110 -> {111};
subgraph cluster_31 {
color=red
112 [label="Enter function test_6" style="filled" fillcolor=red];
113 [label="Postponed enter to lambda"];
subgraph cluster_32 {
color=blue
114 [label="Enter function anonymousFunction"];
115 [label="Jump: ^@run Unit"];
116 [label="Stub" style="filled" fillcolor=gray];
117 [label="Exit function anonymousFunction"];
}
118 [label="Postponed exit from lambda"];
119 [label="Function call: R|/run|(...)"];
120 [label="Exit function test_6" style="filled" fillcolor=red];
}
112 -> {113};
113 -> {114};
113 -> {118} [color=red];
114 -> {117 115};
115 -> {117};
115 -> {116} [style=dotted];
116 -> {117} [style=dotted];
117 -> {114};
117 -> {118} [color=green];
118 -> {119};
119 -> {120};
}
@@ -0,0 +1,53 @@
// !DUMP_CFG
fun test_1(x: Int?) {
val y = if (x == null) {
throw Exception()
} else {
x
}
y.inc()
x.inc()
}
fun test_2(x: Int?) {
val y = if (x == null) {
x
} else {
x
}
y.<!INAPPLICABLE_CANDIDATE!>inc<!>()
}
fun test_3(x: Int?) {
while (true) {
x as Int
break
}
x.inc()
}
fun test_4(x: Int?) {
do {
x as Int
break
} while (true)
x.inc()
}
fun test_5(b: Boolean) {
while (b) {
if (b) {
continue
}
}
}
inline fun run(block: () -> Unit) {
block()
}
fun test_6() {
run {
return@run
}
}
@@ -0,0 +1,62 @@
FILE: jumps.kt
public final fun test_1(x: R|kotlin/Int?|): R|kotlin/Unit| {
lval y: R|kotlin/Int| = when () {
==(R|<local>/x|, Null(null)) -> {
throw R|java/lang/Exception.Exception|()
}
else -> {
R|<local>/x|
}
}
R|<local>/y|.R|kotlin/Int.inc|()
R|<local>/x|.R|kotlin/Int.inc|()
}
public final fun test_2(x: R|kotlin/Int?|): R|kotlin/Unit| {
lval y: R|kotlin/Int?| = when () {
==(R|<local>/x|, Null(null)) -> {
R|<local>/x|
}
else -> {
R|<local>/x|
}
}
R|<local>/y|.<Inapplicable(WRONG_RECEIVER): [kotlin/Int.inc]>#()
}
public final fun test_3(x: R|kotlin/Int?|): R|kotlin/Unit| {
while(Boolean(true)) {
(R|<local>/x| as R|kotlin/Int|)
break@@@[Boolean(true)]
}
R|<local>/x|.R|kotlin/Int.inc|()
}
public final fun test_4(x: R|kotlin/Int?|): R|kotlin/Unit| {
do {
(R|<local>/x| as R|kotlin/Int|)
break@@@[Boolean(true)]
}
while(Boolean(true))
R|<local>/x|.R|kotlin/Int.inc|()
}
public final fun test_5(b: R|kotlin/Boolean|): R|kotlin/Unit| {
while(R|<local>/b|) {
when () {
R|<local>/b| -> {
continue@@@[R|<local>/b|]
}
}
}
}
public final inline fun run(block: R|() -> kotlin/Unit|): R|kotlin/Unit| {
R|<local>/block|.R|FakeOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()
}
public final fun test_6(): R|kotlin/Unit| {
R|/run|(<L> = run@fun <anonymous>(): R|kotlin/Unit| <kind=UNKNOWN> {
^@run Unit
}
)
}
@@ -0,0 +1,79 @@
digraph lambdaAsReturnOfLambda_kt {
graph [nodesep=3]
node [shape=box penwidth=2]
edge [penwidth=2]
subgraph cluster_0 {
color=red
0 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
1 [label="Jump: ^@run lambda@fun <anonymous>(foo: R|kotlin/String|): R|kotlin/Unit| {
R|/bar|(R|<local>/foo|)
}
"];
2 [label="Stub" style="filled" fillcolor=gray];
3 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
}
0 -> {1};
1 -> {3};
1 -> {2} [style=dotted];
2 -> {3} [style=dotted];
subgraph cluster_1 {
color=red
4 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
5 [label="Access variable R|<local>/foo|"];
6 [label="Function call: R|/bar|(...)"];
7 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
}
4 -> {5};
5 -> {6};
6 -> {7};
subgraph cluster_2 {
color=red
8 [label="Enter function getter" style="filled" fillcolor=red];
9 [label="Exit function getter" style="filled" fillcolor=red];
}
8 -> {9};
subgraph cluster_3 {
color=red
10 [label="Enter property" style="filled" fillcolor=red];
11 [label="Postponed enter to lambda"];
12 [label="Postponed exit from lambda"];
13 [label="Function call: R|/run|<R|(kotlin/String) -> kotlin/Unit|>(...)"];
14 [label="Exit property" style="filled" fillcolor=red];
}
10 -> {11};
11 -> {12 12} [color=green];
12 -> {13};
13 -> {14};
subgraph cluster_4 {
color=red
15 [label="Enter function bar" style="filled" fillcolor=red];
16 [label="Exit function bar" style="filled" fillcolor=red];
}
15 -> {16};
subgraph cluster_5 {
color=red
17 [label="Enter function run" style="filled" fillcolor=red];
18 [label="Function call: R|<local>/block|.R|FakeOverride<kotlin/Function0.invoke: R|R|>|()"];
19 [label="Jump: ^run R|<local>/block|.R|FakeOverride<kotlin/Function0.invoke: R|R|>|()"];
20 [label="Stub" style="filled" fillcolor=gray];
21 [label="Exit function run" style="filled" fillcolor=red];
}
17 -> {18};
18 -> {19};
19 -> {21};
19 -> {20} [style=dotted];
20 -> {21} [style=dotted];
}
@@ -0,0 +1,10 @@
// !DUMP_CFG
val x4: (String) -> Unit = run {
return@run (lambda@{ foo: String ->
bar(foo)
})
}
fun bar(s: String) {}
fun <R> run(block: () -> R): R = block()
@@ -0,0 +1,14 @@
FILE: lambdaAsReturnOfLambda.kt
public final val x4: R|(kotlin/String) -> kotlin/Unit| = R|/run|<R|(kotlin/String) -> kotlin/Unit|>(<L> = run@fun <anonymous>(): R|(kotlin/String) -> kotlin/Unit| {
^@run lambda@fun <anonymous>(foo: R|kotlin/String|): R|kotlin/Unit| {
R|/bar|(R|<local>/foo|)
}
}
)
public get(): R|(kotlin/String) -> kotlin/Unit|
public final fun bar(s: R|kotlin/String|): R|kotlin/Unit| {
}
public final fun <R> run(block: R|() -> R|): R|R| {
^run R|<local>/block|.R|FakeOverride<kotlin/Function0.invoke: R|R|>|()
}
@@ -0,0 +1,67 @@
digraph lambdaReturningObject_kt {
graph [nodesep=3]
node [shape=box penwidth=2]
edge [penwidth=2]
subgraph cluster_0 {
color=red
0 [label="Enter function bar" style="filled" fillcolor=red];
1 [label="Exit function bar" style="filled" fillcolor=red];
}
0 -> {1};
subgraph cluster_1 {
color=red
2 [label="Enter function <init>" style="filled" fillcolor=red];
3 [label="Delegated constructor call: super<R|kotlin/Any|>()"];
4 [label="Exit function <init>" style="filled" fillcolor=red];
}
2 -> {3};
3 -> {4};
subgraph cluster_2 {
color=red
5 [label="Enter function MyOut" style="filled" fillcolor=red];
6 [label="Function call: R|kotlin/TODO|()"];
7 [label="Stub" style="filled" fillcolor=gray];
8 [label="Jump: ^MyOut R|kotlin/TODO|()" style="filled" fillcolor=gray];
9 [label="Stub" style="filled" fillcolor=gray];
10 [label="Exit function MyOut" style="filled" fillcolor=red];
}
5 -> {6};
6 -> {10};
6 -> {7} [style=dotted];
7 -> {8} [style=dotted];
8 -> {10 9} [style=dotted];
9 -> {10} [style=dotted];
subgraph cluster_3 {
color=red
11 [label="Enter function foo" style="filled" fillcolor=red];
12 [label="Postponed enter to lambda"];
13 [label="Postponed exit from lambda"];
14 [label="Function call: R|/MyOut|<R|IrStarProjectionImpl|>(...)"];
15 [label="Function call: R|/bar|(...)"];
16 [label="Exit function foo" style="filled" fillcolor=red];
}
11 -> {12};
12 -> {13 13} [color=green];
13 -> {14};
14 -> {15};
15 -> {16};
subgraph cluster_4 {
color=red
17 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
18 [label="Access qualifier /IrStarProjectionImpl"];
19 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
}
17 -> {18};
18 -> {19};
}
@@ -0,0 +1,14 @@
// !DUMP_CFG
interface Out<out E>
fun bar(arguments: Out<IrTypeArgument>) {}
interface IrTypeArgument
object IrStarProjectionImpl : IrTypeArgument
fun <T> MyOut(init: () -> T): Out<T> = TODO()
fun foo() {
bar(MyOut { IrStarProjectionImpl })
}
@@ -0,0 +1,22 @@
FILE: lambdaReturningObject.kt
public abstract interface Out<out E> : R|kotlin/Any| {
}
public final fun bar(arguments: R|Out<IrTypeArgument>|): R|kotlin/Unit| {
}
public abstract interface IrTypeArgument : R|kotlin/Any| {
}
public final object IrStarProjectionImpl : R|IrTypeArgument| {
private constructor(): R|IrStarProjectionImpl| {
super<R|kotlin/Any|>()
}
}
public final fun <T> MyOut(init: R|() -> T|): R|Out<T>| {
^MyOut R|kotlin/TODO|()
}
public final fun foo(): R|kotlin/Unit| {
R|/bar|(R|/MyOut|<R|IrStarProjectionImpl|>(<L> = MyOut@fun <anonymous>(): R|IrStarProjectionImpl| {
^ Q|IrStarProjectionImpl|
}
))
}
@@ -0,0 +1,220 @@
digraph lambdas_kt {
graph [nodesep=3]
node [shape=box penwidth=2]
edge [penwidth=2]
subgraph cluster_0 {
color=red
0 [label="Enter function run" style="filled" fillcolor=red];
1 [label="Function call: R|<local>/block|.R|FakeOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()"];
2 [label="Exit function run" style="filled" fillcolor=red];
}
0 -> {1};
1 -> {2};
subgraph cluster_1 {
color=red
3 [label="Enter function test_1" style="filled" fillcolor=red];
subgraph cluster_2 {
color=blue
4 [label="Enter when"];
subgraph cluster_3 {
color=blue
5 [label="Enter when branch condition "];
6 [label="Access variable R|<local>/x|"];
7 [label="Type operator: (R|<local>/x| is R|kotlin/Int|)"];
8 [label="Exit when branch condition"];
}
9 [label="Synthetic else branch"];
10 [label="Enter when branch result"];
subgraph cluster_4 {
color=blue
11 [label="Enter block"];
12 [label="Postponed enter to lambda"];
subgraph cluster_5 {
color=blue
13 [label="Enter function anonymousFunction"];
14 [label="Access variable R|<local>/x|"];
15 [label="Function call: R|<local>/x|.R|kotlin/Int.inc|()"];
16 [label="Exit function anonymousFunction"];
}
17 [label="Postponed exit from lambda"];
18 [label="Function call: R|/run|(...)"];
19 [label="Exit block"];
}
20 [label="Exit when branch result"];
21 [label="Exit when"];
}
22 [label="Exit function test_1" style="filled" fillcolor=red];
}
3 -> {4};
4 -> {5};
5 -> {6};
6 -> {7};
7 -> {8};
8 -> {10 9};
9 -> {21};
10 -> {11};
11 -> {12};
12 -> {13};
12 -> {17} [color=red];
13 -> {16 14};
14 -> {15};
15 -> {16};
16 -> {13};
16 -> {17} [color=green];
17 -> {18};
18 -> {19};
19 -> {20};
20 -> {21};
21 -> {22};
subgraph cluster_6 {
color=red
23 [label="Enter function test_2" style="filled" fillcolor=red];
subgraph cluster_7 {
color=blue
24 [label="Enter when"];
subgraph cluster_8 {
color=blue
25 [label="Enter when branch condition "];
26 [label="Access variable R|<local>/x|"];
27 [label="Type operator: (R|<local>/x| is R|kotlin/Int|)"];
28 [label="Exit when branch condition"];
}
29 [label="Synthetic else branch"];
30 [label="Enter when branch result"];
subgraph cluster_9 {
color=blue
31 [label="Enter block"];
32 [label="Variable declaration: lval lambda: R|() -> kotlin/Int|"];
33 [label="Exit block"];
}
34 [label="Exit when branch result"];
35 [label="Exit when"];
}
36 [label="Exit function test_2" style="filled" fillcolor=red];
}
23 -> {24};
24 -> {25};
25 -> {26};
26 -> {27};
27 -> {28};
28 -> {30 29};
29 -> {35};
30 -> {31};
31 -> {32};
32 -> {33};
33 -> {34};
34 -> {35};
35 -> {36};
subgraph cluster_10 {
color=red
37 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
38 [label="Access variable R|<local>/x|"];
39 [label="Function call: R|<local>/x|.R|kotlin/Int.inc|()"];
40 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
}
37 -> {38};
38 -> {39};
39 -> {40};
subgraph cluster_11 {
color=red
41 [label="Enter function getInt" style="filled" fillcolor=red];
42 [label="Function call: R|<local>/block|.R|FakeOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()"];
43 [label="Const: Int(1)"];
44 [label="Jump: ^getInt Int(1)"];
45 [label="Stub" style="filled" fillcolor=gray];
46 [label="Exit function getInt" style="filled" fillcolor=red];
}
41 -> {42};
42 -> {43};
43 -> {44};
44 -> {46};
44 -> {45} [style=dotted];
45 -> {46} [style=dotted];
subgraph cluster_12 {
color=red
47 [label="Enter function test_3" style="filled" fillcolor=red];
48 [label="Postponed enter to lambda"];
subgraph cluster_13 {
color=blue
49 [label="Enter function anonymousFunction"];
50 [label="Const: Int(1)"];
51 [label="Jump: ^test_3 Int(1)"];
52 [label="Stub" style="filled" fillcolor=gray];
53 [label="Exit function anonymousFunction"];
}
54 [label="Postponed exit from lambda"];
55 [label="Function call: R|/getInt|(...)"];
56 [label="Jump: ^test_3 R|/getInt|(<L> = getInt@fun <anonymous>(): R|kotlin/Unit| <kind=UNKNOWN> {
^test_3 Int(1)
}
)"];
57 [label="Stub" style="filled" fillcolor=gray];
58 [label="Exit function test_3" style="filled" fillcolor=red];
}
47 -> {48};
48 -> {49};
48 -> {54} [color=red];
49 -> {53 50};
50 -> {51};
51 -> {58};
51 -> {52} [style=dotted];
52 -> {53} [style=dotted];
53 -> {49};
53 -> {54} [color=green];
54 -> {55};
55 -> {56};
56 -> {58};
56 -> {57} [style=dotted];
57 -> {58} [style=dotted];
subgraph cluster_14 {
color=red
59 [label="Enter function test_4" style="filled" fillcolor=red];
60 [label="Postponed enter to lambda"];
subgraph cluster_15 {
color=blue
61 [label="Enter function anonymousFunction"];
62 [label="Const: Int(1)"];
63 [label="Jump: ^test_4 Int(1)"];
64 [label="Stub" style="filled" fillcolor=gray];
65 [label="Exit function anonymousFunction"];
}
66 [label="Postponed exit from lambda"];
67 [label="Function call: R|/getInt|(...)"];
68 [label="Jump: ^test_4 R|/getInt|(block = getInt@fun <anonymous>(): R|kotlin/Unit| <kind=UNKNOWN> {
^test_4 Int(1)
}
)"];
69 [label="Stub" style="filled" fillcolor=gray];
70 [label="Exit function test_4" style="filled" fillcolor=red];
}
59 -> {60};
60 -> {61};
60 -> {66} [color=red];
61 -> {65 62};
62 -> {63};
63 -> {70};
63 -> {64} [style=dotted];
64 -> {65} [style=dotted];
65 -> {61};
65 -> {66} [color=green];
66 -> {67};
67 -> {68};
68 -> {70};
68 -> {69} [style=dotted];
69 -> {70} [style=dotted];
}
@@ -0,0 +1,31 @@
// !DUMP_CFG
inline fun run(block: () -> Unit) {
block()
}
fun test_1(x: Any?) {
if (x is Int) {
run {
x.inc()
}
}
}
fun test_2(x: Any?) {
if (x is Int) {
val lambda = {
x.inc()
}
}
}
inline fun getInt(block: () -> Unit): Int {
block()
return 1
}
fun test_3(): Int = getInt { return@test_3 1 }
fun test_4(): Int = getInt(block = { return@test_4 1 })
@@ -0,0 +1,42 @@
FILE: lambdas.kt
public final inline fun run(block: R|() -> kotlin/Unit|): R|kotlin/Unit| {
R|<local>/block|.R|FakeOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()
}
public final fun test_1(x: R|kotlin/Any?|): R|kotlin/Unit| {
when () {
(R|<local>/x| is R|kotlin/Int|) -> {
R|/run|(<L> = run@fun <anonymous>(): R|kotlin/Unit| <kind=UNKNOWN> {
^ R|<local>/x|.R|kotlin/Int.inc|()
}
)
}
}
}
public final fun test_2(x: R|kotlin/Any?|): R|kotlin/Unit| {
when () {
(R|<local>/x| is R|kotlin/Int|) -> {
lval lambda: R|() -> kotlin/Int| = fun <anonymous>(): R|kotlin/Int| {
^ R|<local>/x|.R|kotlin/Int.inc|()
}
}
}
}
public final inline fun getInt(block: R|() -> kotlin/Unit|): R|kotlin/Int| {
R|<local>/block|.R|FakeOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()
^getInt Int(1)
}
public final fun test_3(): R|kotlin/Int| {
^test_3 R|/getInt|(<L> = getInt@fun <anonymous>(): R|kotlin/Unit| <kind=UNKNOWN> {
^test_3 Int(1)
}
)
}
public final fun test_4(): R|kotlin/Int| {
^test_4 R|/getInt|(block = getInt@fun <anonymous>(): R|kotlin/Unit| <kind=UNKNOWN> {
^test_4 Int(1)
}
)
}
@@ -0,0 +1,490 @@
digraph loops_kt {
graph [nodesep=3]
node [shape=box penwidth=2]
edge [penwidth=2]
subgraph cluster_0 {
color=red
0 [label="Enter function testWhile" style="filled" fillcolor=red];
subgraph cluster_1 {
color=blue
1 [label="Enter while loop"];
subgraph cluster_2 {
color=blue
2 [label="Enter loop condition"];
3 [label="Access variable R|<local>/b|"];
4 [label="Exit loop condition"];
}
subgraph cluster_3 {
color=blue
5 [label="Enter loop block"];
subgraph cluster_4 {
color=blue
6 [label="Enter block"];
7 [label="Access variable R|<local>/x|"];
8 [label="Type operator: (R|<local>/x| is R|kotlin/String|)"];
9 [label="Variable declaration: lval y: R|kotlin/Boolean|"];
10 [label="Exit block"];
}
11 [label="Exit loop block"];
}
12 [label="Exit whileloop"];
}
13 [label="Access variable R|<local>/x|"];
14 [label="Type operator: (R|<local>/x| is R|kotlin/String|)"];
15 [label="Exit function testWhile" style="filled" fillcolor=red];
}
0 -> {1};
1 -> {2};
2 -> {3};
3 -> {4};
4 -> {12 5};
5 -> {6};
6 -> {7};
7 -> {8};
8 -> {9};
9 -> {10};
10 -> {11};
11 -> {2};
12 -> {13};
13 -> {14};
14 -> {15};
subgraph cluster_5 {
color=red
16 [label="Enter function testDoWhile" style="filled" fillcolor=red];
subgraph cluster_6 {
color=blue
17 [label="Enter do-while loop"];
subgraph cluster_7 {
color=blue
18 [label="Enter loop block"];
subgraph cluster_8 {
color=blue
19 [label="Enter block"];
20 [label="Access variable R|<local>/x|"];
21 [label="Type operator: (R|<local>/x| is R|kotlin/String|)"];
22 [label="Variable declaration: lval y: R|kotlin/Boolean|"];
23 [label="Exit block"];
}
24 [label="Exit loop block"];
}
subgraph cluster_9 {
color=blue
25 [label="Enter loop condition"];
26 [label="Access variable R|<local>/b|"];
27 [label="Exit loop condition"];
}
28 [label="Exit do-whileloop"];
}
29 [label="Access variable R|<local>/x|"];
30 [label="Type operator: (R|<local>/x| is R|kotlin/String|)"];
31 [label="Exit function testDoWhile" style="filled" fillcolor=red];
}
16 -> {17};
17 -> {18};
18 -> {19};
19 -> {20};
20 -> {21};
21 -> {22};
22 -> {23};
23 -> {24};
24 -> {25};
25 -> {26};
26 -> {27};
27 -> {18 28};
28 -> {29};
29 -> {30};
30 -> {31};
subgraph cluster_10 {
color=red
32 [label="Enter function testFor" style="filled" fillcolor=red];
33 [label="Const: Int(0)"];
34 [label="Const: Int(5)"];
35 [label="Function call: Int(0).R|kotlin/Int.rangeTo|(...)"];
36 [label="Function call: Int(0).R|kotlin/Int.rangeTo|(...).R|kotlin/ranges/IntProgression.iterator|()"];
37 [label="Variable declaration: lval <iterator>: R|kotlin/collections/IntIterator|"];
subgraph cluster_11 {
color=blue
38 [label="Enter while loop"];
subgraph cluster_12 {
color=blue
39 [label="Enter loop condition"];
40 [label="Access variable R|<local>/<iterator>|"];
41 [label="Function call: R|<local>/<iterator>|.R|kotlin/collections/Iterator.hasNext|()"];
42 [label="Exit loop condition"];
}
subgraph cluster_13 {
color=blue
43 [label="Enter loop block"];
subgraph cluster_14 {
color=blue
44 [label="Enter block"];
45 [label="Access variable R|<local>/<iterator>|"];
46 [label="Function call: R|<local>/<iterator>|.R|kotlin/collections/IntIterator.next|()"];
47 [label="Variable declaration: lval i: R|kotlin/Int|"];
48 [label="Access variable R|<local>/x|"];
49 [label="Type operator: (R|<local>/x| is R|kotlin/String|)"];
50 [label="Variable declaration: lval y: R|kotlin/Boolean|"];
51 [label="Exit block"];
}
52 [label="Exit loop block"];
}
53 [label="Exit whileloop"];
}
54 [label="Access variable R|<local>/x|"];
55 [label="Type operator: (R|<local>/x| is R|kotlin/String|)"];
56 [label="Exit function testFor" style="filled" fillcolor=red];
}
32 -> {33};
33 -> {34};
34 -> {35};
35 -> {36};
36 -> {37};
37 -> {38};
38 -> {39};
39 -> {40};
40 -> {41};
41 -> {42};
42 -> {53 43};
43 -> {44};
44 -> {45};
45 -> {46};
46 -> {47};
47 -> {48};
48 -> {49};
49 -> {50};
50 -> {51};
51 -> {52};
52 -> {39};
53 -> {54};
54 -> {55};
55 -> {56};
subgraph cluster_15 {
color=red
57 [label="Enter function testWhileTrue" style="filled" fillcolor=red];
subgraph cluster_16 {
color=blue
58 [label="Enter while loop"];
subgraph cluster_17 {
color=blue
59 [label="Enter loop condition"];
60 [label="Const: Boolean(true)"];
61 [label="Exit loop condition"];
}
subgraph cluster_18 {
color=blue
62 [label="Enter loop block"];
subgraph cluster_19 {
color=blue
63 [label="Enter block"];
64 [label="Const: Int(1)"];
65 [label="Exit block"];
}
66 [label="Exit loop block"];
}
67 [label="Exit whileloop" style="filled" fillcolor=gray];
}
68 [label="Const: Int(1)" style="filled" fillcolor=gray];
69 [label="Exit function testWhileTrue" style="filled" fillcolor=red style="filled" fillcolor=gray];
}
57 -> {58};
58 -> {59};
59 -> {60};
60 -> {61};
61 -> {62};
61 -> {67} [style=dotted];
62 -> {63};
63 -> {64};
64 -> {65};
65 -> {66};
66 -> {59};
67 -> {68} [style=dotted];
68 -> {69} [style=dotted];
subgraph cluster_20 {
color=red
70 [label="Enter function testWhileTrueWithBreak" style="filled" fillcolor=red];
subgraph cluster_21 {
color=blue
71 [label="Enter while loop"];
subgraph cluster_22 {
color=blue
72 [label="Enter loop condition"];
73 [label="Const: Boolean(true)"];
74 [label="Exit loop condition"];
}
subgraph cluster_23 {
color=blue
75 [label="Enter loop block"];
subgraph cluster_24 {
color=blue
76 [label="Enter block"];
subgraph cluster_25 {
color=blue
77 [label="Enter when"];
subgraph cluster_26 {
color=blue
78 [label="Enter when branch condition "];
79 [label="Access variable R|<local>/b|"];
80 [label="Exit when branch condition"];
}
81 [label="Synthetic else branch"];
82 [label="Enter when branch result"];
subgraph cluster_27 {
color=blue
83 [label="Enter block"];
84 [label="Jump: break@@@[Boolean(true)] "];
85 [label="Stub" style="filled" fillcolor=gray];
86 [label="Exit block" style="filled" fillcolor=gray];
}
87 [label="Exit when branch result" style="filled" fillcolor=gray];
88 [label="Exit when"];
}
89 [label="Exit block"];
}
90 [label="Exit loop block"];
}
91 [label="Exit whileloop"];
}
92 [label="Const: Int(1)"];
93 [label="Exit function testWhileTrueWithBreak" style="filled" fillcolor=red];
}
70 -> {71};
71 -> {72};
72 -> {73};
73 -> {74};
74 -> {75};
74 -> {91} [style=dotted];
75 -> {76};
76 -> {77};
77 -> {78};
78 -> {79};
79 -> {80};
80 -> {82 81};
81 -> {88};
82 -> {83};
83 -> {84};
84 -> {91};
84 -> {85} [style=dotted];
85 -> {86} [style=dotted];
86 -> {87} [style=dotted];
87 -> {88} [style=dotted];
88 -> {89};
89 -> {90};
90 -> {72};
91 -> {92};
92 -> {93};
subgraph cluster_28 {
color=red
94 [label="Enter function testWhileFalse" style="filled" fillcolor=red];
subgraph cluster_29 {
color=blue
95 [label="Enter while loop"];
subgraph cluster_30 {
color=blue
96 [label="Enter loop condition"];
97 [label="Const: Boolean(false)"];
98 [label="Exit loop condition"];
}
subgraph cluster_31 {
color=blue
99 [label="Enter loop block" style="filled" fillcolor=gray];
subgraph cluster_32 {
color=blue
100 [label="Enter block" style="filled" fillcolor=gray];
101 [label="Const: Int(1)" style="filled" fillcolor=gray];
102 [label="Exit block" style="filled" fillcolor=gray];
}
103 [label="Exit loop block" style="filled" fillcolor=gray];
}
104 [label="Exit whileloop"];
}
105 [label="Const: Int(1)"];
106 [label="Exit function testWhileFalse" style="filled" fillcolor=red];
}
94 -> {95};
95 -> {96};
96 -> {97};
97 -> {98};
98 -> {104};
98 -> {99} [style=dotted];
99 -> {100} [style=dotted];
100 -> {101} [style=dotted];
101 -> {102} [style=dotted];
102 -> {103} [style=dotted];
103 -> {96} [style=dotted];
104 -> {105};
105 -> {106};
subgraph cluster_33 {
color=red
107 [label="Enter function testDoWhileTrue" style="filled" fillcolor=red];
subgraph cluster_34 {
color=blue
108 [label="Enter do-while loop"];
subgraph cluster_35 {
color=blue
109 [label="Enter loop block"];
subgraph cluster_36 {
color=blue
110 [label="Enter block"];
111 [label="Const: Int(1)"];
112 [label="Exit block"];
}
113 [label="Exit loop block"];
}
subgraph cluster_37 {
color=blue
114 [label="Enter loop condition"];
115 [label="Const: Boolean(true)"];
116 [label="Exit loop condition"];
}
117 [label="Exit do-whileloop" style="filled" fillcolor=gray];
}
118 [label="Const: Int(1)" style="filled" fillcolor=gray];
119 [label="Exit function testDoWhileTrue" style="filled" fillcolor=red style="filled" fillcolor=gray];
}
107 -> {108};
108 -> {109};
109 -> {110};
110 -> {111};
111 -> {112};
112 -> {113};
113 -> {114};
114 -> {115};
115 -> {116};
116 -> {109};
116 -> {117} [style=dotted];
117 -> {118} [style=dotted];
118 -> {119} [style=dotted];
subgraph cluster_38 {
color=red
120 [label="Enter function testDoWhileTrueWithBreak" style="filled" fillcolor=red];
subgraph cluster_39 {
color=blue
121 [label="Enter do-while loop"];
subgraph cluster_40 {
color=blue
122 [label="Enter loop block"];
subgraph cluster_41 {
color=blue
123 [label="Enter block"];
subgraph cluster_42 {
color=blue
124 [label="Enter when"];
subgraph cluster_43 {
color=blue
125 [label="Enter when branch condition "];
126 [label="Access variable R|<local>/b|"];
127 [label="Exit when branch condition"];
}
128 [label="Synthetic else branch"];
129 [label="Enter when branch result"];
subgraph cluster_44 {
color=blue
130 [label="Enter block"];
131 [label="Jump: break@@@[Boolean(true)] "];
132 [label="Stub" style="filled" fillcolor=gray];
133 [label="Exit block" style="filled" fillcolor=gray];
}
134 [label="Exit when branch result" style="filled" fillcolor=gray];
135 [label="Exit when"];
}
136 [label="Exit block"];
}
137 [label="Exit loop block"];
}
subgraph cluster_45 {
color=blue
138 [label="Enter loop condition"];
139 [label="Const: Boolean(true)"];
140 [label="Exit loop condition"];
}
141 [label="Exit do-whileloop"];
}
142 [label="Const: Int(1)"];
143 [label="Exit function testDoWhileTrueWithBreak" style="filled" fillcolor=red];
}
120 -> {121};
121 -> {122};
122 -> {123};
123 -> {124};
124 -> {125};
125 -> {126};
126 -> {127};
127 -> {129 128};
128 -> {135};
129 -> {130};
130 -> {131};
131 -> {141};
131 -> {132} [style=dotted];
132 -> {133} [style=dotted];
133 -> {134} [style=dotted];
134 -> {135} [style=dotted];
135 -> {136};
136 -> {137};
137 -> {138};
138 -> {139};
139 -> {140};
140 -> {122};
140 -> {141} [style=dotted];
141 -> {142};
142 -> {143};
subgraph cluster_46 {
color=red
144 [label="Enter function testDoWhileFalse" style="filled" fillcolor=red];
subgraph cluster_47 {
color=blue
145 [label="Enter do-while loop"];
subgraph cluster_48 {
color=blue
146 [label="Enter loop block"];
subgraph cluster_49 {
color=blue
147 [label="Enter block"];
148 [label="Const: Int(1)"];
149 [label="Exit block"];
}
150 [label="Exit loop block"];
}
subgraph cluster_50 {
color=blue
151 [label="Enter loop condition"];
152 [label="Const: Boolean(false)"];
153 [label="Exit loop condition"];
}
154 [label="Exit do-whileloop"];
}
155 [label="Const: Int(1)"];
156 [label="Exit function testDoWhileFalse" style="filled" fillcolor=red];
}
144 -> {145};
145 -> {146};
146 -> {147};
147 -> {148};
148 -> {149};
149 -> {150};
150 -> {151};
151 -> {152};
152 -> {153};
153 -> {154};
153 -> {146} [style=dotted];
154 -> {155};
155 -> {156};
}
@@ -0,0 +1,68 @@
// !DUMP_CFG
fun testWhile(b: Boolean, x: Any?) {
while (b) {
val y = x is String
}
x is String
}
fun testDoWhile(b: Boolean, x: Any?) {
do {
val y = x is String
} while (b)
x is String
}
fun testFor(x: Any?) {
for (i in 0..5) {
val y = x is String
}
x is String
}
fun testWhileTrue() {
while (true) {
1
}
1
}
fun testWhileTrueWithBreak(b: Boolean) {
while (true) {
if (b) {
break
}
}
1
}
fun testWhileFalse() {
while (false) {
1
}
1
}
fun testDoWhileTrue() {
do {
1
} while (true)
1
}
fun testDoWhileTrueWithBreak(b: Boolean) {
do {
if (b) {
break
}
} while (true)
1
}
fun testDoWhileFalse() {
do {
1
} while (false)
1
}
@@ -0,0 +1,76 @@
FILE: loops.kt
public final fun testWhile(b: R|kotlin/Boolean|, x: R|kotlin/Any?|): R|kotlin/Unit| {
while(R|<local>/b|) {
lval y: R|kotlin/Boolean| = (R|<local>/x| is R|kotlin/String|)
}
(R|<local>/x| is R|kotlin/String|)
}
public final fun testDoWhile(b: R|kotlin/Boolean|, x: R|kotlin/Any?|): R|kotlin/Unit| {
do {
lval y: R|kotlin/Boolean| = (R|<local>/x| is R|kotlin/String|)
}
while(R|<local>/b|)
(R|<local>/x| is R|kotlin/String|)
}
public final fun testFor(x: R|kotlin/Any?|): R|kotlin/Unit| {
lval <iterator>: R|kotlin/collections/IntIterator| = Int(0).R|kotlin/Int.rangeTo|(Int(5)).R|kotlin/ranges/IntProgression.iterator|()
while(R|<local>/<iterator>|.R|kotlin/collections/Iterator.hasNext|()) {
lval i: R|kotlin/Int| = R|<local>/<iterator>|.R|kotlin/collections/IntIterator.next|()
lval y: R|kotlin/Boolean| = (R|<local>/x| is R|kotlin/String|)
}
(R|<local>/x| is R|kotlin/String|)
}
public final fun testWhileTrue(): R|kotlin/Unit| {
while(Boolean(true)) {
Int(1)
}
Int(1)
}
public final fun testWhileTrueWithBreak(b: R|kotlin/Boolean|): R|kotlin/Unit| {
while(Boolean(true)) {
when () {
R|<local>/b| -> {
break@@@[Boolean(true)]
}
}
}
Int(1)
}
public final fun testWhileFalse(): R|kotlin/Unit| {
while(Boolean(false)) {
Int(1)
}
Int(1)
}
public final fun testDoWhileTrue(): R|kotlin/Unit| {
do {
Int(1)
}
while(Boolean(true))
Int(1)
}
public final fun testDoWhileTrueWithBreak(b: R|kotlin/Boolean|): R|kotlin/Unit| {
do {
when () {
R|<local>/b| -> {
break@@@[Boolean(true)]
}
}
}
while(Boolean(true))
Int(1)
}
public final fun testDoWhileFalse(): R|kotlin/Unit| {
do {
Int(1)
}
while(Boolean(false))
Int(1)
}
@@ -0,0 +1,87 @@
digraph postponedLambdaInConstructor_kt {
graph [nodesep=3]
node [shape=box penwidth=2]
edge [penwidth=2]
subgraph cluster_0 {
color=red
0 [label="Enter function <init>" style="filled" fillcolor=red];
1 [label="Delegated constructor call: super<R|kotlin/Any|>()"];
2 [label="Exit function <init>" style="filled" fillcolor=red];
}
0 -> {1};
1 -> {2};
subgraph cluster_1 {
color=red
3 [label="Enter function <init>" style="filled" fillcolor=red];
4 [label="Access variable R|<local>/s|"];
5 [label="Postponed enter to lambda"];
subgraph cluster_2 {
color=blue
6 [label="Enter function anonymousFunction"];
7 [label="Postponed enter to lambda"];
8 [label="Postponed exit from lambda"];
9 [label="Exit function anonymousFunction"];
}
10 [label="Postponed exit from lambda"];
11 [label="Function call: R|<local>/s|.R|kotlin/let|<R|kotlin/String|, R|() -> kotlin/String|>(...)"];
12 [label="Call arguments union" style="filled" fillcolor=yellow];
13 [label="Delegated constructor call: super<R|A|>(...)"];
14 [label="Exit function <init>" style="filled" fillcolor=red];
}
3 -> {4};
4 -> {5};
5 -> {6};
5 -> {10} [color=red];
6 -> {7};
7 -> {8 8} [color=green];
8 -> {9};
9 -> {10} [color=green];
9 -> {12} [color=red];
10 -> {11};
11 -> {12};
12 -> {13};
13 -> {14};
subgraph cluster_3 {
color=red
15 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
16 [label="Access variable R|<local>/it|"];
17 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
}
15 -> {16};
16 -> {17};
subgraph cluster_4 {
color=red
18 [label="Enter function getter" style="filled" fillcolor=red];
19 [label="Exit function getter" style="filled" fillcolor=red];
}
18 -> {19};
subgraph cluster_5 {
color=red
20 [label="Enter property" style="filled" fillcolor=red];
21 [label="Access variable R|<local>/s|"];
22 [label="Exit property" style="filled" fillcolor=red];
}
20 -> {21};
21 -> {22};
subgraph cluster_6 {
color=red
23 [label="Enter function foo" style="filled" fillcolor=red];
24 [label="Function call: this@R|/B|.R|/B.foo|()"];
25 [label="Exit function foo" style="filled" fillcolor=red];
}
23 -> {24};
24 -> {25};
}
@@ -0,0 +1,9 @@
// !DUMP_CFG
abstract class A(func: () -> String)
class B(val s: String) : A(s.let { { it } }) {
fun foo() {
foo()
}
}
@@ -0,0 +1,26 @@
FILE: postponedLambdaInConstructor.kt
public abstract class A : R|kotlin/Any| {
public constructor(func: R|() -> kotlin/String|): R|A| {
super<R|kotlin/Any|>()
}
}
public final class B : R|A| {
public constructor(s: R|kotlin/String|): R|B| {
super<R|A|>(R|<local>/s|.R|kotlin/let|<R|kotlin/String|, R|() -> kotlin/String|>(<L> = let@fun <anonymous>(it: R|kotlin/String|): R|() -> kotlin/String| <kind=EXACTLY_ONCE> {
^ let@fun <anonymous>(): R|kotlin/String| {
^ R|<local>/it|
}
}
))
}
public final val s: R|kotlin/String| = R|<local>/s|
public get(): R|kotlin/String|
public final fun foo(): R|kotlin/Unit| {
this@R|/B|.R|/B.foo|()
}
}
@@ -0,0 +1,43 @@
digraph postponedLambdas_kt {
graph [nodesep=3]
node [shape=box penwidth=2]
edge [penwidth=2]
subgraph cluster_0 {
color=red
0 [label="Enter function foo" style="filled" fillcolor=red];
1 [label="Exit function foo" style="filled" fillcolor=red];
}
0 -> {1};
subgraph cluster_1 {
color=red
2 [label="Enter function test" style="filled" fillcolor=red];
3 [label="Access variable R|<local>/a|"];
4 [label="Postponed enter to lambda"];
subgraph cluster_2 {
color=blue
5 [label="Enter function anonymousFunction"];
6 [label="Const: String()"];
7 [label="Exit function anonymousFunction"];
}
8 [label="Postponed exit from lambda"];
9 [label="Access variable R|<local>/b|"];
10 [label="Function call: R|/foo|(...)"];
11 [label="Exit function test" style="filled" fillcolor=red];
}
2 -> {3};
3 -> {4};
4 -> {5};
4 -> {8} [color=red];
5 -> {7 6};
6 -> {7};
7 -> {5};
7 -> {8} [color=green];
8 -> {9};
9 -> {10};
10 -> {11};
}
@@ -0,0 +1,6 @@
// !DUMP_CFG
inline fun foo(vararg x: Any) {}
fun test(a: Any, b: Any, c: Any) {
foo(a, { "" }, b)
}
@@ -0,0 +1,9 @@
FILE: postponedLambdas.kt
public final inline fun foo(vararg x: R|kotlin/Array<out kotlin/Any>|): R|kotlin/Unit| {
}
public final fun test(a: R|kotlin/Any|, b: R|kotlin/Any|, c: R|kotlin/Any|): R|kotlin/Unit| {
R|/foo|(vararg(R|<local>/a|, foo@fun <anonymous>(): R|kotlin/String| <kind=UNKNOWN> {
^ String()
}
, R|<local>/b|))
}
@@ -0,0 +1,223 @@
digraph propertiesAndInitBlocks_kt {
graph [nodesep=3]
node [shape=box penwidth=2]
edge [penwidth=2]
subgraph cluster_0 {
color=red
0 [label="Enter function run" style="filled" fillcolor=red];
1 [label="Function call: R|<local>/block|.R|FakeOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()"];
2 [label="Exit function run" style="filled" fillcolor=red];
}
0 -> {1};
1 -> {2};
subgraph cluster_1 {
color=red
3 [label="Enter function getter" style="filled" fillcolor=red];
4 [label="Exit function getter" style="filled" fillcolor=red];
}
3 -> {4};
subgraph cluster_2 {
color=red
5 [label="Enter property" style="filled" fillcolor=red];
6 [label="Const: Int(1)"];
7 [label="Exit property" style="filled" fillcolor=red];
}
5 -> {6};
6 -> {7};
subgraph cluster_3 {
color=red
8 [label="Enter function getter" style="filled" fillcolor=red];
9 [label="Const: Int(1)"];
10 [label="Jump: ^ Int(1)"];
11 [label="Stub" style="filled" fillcolor=gray];
12 [label="Exit function getter" style="filled" fillcolor=red];
}
8 -> {9};
9 -> {10};
10 -> {12};
10 -> {11} [style=dotted];
11 -> {12} [style=dotted];
subgraph cluster_4 {
color=red
13 [label="Enter function setter" style="filled" fillcolor=red];
14 [label="Const: Int(1)"];
15 [label="Assignmenet: F|/x2|"];
16 [label="Exit function setter" style="filled" fillcolor=red];
}
13 -> {14};
14 -> {15};
15 -> {16};
subgraph cluster_5 {
color=red
17 [label="Enter property" style="filled" fillcolor=red];
18 [label="Const: Int(1)"];
19 [label="Exit property" style="filled" fillcolor=red];
}
17 -> {18};
18 -> {19};
subgraph cluster_6 {
color=red
20 [label="Enter function foo" style="filled" fillcolor=red];
21 [label="Const: Int(1)"];
22 [label="Const: Int(1)"];
23 [label="Function call: Int(1).R|kotlin/Int.plus|(...)"];
24 [label="Variable declaration: lval c: R|kotlin/Int|"];
25 [label="Function call: R|java/lang/Exception.Exception|()"];
26 [label="Throw: throw R|java/lang/Exception.Exception|()"];
27 [label="Stub" style="filled" fillcolor=gray];
28 [label="Exit function foo" style="filled" fillcolor=red];
}
20 -> {21};
21 -> {22};
22 -> {23};
23 -> {24};
24 -> {25};
25 -> {26};
26 -> {28};
26 -> {27} [style=dotted];
27 -> {28} [style=dotted];
subgraph cluster_7 {
color=red
29 [label="Enter function <init>" style="filled" fillcolor=red];
30 [label="Delegated constructor call: super<R|kotlin/Any|>()"];
31 [label="Exit function <init>" style="filled" fillcolor=red];
}
29 -> {30};
30 -> {31};
subgraph cluster_8 {
color=red
32 [label="Enter function getter" style="filled" fillcolor=red];
33 [label="Exit function getter" style="filled" fillcolor=red];
}
32 -> {33};
subgraph cluster_9 {
color=red
34 [label="Enter function <init>" style="filled" fillcolor=red];
35 [label="Delegated constructor call: super<R|kotlin/Any|>()"];
36 [label="Exit function <init>" style="filled" fillcolor=red];
}
34 -> {35};
35 -> {36};
subgraph cluster_10 {
color=red
37 [label="Enter property" style="filled" fillcolor=red];
38 [label="Postponed enter to lambda"];
subgraph cluster_11 {
color=blue
39 [label="Enter function anonymousFunction"];
40 [label="Function call: R|java/lang/Exception.Exception|()"];
41 [label="Throw: throw R|java/lang/Exception.Exception|()"];
42 [label="Stub" style="filled" fillcolor=gray];
43 [label="Exit function anonymousFunction"];
}
44 [label="Postponed exit from lambda"];
45 [label="Function call: R|/run|(...)"];
46 [label="Exit property" style="filled" fillcolor=red];
}
37 -> {38};
38 -> {39};
38 -> {44} [color=red];
39 -> {43 40};
40 -> {41};
41 -> {46};
41 -> {42} [style=dotted];
42 -> {43} [style=dotted];
43 -> {39};
43 -> {44} [color=green];
44 -> {45};
45 -> {46};
subgraph cluster_12 {
color=red
47 [label="Enter function getter" style="filled" fillcolor=red];
48 [label="Exit function getter" style="filled" fillcolor=red];
}
47 -> {48};
subgraph cluster_13 {
color=red
49 [label="Enter property" style="filled" fillcolor=red];
subgraph cluster_14 {
color=blue
50 [label="Try expression enter"];
subgraph cluster_15 {
color=blue
51 [label="Try main block enter"];
subgraph cluster_16 {
color=blue
52 [label="Enter block"];
53 [label="Const: Int(1)"];
54 [label="Exit block"];
}
55 [label="Try main block exit"];
}
subgraph cluster_17 {
color=blue
56 [label="Enter finally"];
subgraph cluster_18 {
color=blue
57 [label="Enter block"];
58 [label="Const: Int(0)"];
59 [label="Exit block"];
}
60 [label="Exit finally"];
}
subgraph cluster_19 {
color=blue
61 [label="Catch enter"];
subgraph cluster_20 {
color=blue
62 [label="Enter block"];
63 [label="Const: Int(2)"];
64 [label="Exit block"];
}
65 [label="Catch exit"];
}
66 [label="Try expression exit"];
}
67 [label="Exit property" style="filled" fillcolor=red];
}
49 -> {50};
50 -> {51};
51 -> {67 61 56 52};
52 -> {53};
53 -> {54};
54 -> {55};
55 -> {66};
56 -> {57};
57 -> {58};
58 -> {59};
59 -> {60};
60 -> {66};
61 -> {67 62};
62 -> {63};
63 -> {64};
64 -> {65};
65 -> {66};
66 -> {67};
}
@@ -0,0 +1,43 @@
// !DUMP_CFG
inline fun run(block: () -> Unit) {
block()
}
val x1 = 1
var x2: Int = 1
get() = 1
set(value) {
field = 1
}
val x3 = run {
fun foo() {
val c = 1 + 1
throw Exception()
}
class LocalClass {
init {
throw Exception()
1
}
}
throw Exception()
}
get() {
class LocalClass {
init {
throw Exception()
}
}
}
val x4 = try {
1
} catch (e: Exception) {
2
} finally {
0
}
@@ -0,0 +1,58 @@
FILE: propertiesAndInitBlocks.kt
public final inline fun run(block: R|() -> kotlin/Unit|): R|kotlin/Unit| {
R|<local>/block|.R|FakeOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()
}
public final val x1: R|kotlin/Int| = Int(1)
public get(): R|kotlin/Int|
public final var x2: R|kotlin/Int| = Int(1)
public get(): R|kotlin/Int| {
^ Int(1)
}
public set(value: R|kotlin/Int|): R|kotlin/Unit| {
F|/x2| = Int(1)
}
public final val x3: R|kotlin/Unit| = R|/run|(<L> = run@fun <anonymous>(): R|kotlin/Unit| <kind=UNKNOWN> {
local final fun foo(): R|kotlin/Unit| {
lval c: R|kotlin/Int| = Int(1).R|kotlin/Int.plus|(Int(1))
throw R|java/lang/Exception.Exception|()
}
local final class LocalClass : R|kotlin/Any| {
public constructor(): R|LocalClass| {
super<R|kotlin/Any|>()
}
init {
throw R|java/lang/Exception.Exception|()
Int(1)
}
}
throw R|java/lang/Exception.Exception|()
}
)
public get(): R|kotlin/Unit| {
local final class LocalClass : R|kotlin/Any| {
public constructor(): R|LocalClass| {
super<R|kotlin/Any|>()
}
init {
throw R|java/lang/Exception.Exception|()
}
}
}
public final val x4: R|kotlin/Int| = try {
Int(1)
}
catch (e: R|kotlin/Exception|) {
Int(2)
}
finally {
Int(0)
}
public get(): R|kotlin/Int|
@@ -0,0 +1,159 @@
digraph returnValuesFromLambda_kt {
graph [nodesep=3]
node [shape=box penwidth=2]
edge [penwidth=2]
subgraph cluster_0 {
color=red
0 [label="Enter function <init>" style="filled" fillcolor=red];
1 [label="Delegated constructor call: super<R|kotlin/Any|>()"];
2 [label="Exit function <init>" style="filled" fillcolor=red];
}
0 -> {1};
1 -> {2};
subgraph cluster_1 {
color=red
3 [label="Enter function <init>" style="filled" fillcolor=red];
4 [label="Delegated constructor call: super<R|kotlin/Any|>()"];
5 [label="Exit function <init>" style="filled" fillcolor=red];
}
3 -> {4};
4 -> {5};
subgraph cluster_2 {
color=red
6 [label="Enter function test_1" style="filled" fillcolor=red];
7 [label="Postponed enter to lambda"];
subgraph cluster_3 {
color=blue
8 [label="Enter function anonymousFunction"];
subgraph cluster_4 {
color=blue
9 [label="Enter when"];
subgraph cluster_5 {
color=blue
10 [label="Enter when branch condition "];
11 [label="Access variable R|<local>/b|"];
12 [label="Exit when branch condition"];
}
13 [label="Synthetic else branch"];
14 [label="Enter when branch result"];
subgraph cluster_6 {
color=blue
15 [label="Enter block"];
16 [label="Function call: R|/B.B|()"];
17 [label="Jump: ^@run R|/B.B|()"];
18 [label="Stub" style="filled" fillcolor=gray];
19 [label="Exit block" style="filled" fillcolor=gray];
}
20 [label="Exit when branch result" style="filled" fillcolor=gray];
21 [label="Exit when"];
}
22 [label="Function call: R|/C.C|()"];
23 [label="Exit function anonymousFunction"];
}
24 [label="Call arguments union" style="filled" fillcolor=yellow];
25 [label="Postponed exit from lambda"];
26 [label="Function call: R|kotlin/run|<R|A|>(...)"];
27 [label="Variable declaration: lval x: R|A|"];
28 [label="Exit function test_1" style="filled" fillcolor=red];
}
6 -> {7};
7 -> {8};
7 -> {25} [color=red];
8 -> {9};
9 -> {10};
10 -> {11};
11 -> {12};
12 -> {14 13};
13 -> {21};
14 -> {15};
15 -> {16};
16 -> {17};
17 -> {23};
17 -> {18} [style=dotted];
18 -> {19} [style=dotted];
19 -> {20} [style=dotted];
20 -> {21} [style=dotted];
21 -> {22};
22 -> {23};
23 -> {25} [color=green];
23 -> {24} [color=red];
24 -> {26} [color=red];
25 -> {26} [color=green];
26 -> {27};
27 -> {28};
subgraph cluster_7 {
color=red
29 [label="Enter function test_2" style="filled" fillcolor=red];
30 [label="Postponed enter to lambda"];
subgraph cluster_8 {
color=blue
31 [label="Enter function anonymousFunction"];
32 [label="Function call: R|/C.C|()"];
33 [label="Jump: ^@run R|/C.C|()"];
34 [label="Stub" style="filled" fillcolor=gray];
35 [label="Exit function anonymousFunction"];
}
36 [label="Call arguments union" style="filled" fillcolor=yellow];
37 [label="Postponed exit from lambda"];
38 [label="Function call: R|kotlin/run|<R|C|>(...)"];
39 [label="Variable declaration: lval x: R|C|"];
40 [label="Exit function test_2" style="filled" fillcolor=red];
}
29 -> {30};
30 -> {31};
30 -> {37} [color=red];
31 -> {32};
32 -> {33};
33 -> {35};
33 -> {34} [style=dotted];
34 -> {35} [style=dotted];
35 -> {37} [color=green];
35 -> {36} [color=red];
36 -> {38} [color=red];
37 -> {38} [color=green];
38 -> {39};
39 -> {40};
subgraph cluster_9 {
color=red
41 [label="Enter function test_3" style="filled" fillcolor=red];
42 [label="Postponed enter to lambda"];
subgraph cluster_10 {
color=blue
43 [label="Enter function anonymousFunction"];
44 [label="Jump: ^test_3 Unit"];
45 [label="Stub" style="filled" fillcolor=gray];
46 [label="Exit function anonymousFunction" style="filled" fillcolor=gray];
}
47 [label="Call arguments union" style="filled" fillcolor=gray];
48 [label="Postponed exit from lambda"];
49 [label="Function call: R|kotlin/run|<R|kotlin/Nothing|>(...)" style="filled" fillcolor=gray];
50 [label="Stub" style="filled" fillcolor=gray];
51 [label="Variable declaration: lval x: R|kotlin/Nothing|" style="filled" fillcolor=gray];
52 [label="Exit function test_3" style="filled" fillcolor=red];
}
41 -> {42};
42 -> {43};
42 -> {48} [color=red];
43 -> {44};
44 -> {52};
44 -> {45} [style=dotted];
45 -> {46} [style=dotted];
46 -> {47} [style=dotted];
46 -> {48} [color=green];
47 -> {49} [style=dotted];
48 -> {49} [color=green];
49 -> {52 50} [style=dotted];
50 -> {51} [style=dotted];
51 -> {52} [style=dotted];
}
@@ -0,0 +1,22 @@
// !DUMP_CFG
interface A
class B : A
class C : A
fun test_1(b: Boolean) {
val x = run {
if (b) return@run B()
C()
}
}
fun test_2() {
val x = run {
return@run C()
}
}
fun test_3() {
val x = run { return }
}
@@ -0,0 +1,39 @@
FILE: returnValuesFromLambda.kt
public abstract interface A : R|kotlin/Any| {
}
public final class B : R|A| {
public constructor(): R|B| {
super<R|kotlin/Any|>()
}
}
public final class C : R|A| {
public constructor(): R|C| {
super<R|kotlin/Any|>()
}
}
public final fun test_1(b: R|kotlin/Boolean|): R|kotlin/Unit| {
lval x: R|A| = R|kotlin/run|<R|A|>(<L> = run@fun <anonymous>(): R|A| <kind=EXACTLY_ONCE> {
when () {
R|<local>/b| -> {
^@run R|/B.B|()
}
}
^ R|/C.C|()
}
)
}
public final fun test_2(): R|kotlin/Unit| {
lval x: R|C| = R|kotlin/run|<R|C|>(<L> = run@fun <anonymous>(): R|C| <kind=EXACTLY_ONCE> {
^@run R|/C.C|()
}
)
}
public final fun test_3(): R|kotlin/Unit| {
lval x: R|kotlin/Nothing| = R|kotlin/run|<R|kotlin/Nothing|>(<L> = run@fun <anonymous>(): R|kotlin/Nothing| <kind=EXACTLY_ONCE> {
^test_3 Unit
}
)
}
@@ -0,0 +1,98 @@
digraph safeCalls_kt {
graph [nodesep=3]
node [shape=box penwidth=2]
edge [penwidth=2]
subgraph cluster_0 {
color=red
0 [label="Enter function foo" style="filled" fillcolor=red];
1 [label="Exit function foo" style="filled" fillcolor=red];
}
0 -> {1};
subgraph cluster_1 {
color=red
2 [label="Enter function bar" style="filled" fillcolor=red];
3 [label="Exit function bar" style="filled" fillcolor=red];
}
2 -> {3};
subgraph cluster_2 {
color=red
4 [label="Enter function getter" style="filled" fillcolor=red];
5 [label="Exit function getter" style="filled" fillcolor=red];
}
4 -> {5};
subgraph cluster_3 {
color=red
6 [label="Enter property" style="filled" fillcolor=red];
7 [label="Exit property" style="filled" fillcolor=red];
}
6 -> {7};
subgraph cluster_4 {
color=red
8 [label="Enter function getter" style="filled" fillcolor=red];
9 [label="Exit function getter" style="filled" fillcolor=red];
}
8 -> {9};
subgraph cluster_5 {
color=red
10 [label="Enter property" style="filled" fillcolor=red];
11 [label="Exit property" style="filled" fillcolor=red];
}
10 -> {11};
subgraph cluster_6 {
color=red
12 [label="Enter function test_1" style="filled" fillcolor=red];
13 [label="Access variable R|<local>/x|"];
14 [label="Enter safe call"];
15 [label="Function call: R|<local>/x|?.R|/A.foo|()"];
16 [label="Exit safe call"];
17 [label="Enter safe call"];
18 [label="Function call: R|<local>/x|?.R|/A.foo|()?.R|/A.bar|()"];
19 [label="Exit safe call"];
20 [label="Exit function test_1" style="filled" fillcolor=red];
}
12 -> {13};
13 -> {14 16};
14 -> {15};
15 -> {16};
16 -> {17 19};
17 -> {18};
18 -> {19};
19 -> {20};
subgraph cluster_7 {
color=red
21 [label="Enter function test_2" style="filled" fillcolor=red];
22 [label="Access variable R|<local>/x|"];
23 [label="Enter safe call"];
24 [label="Access variable R|/B.foo|"];
25 [label="Exit safe call"];
26 [label="Enter safe call"];
27 [label="Access variable R|/B.bar|"];
28 [label="Exit safe call"];
29 [label="Exit function test_2" style="filled" fillcolor=red];
}
21 -> {22};
22 -> {23 25};
23 -> {24};
24 -> {25};
25 -> {26 28};
26 -> {27};
27 -> {28};
28 -> {29};
}
@@ -0,0 +1,18 @@
// !DUMP_CFG
interface A {
fun foo(): A
fun bar(): A
}
interface B {
val foo: B
val bar: B
}
fun test_1(x: A?) {
x?.foo()?.bar()
}
fun test_2(x: B?) {
x?.foo?.bar
}
@@ -0,0 +1,21 @@
FILE: safeCalls.kt
public abstract interface A : R|kotlin/Any| {
public abstract fun foo(): R|A|
public abstract fun bar(): R|A|
}
public abstract interface B : R|kotlin/Any| {
public abstract val foo: R|B|
public get(): R|B|
public abstract val bar: R|B|
public get(): R|B|
}
public final fun test_1(x: R|A?|): R|kotlin/Unit| {
R|<local>/x|?.R|/A.foo|()?.R|/A.bar|()
}
public final fun test_2(x: R|B?|): R|kotlin/Unit| {
R|<local>/x|?.R|/B.foo|?.R|/B.bar|
}
@@ -0,0 +1,36 @@
digraph simple_kt {
graph [nodesep=3]
node [shape=box penwidth=2]
edge [penwidth=2]
subgraph cluster_0 {
color=red
0 [label="Enter function foo" style="filled" fillcolor=red];
1 [label="Exit function foo" style="filled" fillcolor=red];
}
0 -> {1};
subgraph cluster_1 {
color=red
2 [label="Enter function test" style="filled" fillcolor=red];
3 [label="Const: Int(1)"];
4 [label="Variable declaration: lval x: R|kotlin/Int|"];
5 [label="Access variable R|<local>/x|"];
6 [label="Const: Int(1)"];
7 [label="Function call: R|<local>/x|.R|kotlin/Int.plus|(...)"];
8 [label="Variable declaration: lval y: R|kotlin/Int|"];
9 [label="Function call: R|/foo|()"];
10 [label="Exit function test" style="filled" fillcolor=red];
}
2 -> {3};
3 -> {4};
4 -> {5};
5 -> {6};
6 -> {7};
7 -> {8};
8 -> {9};
9 -> {10};
}
@@ -0,0 +1,8 @@
// !DUMP_CFG
fun foo() {}
fun test() {
val x = 1
val y = x + 1
foo()
}
@@ -0,0 +1,8 @@
FILE: simple.kt
public final fun foo(): R|kotlin/Unit| {
}
public final fun test(): R|kotlin/Unit| {
lval x: R|kotlin/Int| = Int(1)
lval y: R|kotlin/Int| = R|<local>/x|.R|kotlin/Int.plus|(Int(1))
R|/foo|()
}
@@ -0,0 +1,304 @@
digraph tryCatch_kt {
graph [nodesep=3]
node [shape=box penwidth=2]
edge [penwidth=2]
subgraph cluster_0 {
color=red
0 [label="Enter function test_1" style="filled" fillcolor=red];
subgraph cluster_1 {
color=blue
1 [label="Try expression enter"];
subgraph cluster_2 {
color=blue
2 [label="Try main block enter"];
subgraph cluster_3 {
color=blue
3 [label="Enter block"];
4 [label="Const: Int(1)"];
5 [label="Variable declaration: lval x: R|kotlin/Int|"];
6 [label="Exit block"];
}
7 [label="Try main block exit"];
}
subgraph cluster_4 {
color=blue
8 [label="Catch enter"];
subgraph cluster_5 {
color=blue
9 [label="Enter block"];
10 [label="Const: Int(3)"];
11 [label="Variable declaration: lval z: R|kotlin/Int|"];
12 [label="Exit block"];
}
13 [label="Catch exit"];
}
subgraph cluster_6 {
color=blue
14 [label="Catch enter"];
subgraph cluster_7 {
color=blue
15 [label="Enter block"];
16 [label="Const: Int(2)"];
17 [label="Variable declaration: lval y: R|kotlin/Int|"];
18 [label="Exit block"];
}
19 [label="Catch exit"];
}
20 [label="Try expression exit"];
}
21 [label="Exit function test_1" style="filled" fillcolor=red];
}
0 -> {1};
1 -> {2};
2 -> {21 14 8 3};
3 -> {4};
4 -> {5};
5 -> {6};
6 -> {7};
7 -> {20};
8 -> {21 9};
9 -> {10};
10 -> {11};
11 -> {12};
12 -> {13};
13 -> {20};
14 -> {21 15};
15 -> {16};
16 -> {17};
17 -> {18};
18 -> {19};
19 -> {20};
20 -> {21};
subgraph cluster_8 {
color=red
22 [label="Enter function test_2" style="filled" fillcolor=red];
subgraph cluster_9 {
color=blue
23 [label="Try expression enter"];
subgraph cluster_10 {
color=blue
24 [label="Try main block enter"];
subgraph cluster_11 {
color=blue
25 [label="Enter block"];
26 [label="Const: Int(1)"];
27 [label="Exit block"];
}
28 [label="Try main block exit"];
}
subgraph cluster_12 {
color=blue
29 [label="Catch enter"];
subgraph cluster_13 {
color=blue
30 [label="Enter block"];
31 [label="Const: Int(2)"];
32 [label="Exit block"];
}
33 [label="Catch exit"];
}
34 [label="Try expression exit"];
}
35 [label="Variable declaration: lval x: R|kotlin/Int|"];
36 [label="Exit function test_2" style="filled" fillcolor=red];
}
22 -> {23};
23 -> {24};
24 -> {36 29 25};
25 -> {26};
26 -> {27};
27 -> {28};
28 -> {34};
29 -> {36 30};
30 -> {31};
31 -> {32};
32 -> {33};
33 -> {34};
34 -> {35};
35 -> {36};
subgraph cluster_14 {
color=red
37 [label="Enter function test_3" style="filled" fillcolor=red];
subgraph cluster_15 {
color=blue
38 [label="Enter while loop"];
subgraph cluster_16 {
color=blue
39 [label="Enter loop condition"];
40 [label="Const: Boolean(true)"];
41 [label="Exit loop condition"];
}
subgraph cluster_17 {
color=blue
42 [label="Enter loop block"];
subgraph cluster_18 {
color=blue
43 [label="Enter block"];
subgraph cluster_19 {
color=blue
44 [label="Try expression enter"];
subgraph cluster_20 {
color=blue
45 [label="Try main block enter"];
subgraph cluster_21 {
color=blue
46 [label="Enter block"];
subgraph cluster_22 {
color=blue
47 [label="Enter when"];
subgraph cluster_23 {
color=blue
48 [label="Enter when branch condition "];
49 [label="Access variable R|<local>/b|"];
50 [label="Exit when branch condition"];
}
51 [label="Synthetic else branch"];
52 [label="Enter when branch result"];
subgraph cluster_24 {
color=blue
53 [label="Enter block"];
54 [label="Jump: ^test_3 Unit"];
55 [label="Stub" style="filled" fillcolor=gray];
56 [label="Exit block" style="filled" fillcolor=gray];
}
57 [label="Exit when branch result" style="filled" fillcolor=gray];
58 [label="Exit when"];
}
59 [label="Const: Int(1)"];
60 [label="Variable declaration: lval x: R|kotlin/Int|"];
subgraph cluster_25 {
color=blue
61 [label="Enter when"];
subgraph cluster_26 {
color=blue
62 [label="Enter when branch condition "];
63 [label="Access variable R|<local>/b|"];
64 [label="Function call: R|<local>/b|.R|kotlin/Boolean.not|()"];
65 [label="Exit when branch condition"];
}
66 [label="Synthetic else branch"];
67 [label="Enter when branch result"];
subgraph cluster_27 {
color=blue
68 [label="Enter block"];
69 [label="Jump: break@@@[Boolean(true)] "];
70 [label="Stub" style="filled" fillcolor=gray];
71 [label="Exit block" style="filled" fillcolor=gray];
}
72 [label="Exit when branch result" style="filled" fillcolor=gray];
73 [label="Exit when"];
}
74 [label="Exit block"];
}
75 [label="Try main block exit"];
}
subgraph cluster_28 {
color=blue
76 [label="Catch enter"];
subgraph cluster_29 {
color=blue
77 [label="Enter block"];
78 [label="Jump: break@@@[Boolean(true)] "];
79 [label="Stub" style="filled" fillcolor=gray];
80 [label="Exit block" style="filled" fillcolor=gray];
}
81 [label="Catch exit" style="filled" fillcolor=gray];
}
subgraph cluster_30 {
color=blue
82 [label="Catch enter"];
subgraph cluster_31 {
color=blue
83 [label="Enter block"];
84 [label="Jump: continue@@@[Boolean(true)] "];
85 [label="Stub" style="filled" fillcolor=gray];
86 [label="Exit block" style="filled" fillcolor=gray];
}
87 [label="Catch exit" style="filled" fillcolor=gray];
}
88 [label="Try expression exit"];
}
89 [label="Const: Int(2)"];
90 [label="Variable declaration: lval y: R|kotlin/Int|"];
91 [label="Exit block"];
}
92 [label="Exit loop block"];
}
93 [label="Exit whileloop"];
}
94 [label="Const: Int(3)"];
95 [label="Variable declaration: lval z: R|kotlin/Int|"];
96 [label="Exit function test_3" style="filled" fillcolor=red];
}
37 -> {38};
38 -> {39};
39 -> {40};
40 -> {41};
41 -> {42};
41 -> {93} [style=dotted];
42 -> {43};
43 -> {44};
44 -> {45};
45 -> {96 82 76 46};
46 -> {47};
47 -> {48};
48 -> {49};
49 -> {50};
50 -> {52 51};
51 -> {58};
52 -> {53};
53 -> {54};
54 -> {96};
54 -> {55} [style=dotted];
55 -> {56} [style=dotted];
56 -> {57} [style=dotted];
57 -> {58} [style=dotted];
58 -> {59};
59 -> {60};
60 -> {61};
61 -> {62};
62 -> {63};
63 -> {64};
64 -> {65};
65 -> {67 66};
66 -> {73};
67 -> {68};
68 -> {69};
69 -> {93};
69 -> {70} [style=dotted];
70 -> {71} [style=dotted];
71 -> {72} [style=dotted];
72 -> {73} [style=dotted];
73 -> {74};
74 -> {75};
75 -> {88};
76 -> {96 77};
77 -> {78};
78 -> {93};
78 -> {79} [style=dotted];
79 -> {80} [style=dotted];
80 -> {81} [style=dotted];
81 -> {88} [style=dotted];
82 -> {96 83};
83 -> {84};
84 -> {38};
84 -> {85} [style=dotted];
85 -> {86} [style=dotted];
86 -> {87} [style=dotted];
87 -> {88} [style=dotted];
88 -> {89};
89 -> {90};
90 -> {91};
91 -> {92};
92 -> {39};
93 -> {94};
94 -> {95};
95 -> {96};
}
@@ -0,0 +1,34 @@
// !DUMP_CFG
fun test_1() {
try {
val x = 1
} catch (e: RuntimeException) {
val y = 2
} catch (e: Exception) {
val z = 3
}
}
fun test_2() {
val x = try {
1
} catch (e: Exception) {
2
}
}
fun test_3(b: Boolean) {
while (true) {
try {
if (b) return
val x = 1
if (!b) break
} catch (e: Exception) {
continue
} catch (e: RuntimeException) {
break
}
val y = 2
}
val z = 3
}
@@ -0,0 +1,51 @@
FILE: tryCatch.kt
public final fun test_1(): R|kotlin/Unit| {
try {
lval x: R|kotlin/Int| = Int(1)
}
catch (e: R|kotlin/RuntimeException|) {
lval y: R|kotlin/Int| = Int(2)
}
catch (e: R|kotlin/Exception|) {
lval z: R|kotlin/Int| = Int(3)
}
}
public final fun test_2(): R|kotlin/Unit| {
lval x: R|kotlin/Int| = try {
Int(1)
}
catch (e: R|kotlin/Exception|) {
Int(2)
}
}
public final fun test_3(b: R|kotlin/Boolean|): R|kotlin/Unit| {
while(Boolean(true)) {
try {
when () {
R|<local>/b| -> {
^test_3 Unit
}
}
lval x: R|kotlin/Int| = Int(1)
when () {
R|<local>/b|.R|kotlin/Boolean.not|() -> {
break@@@[Boolean(true)]
}
}
}
catch (e: R|kotlin/Exception|) {
continue@@@[Boolean(true)]
}
catch (e: R|kotlin/RuntimeException|) {
break@@@[Boolean(true)]
}
lval y: R|kotlin/Int| = Int(2)
}
lval z: R|kotlin/Int| = Int(3)
}
@@ -0,0 +1,190 @@
digraph when_kt {
graph [nodesep=3]
node [shape=box penwidth=2]
edge [penwidth=2]
subgraph cluster_0 {
color=red
0 [label="Enter function test_1" style="filled" fillcolor=red];
subgraph cluster_1 {
color=blue
1 [label="Enter when"];
subgraph cluster_2 {
color=blue
2 [label="Enter when branch condition "];
3 [label="Access variable R|<local>/x|"];
4 [label="Const: Int(1)"];
5 [label="Operator =="];
6 [label="Exit when branch condition"];
}
subgraph cluster_3 {
color=blue
7 [label="Enter when branch condition "];
8 [label="Access variable R|<local>/x|"];
9 [label="Const: Int(2)"];
10 [label="Function call: R|<local>/x|.R|kotlin/Int.rem|(...)"];
11 [label="Const: Int(0)"];
12 [label="Operator =="];
13 [label="Exit when branch condition"];
}
subgraph cluster_4 {
color=blue
14 [label="Enter when branch condition "];
15 [label="Const: Int(1)"];
16 [label="Const: Int(1)"];
17 [label="Function call: Int(1).R|kotlin/Int.minus|(...)"];
18 [label="Const: Int(0)"];
19 [label="Operator =="];
20 [label="Exit when branch condition"];
}
subgraph cluster_5 {
color=blue
21 [label="Enter when branch condition else"];
22 [label="Exit when branch condition"];
}
23 [label="Enter when branch result"];
subgraph cluster_6 {
color=blue
24 [label="Enter block"];
25 [label="Const: Int(5)"];
26 [label="Exit block"];
}
27 [label="Exit when branch result"];
28 [label="Enter when branch result"];
subgraph cluster_7 {
color=blue
29 [label="Enter block"];
30 [label="Jump: ^test_1 Unit"];
31 [label="Stub" style="filled" fillcolor=gray];
32 [label="Exit block" style="filled" fillcolor=gray];
}
33 [label="Exit when branch result" style="filled" fillcolor=gray];
34 [label="Enter when branch result"];
subgraph cluster_8 {
color=blue
35 [label="Enter block"];
36 [label="Const: Int(20)"];
37 [label="Exit block"];
}
38 [label="Exit when branch result"];
39 [label="Enter when branch result"];
subgraph cluster_9 {
color=blue
40 [label="Enter block"];
41 [label="Const: Int(10)"];
42 [label="Exit block"];
}
43 [label="Exit when branch result"];
44 [label="Exit when"];
}
45 [label="Variable declaration: lval y: R|kotlin/Int|"];
46 [label="Exit function test_1" style="filled" fillcolor=red];
}
0 -> {1};
1 -> {2};
2 -> {3};
3 -> {4};
4 -> {5};
5 -> {6};
6 -> {39 7};
7 -> {8};
8 -> {9};
9 -> {10};
10 -> {11};
11 -> {12};
12 -> {13};
13 -> {34 14};
14 -> {15};
15 -> {16};
16 -> {17};
17 -> {18};
18 -> {19};
19 -> {20};
20 -> {28 21};
21 -> {22};
22 -> {23};
23 -> {24};
24 -> {25};
25 -> {26};
26 -> {27};
27 -> {44};
28 -> {29};
29 -> {30};
30 -> {46};
30 -> {31} [style=dotted];
31 -> {32} [style=dotted];
32 -> {33} [style=dotted];
33 -> {44} [style=dotted];
34 -> {35};
35 -> {36};
36 -> {37};
37 -> {38};
38 -> {44};
39 -> {40};
40 -> {41};
41 -> {42};
42 -> {43};
43 -> {44};
44 -> {45};
45 -> {46};
subgraph cluster_10 {
color=red
47 [label="Enter function test_2" style="filled" fillcolor=red];
subgraph cluster_11 {
color=blue
48 [label="Enter when"];
subgraph cluster_12 {
color=blue
49 [label="Enter when branch condition "];
subgraph cluster_13 {
color=blue
50 [label="Enter &&"];
51 [label="Access variable R|<local>/x|"];
52 [label="Type operator: (R|<local>/x| is R|A|)"];
53 [label="Exit left part of &&"];
54 [label="Enter right part of &&"];
55 [label="Access variable R|<local>/x|"];
56 [label="Type operator: (R|<local>/x| is R|B|)"];
57 [label="Exit &&"];
}
58 [label="Exit when branch condition"];
}
59 [label="Synthetic else branch"];
60 [label="Enter when branch result"];
subgraph cluster_14 {
color=blue
61 [label="Enter block"];
62 [label="Access variable R|<local>/x|"];
63 [label="Type operator: (R|<local>/x| is R|A|)"];
64 [label="Exit block"];
}
65 [label="Exit when branch result"];
66 [label="Exit when"];
}
67 [label="Exit function test_2" style="filled" fillcolor=red];
}
47 -> {48};
48 -> {49};
49 -> {50};
50 -> {51};
51 -> {52};
52 -> {53};
53 -> {57 54};
54 -> {55};
55 -> {56};
56 -> {57};
57 -> {58};
58 -> {60 59};
59 -> {66};
60 -> {61};
61 -> {62};
62 -> {63};
63 -> {64};
64 -> {65};
65 -> {66};
66 -> {67};
}
@@ -0,0 +1,18 @@
// !DUMP_CFG
fun test_1(x: Int) {
val y = when {
x == 1 -> 10
x % 2 == 0 -> 20
1 - 1 == 0 -> return
else -> 5
}
}
interface A
interface B
fun test_2(x: Any?) {
if (x is A && x is B) {
x is A
}
}
@@ -0,0 +1,30 @@
FILE: when.kt
public final fun test_1(x: R|kotlin/Int|): R|kotlin/Unit| {
lval y: R|kotlin/Int| = when () {
==(R|<local>/x|, Int(1)) -> {
Int(10)
}
==(R|<local>/x|.R|kotlin/Int.rem|(Int(2)), Int(0)) -> {
Int(20)
}
==(Int(1).R|kotlin/Int.minus|(Int(1)), Int(0)) -> {
^test_1 Unit
}
else -> {
Int(5)
}
}
}
public abstract interface A : R|kotlin/Any| {
}
public abstract interface B : R|kotlin/Any| {
}
public final fun test_2(x: R|kotlin/Any?|): R|kotlin/Unit| {
when () {
(R|<local>/x| is R|A|) && (R|<local>/x| is R|B|) -> {
(R|<local>/x| is R|A|)
}
}
}