[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,483 @@
digraph boundSmartcasts_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 test_1" style="filled" fillcolor=red];
5 [label="Access variable R|<local>/x|"];
6 [label="Variable declaration: lval y: R|kotlin/Any|"];
subgraph cluster_3 {
color=blue
7 [label="Enter when"];
subgraph cluster_4 {
color=blue
8 [label="Enter when branch condition "];
9 [label="Access variable R|<local>/x|"];
10 [label="Type operator: (R|<local>/x| is R|A|)"];
11 [label="Exit when branch condition"];
}
12 [label="Synthetic else branch"];
13 [label="Enter when branch result"];
subgraph cluster_5 {
color=blue
14 [label="Enter block"];
15 [label="Access variable R|<local>/x|"];
16 [label="Function call: R|<local>/x|.R|/A.foo|()"];
17 [label="Access variable R|<local>/y|"];
18 [label="Function call: R|<local>/y|.R|/A.foo|()"];
19 [label="Exit block"];
}
20 [label="Exit when branch result"];
21 [label="Exit when"];
}
22 [label="Exit function test_1" style="filled" fillcolor=red];
}
4 -> {5};
5 -> {6};
6 -> {7};
7 -> {8};
8 -> {9};
9 -> {10};
10 -> {11};
11 -> {13 12};
12 -> {21};
13 -> {14};
14 -> {15};
15 -> {16};
16 -> {17};
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];
24 [label="Access variable R|<local>/x|"];
25 [label="Variable declaration: lval y: R|kotlin/Any|"];
subgraph cluster_7 {
color=blue
26 [label="Enter when"];
subgraph cluster_8 {
color=blue
27 [label="Enter when branch condition "];
28 [label="Access variable R|<local>/y|"];
29 [label="Type operator: (R|<local>/y| is R|A|)"];
30 [label="Exit when branch condition"];
}
31 [label="Synthetic else branch"];
32 [label="Enter when branch result"];
subgraph cluster_9 {
color=blue
33 [label="Enter block"];
34 [label="Access variable R|<local>/x|"];
35 [label="Function call: R|<local>/x|.R|/A.foo|()"];
36 [label="Access variable R|<local>/y|"];
37 [label="Function call: R|<local>/y|.R|/A.foo|()"];
38 [label="Exit block"];
}
39 [label="Exit when branch result"];
40 [label="Exit when"];
}
41 [label="Exit function test_2" style="filled" fillcolor=red];
}
23 -> {24};
24 -> {25};
25 -> {26};
26 -> {27};
27 -> {28};
28 -> {29};
29 -> {30};
30 -> {32 31};
31 -> {40};
32 -> {33};
33 -> {34};
34 -> {35};
35 -> {36};
36 -> {37};
37 -> {38};
38 -> {39};
39 -> {40};
40 -> {41};
subgraph cluster_10 {
color=red
42 [label="Enter function test_3" style="filled" fillcolor=red];
43 [label="Access variable R|<local>/x|"];
44 [label="Variable declaration: lvar z: R|kotlin/Any|"];
subgraph cluster_11 {
color=blue
45 [label="Enter when"];
subgraph cluster_12 {
color=blue
46 [label="Enter when branch condition "];
47 [label="Access variable R|<local>/x|"];
48 [label="Type operator: (R|<local>/x| is R|A|)"];
49 [label="Exit when branch condition"];
}
50 [label="Synthetic else branch"];
51 [label="Enter when branch result"];
subgraph cluster_13 {
color=blue
52 [label="Enter block"];
53 [label="Access variable R|<local>/z|"];
54 [label="Function call: R|<local>/z|.R|/A.foo|()"];
55 [label="Exit block"];
}
56 [label="Exit when branch result"];
57 [label="Exit when"];
}
58 [label="Access variable R|<local>/y|"];
59 [label="Assignmenet: R|<local>/z|"];
subgraph cluster_14 {
color=blue
60 [label="Enter when"];
subgraph cluster_15 {
color=blue
61 [label="Enter when branch condition "];
62 [label="Access variable R|<local>/y|"];
63 [label="Type operator: (R|<local>/y| is R|B|)"];
64 [label="Exit when branch condition"];
}
65 [label="Synthetic else branch"];
66 [label="Enter when branch result"];
subgraph cluster_16 {
color=blue
67 [label="Enter block"];
68 [label="Access variable R|<local>/z|"];
69 [label="Function call: R|<local>/z|.<Unresolved name: foo>#()"];
70 [label="Access variable R|<local>/z|"];
71 [label="Function call: R|<local>/z|.R|/B.bar|()"];
72 [label="Exit block"];
}
73 [label="Exit when branch result"];
74 [label="Exit when"];
}
75 [label="Exit function test_3" style="filled" fillcolor=red];
}
42 -> {43};
43 -> {44};
44 -> {45};
45 -> {46};
46 -> {47};
47 -> {48};
48 -> {49};
49 -> {51 50};
50 -> {57};
51 -> {52};
52 -> {53};
53 -> {54};
54 -> {55};
55 -> {56};
56 -> {57};
57 -> {58};
58 -> {59};
59 -> {60};
60 -> {61};
61 -> {62};
62 -> {63};
63 -> {64};
64 -> {66 65};
65 -> {74};
66 -> {67};
67 -> {68};
68 -> {69};
69 -> {70};
70 -> {71};
71 -> {72};
72 -> {73};
73 -> {74};
74 -> {75};
subgraph cluster_17 {
color=red
76 [label="Enter function test_4" style="filled" fillcolor=red];
77 [label="Const: Int(1)"];
78 [label="Variable declaration: lvar x: R|kotlin/Any|"];
79 [label="Access variable R|<local>/x|"];
80 [label="Type operator: (R|<local>/x| as R|kotlin/Int|)"];
81 [label="Access variable R|<local>/x|"];
82 [label="Function call: R|<local>/x|.R|kotlin/Int.inc|()"];
83 [label="Access variable R|<local>/y|"];
84 [label="Assignmenet: R|<local>/x|"];
85 [label="Access variable R|<local>/x|"];
86 [label="Function call: R|<local>/x|.<Unresolved name: inc>#()"];
subgraph cluster_18 {
color=blue
87 [label="Enter when"];
subgraph cluster_19 {
color=blue
88 [label="Enter when branch condition "];
89 [label="Access variable R|<local>/y|"];
90 [label="Type operator: (R|<local>/y| is R|A|)"];
91 [label="Exit when branch condition"];
}
92 [label="Synthetic else branch"];
93 [label="Enter when branch result"];
subgraph cluster_20 {
color=blue
94 [label="Enter block"];
95 [label="Access variable R|<local>/x|"];
96 [label="Function call: R|<local>/x|.R|/A.foo|()"];
97 [label="Access variable R|<local>/y|"];
98 [label="Function call: R|<local>/y|.R|/A.foo|()"];
99 [label="Exit block"];
}
100 [label="Exit when branch result"];
101 [label="Exit when"];
}
102 [label="Exit function test_4" style="filled" fillcolor=red];
}
76 -> {77};
77 -> {78};
78 -> {79};
79 -> {80};
80 -> {81};
81 -> {82};
82 -> {83};
83 -> {84};
84 -> {85};
85 -> {86};
86 -> {87};
87 -> {88};
88 -> {89};
89 -> {90};
90 -> {91};
91 -> {93 92};
92 -> {101};
93 -> {94};
94 -> {95};
95 -> {96};
96 -> {97};
97 -> {98};
98 -> {99};
99 -> {100};
100 -> {101};
101 -> {102};
subgraph cluster_21 {
color=red
103 [label="Enter function <init>" style="filled" fillcolor=red];
104 [label="Delegated constructor call: super<R|kotlin/Any|>()"];
105 [label="Exit function <init>" style="filled" fillcolor=red];
}
103 -> {104};
104 -> {105};
subgraph cluster_22 {
color=red
106 [label="Enter function getter" style="filled" fillcolor=red];
107 [label="Exit function getter" style="filled" fillcolor=red];
}
106 -> {107};
subgraph cluster_23 {
color=red
108 [label="Enter property" style="filled" fillcolor=red];
109 [label="Access variable R|<local>/any|"];
110 [label="Exit property" style="filled" fillcolor=red];
}
108 -> {109};
109 -> {110};
subgraph cluster_24 {
color=red
111 [label="Enter function baz" style="filled" fillcolor=red];
112 [label="Exit function baz" style="filled" fillcolor=red];
}
111 -> {112};
subgraph cluster_25 {
color=red
113 [label="Enter function test_5" style="filled" fillcolor=red];
subgraph cluster_26 {
color=blue
114 [label="Enter when"];
115 [label="Access variable R|<local>/d|"];
116 [label="Access variable R|/D.any|"];
117 [label="Variable declaration: lval <elvis>: R|kotlin/Any?|"];
subgraph cluster_27 {
color=blue
118 [label="Enter when branch condition "];
119 [label="Const: Null(null)"];
120 [label="Operator =="];
121 [label="Exit when branch condition"];
}
subgraph cluster_28 {
color=blue
122 [label="Enter when branch condition else"];
123 [label="Exit when branch condition"];
}
124 [label="Enter when branch result"];
subgraph cluster_29 {
color=blue
125 [label="Enter block"];
126 [label="Access variable R|<local>/<elvis>|"];
127 [label="Exit block"];
}
128 [label="Exit when branch result"];
129 [label="Enter when branch result"];
subgraph cluster_30 {
color=blue
130 [label="Enter block"];
131 [label="Jump: ^test_5 Unit"];
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="Variable declaration: lval a: R|kotlin/Any|"];
137 [label="Access variable R|<local>/a|"];
138 [label="Function call: R|<local>/a|.R|/baz|()"];
139 [label="Access variable R|<local>/d|"];
140 [label="Access variable R|/D.any|"];
141 [label="Function call: R|<local>/d|.R|/D.any|.R|/baz|()"];
142 [label="Access variable R|<local>/a|"];
143 [label="Type operator: (R|<local>/a| as R|A|)"];
144 [label="Access variable R|<local>/a|"];
145 [label="Function call: R|<local>/a|.R|/A.foo|()"];
146 [label="Exit function test_5" style="filled" fillcolor=red];
}
113 -> {114};
114 -> {115};
115 -> {116};
116 -> {117};
117 -> {118};
118 -> {119};
119 -> {120};
120 -> {121};
121 -> {129 122};
122 -> {123};
123 -> {124};
124 -> {125};
125 -> {126};
126 -> {127};
127 -> {128};
128 -> {135};
129 -> {130};
130 -> {131};
131 -> {146};
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 -> {141};
141 -> {142};
142 -> {143};
143 -> {144};
144 -> {145};
145 -> {146};
subgraph cluster_31 {
color=red
147 [label="Enter function test_6" style="filled" fillcolor=red];
148 [label="Access variable R|<local>/d1|"];
149 [label="Access variable R|/D.any|"];
150 [label="Variable declaration: lval a: R|kotlin/Any?|"];
151 [label="Access variable R|<local>/a|"];
152 [label="Type operator: (R|<local>/a| as R|A|)"];
153 [label="Access variable R|<local>/a|"];
154 [label="Function call: R|<local>/a|.R|/A.foo|()"];
155 [label="Access variable R|<local>/d1|"];
156 [label="Access variable R|/D.any|"];
157 [label="Function call: R|<local>/d1|.R|/D.any|.R|/A.foo|()"];
158 [label="Access variable R|<local>/d1|"];
159 [label="Access variable R|/D.any|"];
160 [label="Function call: R|<local>/d1|.R|/D.any|.R|/baz|()"];
161 [label="Exit function test_6" style="filled" fillcolor=red];
}
147 -> {148};
148 -> {149};
149 -> {150};
150 -> {151};
151 -> {152};
152 -> {153};
153 -> {154};
154 -> {155};
155 -> {156};
156 -> {157};
157 -> {158};
158 -> {159};
159 -> {160};
160 -> {161};
subgraph cluster_32 {
color=red
162 [label="Enter function test_7" style="filled" fillcolor=red];
163 [label="Access variable R|<local>/d1|"];
164 [label="Enter safe call"];
165 [label="Access variable R|/D.any|"];
166 [label="Exit safe call"];
167 [label="Variable declaration: lval a: R|kotlin/Any?|"];
168 [label="Access variable R|<local>/d2|"];
169 [label="Enter safe call"];
170 [label="Access variable R|/D.any|"];
171 [label="Exit safe call"];
172 [label="Variable declaration: lval b: R|kotlin/Any?|"];
173 [label="Access variable R|<local>/a|"];
174 [label="Type operator: (R|<local>/a| as R|A|)"];
175 [label="Access variable R|<local>/a|"];
176 [label="Function call: R|<local>/a|.R|/A.foo|()"];
177 [label="Access variable R|<local>/b|"];
178 [label="Type operator: (R|<local>/b| as R|B|)"];
179 [label="Access variable R|<local>/b|"];
180 [label="Function call: R|<local>/b|.R|/B.bar|()"];
181 [label="Exit function test_7" style="filled" fillcolor=red];
}
162 -> {163};
163 -> {164 166};
164 -> {165};
165 -> {166};
166 -> {167};
167 -> {168};
168 -> {169 171};
169 -> {170};
170 -> {171};
171 -> {172};
172 -> {173};
173 -> {174};
174 -> {175};
175 -> {176};
176 -> {177};
177 -> {178};
178 -> {179};
179 -> {180};
180 -> {181};
}
@@ -0,0 +1,78 @@
// !DUMP_CFG
interface A {
fun foo()
}
interface B {
fun bar()
}
fun test_1(x: Any) {
val y = x
if (x is A) {
x.foo()
y.foo()
}
}
fun test_2(x: Any) {
val y = x
if (y is A) {
x.foo()
y.foo()
}
}
fun test_3(x: Any, y: Any) {
var z = x
if (x is A) {
z.foo()
}
z = y
if (y is B) {
z.<!UNRESOLVED_REFERENCE!>foo<!>()
z.bar()
}
}
fun test_4(y: Any) {
var x: Any = 1
x as Int
x.inc()
x = y
x.<!UNRESOLVED_REFERENCE!>inc<!>()
if (y is A) {
x.foo()
y.foo()
}
}
class D(val any: Any?)
fun Any.baz() {}
fun test_5(d: D) {
// Elvis operator is converted into == function call
val a = d.any ?: return
a.baz() // should be OK
d.any.baz() // should be OK
a as A
a.foo() // should be OK
}
fun test_6(d1: D) {
val a = d1.any
a as A
a.foo() // should be OK
d1.any.foo() // should be OK
d1.any.baz() // should be OK
}
fun test_7(d1: D, d2: D) {
val a = d1?.any
val b = d2?.any
a as A
a.foo() // should be OK
b as B
b.bar() // should be OK
}
@@ -0,0 +1,101 @@
FILE: boundSmartcasts.kt
public abstract interface A : R|kotlin/Any| {
public abstract fun foo(): R|kotlin/Unit|
}
public abstract interface B : R|kotlin/Any| {
public abstract fun bar(): R|kotlin/Unit|
}
public final fun test_1(x: R|kotlin/Any|): R|kotlin/Unit| {
lval y: R|kotlin/Any| = R|<local>/x|
when () {
(R|<local>/x| is R|A|) -> {
R|<local>/x|.R|/A.foo|()
R|<local>/y|.R|/A.foo|()
}
}
}
public final fun test_2(x: R|kotlin/Any|): R|kotlin/Unit| {
lval y: R|kotlin/Any| = R|<local>/x|
when () {
(R|<local>/y| is R|A|) -> {
R|<local>/x|.R|/A.foo|()
R|<local>/y|.R|/A.foo|()
}
}
}
public final fun test_3(x: R|kotlin/Any|, y: R|kotlin/Any|): R|kotlin/Unit| {
lvar z: R|kotlin/Any| = R|<local>/x|
when () {
(R|<local>/x| is R|A|) -> {
R|<local>/z|.R|/A.foo|()
}
}
R|<local>/z| = R|<local>/y|
when () {
(R|<local>/y| is R|B|) -> {
R|<local>/z|.<Unresolved name: foo>#()
R|<local>/z|.R|/B.bar|()
}
}
}
public final fun test_4(y: R|kotlin/Any|): R|kotlin/Unit| {
lvar x: R|kotlin/Any| = Int(1)
(R|<local>/x| as R|kotlin/Int|)
R|<local>/x|.R|kotlin/Int.inc|()
R|<local>/x| = R|<local>/y|
R|<local>/x|.<Unresolved name: inc>#()
when () {
(R|<local>/y| is R|A|) -> {
R|<local>/x|.R|/A.foo|()
R|<local>/y|.R|/A.foo|()
}
}
}
public final class D : R|kotlin/Any| {
public constructor(any: R|kotlin/Any?|): R|D| {
super<R|kotlin/Any|>()
}
public final val any: R|kotlin/Any?| = R|<local>/any|
public get(): R|kotlin/Any?|
}
public final fun R|kotlin/Any|.baz(): R|kotlin/Unit| {
}
public final fun test_5(d: R|D|): R|kotlin/Unit| {
lval a: R|kotlin/Any| = when (lval <elvis>: R|kotlin/Any?| = R|<local>/d|.R|/D.any|) {
==($subj$, Null(null)) -> {
^test_5 Unit
}
else -> {
R|<local>/<elvis>|
}
}
R|<local>/a|.R|/baz|()
R|<local>/d|.R|/D.any|.R|/baz|()
(R|<local>/a| as R|A|)
R|<local>/a|.R|/A.foo|()
}
public final fun test_6(d1: R|D|): R|kotlin/Unit| {
lval a: R|kotlin/Any?| = R|<local>/d1|.R|/D.any|
(R|<local>/a| as R|A|)
R|<local>/a|.R|/A.foo|()
R|<local>/d1|.R|/D.any|.R|/A.foo|()
R|<local>/d1|.R|/D.any|.R|/baz|()
}
public final fun test_7(d1: R|D|, d2: R|D|): R|kotlin/Unit| {
lval a: R|kotlin/Any?| = R|<local>/d1|?.R|/D.any|
lval b: R|kotlin/Any?| = R|<local>/d2|?.R|/D.any|
(R|<local>/a| as R|A|)
R|<local>/a|.R|/A.foo|()
(R|<local>/b| as R|B|)
R|<local>/b|.R|/B.bar|()
}
@@ -0,0 +1,807 @@
digraph boundSmartcastsInBranches_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 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: String()"];
7 [label="Exit property" style="filled" fillcolor=red];
}
5 -> {6};
6 -> {7};
subgraph cluster_3 {
color=red
8 [label="Enter function test_0" style="filled" fillcolor=red];
9 [label="Const: Null(null)"];
10 [label="Variable declaration: lvar goodA: R|A?|"];
11 [label="Access variable R|<local>/list|"];
12 [label="Function call: R|<local>/list|.R|FakeOverride<kotlin/collections/List.iterator: R|kotlin/collections/Iterator<A>|>|()"];
13 [label="Variable declaration: lval <iterator>: R|kotlin/collections/Iterator<A>|"];
subgraph cluster_4 {
color=blue
14 [label="Enter while loop"];
subgraph cluster_5 {
color=blue
15 [label="Enter loop condition"];
16 [label="Access variable R|<local>/<iterator>|"];
17 [label="Function call: R|<local>/<iterator>|.R|kotlin/collections/Iterator.hasNext|()"];
18 [label="Exit loop condition"];
}
subgraph cluster_6 {
color=blue
19 [label="Enter loop block"];
subgraph cluster_7 {
color=blue
20 [label="Enter block"];
21 [label="Access variable R|<local>/<iterator>|"];
22 [label="Function call: R|<local>/<iterator>|.R|FakeOverride<kotlin/collections/Iterator.next: R|A|>|()"];
23 [label="Variable declaration: lval a: R|A|"];
subgraph cluster_8 {
color=blue
24 [label="Enter when"];
subgraph cluster_9 {
color=blue
25 [label="Enter when branch condition "];
26 [label="Access variable R|<local>/goodA|"];
27 [label="Const: Null(null)"];
28 [label="Operator =="];
29 [label="Exit when branch condition"];
}
30 [label="Synthetic else branch"];
31 [label="Enter when branch result"];
subgraph cluster_10 {
color=blue
32 [label="Enter block"];
33 [label="Access variable R|<local>/a|"];
34 [label="Assignmenet: R|<local>/goodA|"];
35 [label="Jump: continue@@@[R|<local>/<iterator>|.R|kotlin/collections/Iterator.hasNext|()] "];
36 [label="Stub" style="filled" fillcolor=gray];
37 [label="Exit block" style="filled" fillcolor=gray];
}
38 [label="Exit when branch result" style="filled" fillcolor=gray];
39 [label="Exit when"];
}
40 [label="Access variable R|<local>/goodA|"];
41 [label="Access variable R|/A.s|"];
42 [label="Exit block"];
}
43 [label="Exit loop block"];
}
44 [label="Exit whileloop"];
}
45 [label="Exit function test_0" style="filled" fillcolor=red];
}
8 -> {9};
9 -> {10};
10 -> {11};
11 -> {12};
12 -> {13};
13 -> {14};
14 -> {15};
15 -> {16};
16 -> {17};
17 -> {18};
18 -> {44 19};
19 -> {20};
20 -> {21};
21 -> {22};
22 -> {23};
23 -> {24};
24 -> {25};
25 -> {26};
26 -> {27};
27 -> {28};
28 -> {29};
29 -> {31 30};
30 -> {39};
31 -> {32};
32 -> {33};
33 -> {34};
34 -> {35};
35 -> {14};
35 -> {36} [style=dotted];
36 -> {37} [style=dotted];
37 -> {38} [style=dotted];
38 -> {39} [style=dotted];
39 -> {40};
40 -> {41};
41 -> {42};
42 -> {43};
43 -> {15};
44 -> {45};
subgraph cluster_11 {
color=red
46 [label="Enter function test_1" style="filled" fillcolor=red];
47 [label="Variable declaration: lval x: R|kotlin/Any|"];
subgraph cluster_12 {
color=blue
48 [label="Enter when"];
subgraph cluster_13 {
color=blue
49 [label="Enter when branch condition "];
50 [label="Access variable R|<local>/b|"];
51 [label="Exit when branch condition"];
}
subgraph cluster_14 {
color=blue
52 [label="Enter when branch condition else"];
53 [label="Exit when branch condition"];
}
54 [label="Enter when branch result"];
subgraph cluster_15 {
color=blue
55 [label="Enter block"];
56 [label="Access variable R|<local>/a|"];
57 [label="Assignmenet: R|<local>/x|"];
58 [label="Exit block"];
}
59 [label="Exit when branch result"];
60 [label="Enter when branch result"];
subgraph cluster_16 {
color=blue
61 [label="Enter block"];
62 [label="Function call: R|/A.A|()"];
63 [label="Assignmenet: R|<local>/x|"];
64 [label="Exit block"];
}
65 [label="Exit when branch result"];
66 [label="Exit when"];
}
67 [label="Access variable R|<local>/x|"];
68 [label="Access variable R|/A.s|"];
69 [label="Exit function test_1" style="filled" fillcolor=red];
}
46 -> {47};
47 -> {48};
48 -> {49};
49 -> {50};
50 -> {51};
51 -> {60 52};
52 -> {53};
53 -> {54};
54 -> {55};
55 -> {56};
56 -> {57};
57 -> {58};
58 -> {59};
59 -> {66};
60 -> {61};
61 -> {62};
62 -> {63};
63 -> {64};
64 -> {65};
65 -> {66};
66 -> {67};
67 -> {68};
68 -> {69};
subgraph cluster_17 {
color=red
70 [label="Enter function test_2" style="filled" fillcolor=red];
71 [label="Variable declaration: lval x: R|kotlin/Any|"];
subgraph cluster_18 {
color=blue
72 [label="Enter when"];
subgraph cluster_19 {
color=blue
73 [label="Enter when branch condition "];
74 [label="Access variable R|<local>/b|"];
75 [label="Exit when branch condition"];
}
subgraph cluster_20 {
color=blue
76 [label="Enter when branch condition else"];
77 [label="Exit when branch condition"];
}
78 [label="Enter when branch result"];
subgraph cluster_21 {
color=blue
79 [label="Enter block"];
80 [label="Access variable R|<local>/a|"];
81 [label="Assignmenet: R|<local>/x|"];
82 [label="Access variable R|<local>/a|"];
83 [label="Type operator: (R|<local>/a| as R|A|)"];
84 [label="Exit block"];
}
85 [label="Exit when branch result"];
86 [label="Enter when branch result"];
subgraph cluster_22 {
color=blue
87 [label="Enter block"];
88 [label="Function call: R|/A.A|()"];
89 [label="Assignmenet: R|<local>/x|"];
90 [label="Exit block"];
}
91 [label="Exit when branch result"];
92 [label="Exit when"];
}
93 [label="Access variable R|<local>/x|"];
94 [label="Access variable R|/A.s|"];
95 [label="Exit function test_2" style="filled" fillcolor=red];
}
70 -> {71};
71 -> {72};
72 -> {73};
73 -> {74};
74 -> {75};
75 -> {86 76};
76 -> {77};
77 -> {78};
78 -> {79};
79 -> {80};
80 -> {81};
81 -> {82};
82 -> {83};
83 -> {84};
84 -> {85};
85 -> {92};
86 -> {87};
87 -> {88};
88 -> {89};
89 -> {90};
90 -> {91};
91 -> {92};
92 -> {93};
93 -> {94};
94 -> {95};
subgraph cluster_23 {
color=red
96 [label="Enter function test_3" style="filled" fillcolor=red];
97 [label="Variable declaration: lval x: R|kotlin/Any|"];
subgraph cluster_24 {
color=blue
98 [label="Enter when"];
subgraph cluster_25 {
color=blue
99 [label="Enter when branch condition "];
100 [label="Access variable R|<local>/b|"];
101 [label="Exit when branch condition"];
}
subgraph cluster_26 {
color=blue
102 [label="Enter when branch condition else"];
103 [label="Exit when branch condition"];
}
104 [label="Enter when branch result"];
subgraph cluster_27 {
color=blue
105 [label="Enter block"];
106 [label="Access variable R|<local>/a|"];
107 [label="Type operator: (R|<local>/a| as R|A|)"];
108 [label="Access variable R|<local>/a|"];
109 [label="Assignmenet: R|<local>/x|"];
110 [label="Exit block"];
}
111 [label="Exit when branch result"];
112 [label="Enter when branch result"];
subgraph cluster_28 {
color=blue
113 [label="Enter block"];
114 [label="Function call: R|/A.A|()"];
115 [label="Assignmenet: R|<local>/x|"];
116 [label="Exit block"];
}
117 [label="Exit when branch result"];
118 [label="Exit when"];
}
119 [label="Access variable R|<local>/x|"];
120 [label="Access variable R|/A.s|"];
121 [label="Exit function test_3" style="filled" fillcolor=red];
}
96 -> {97};
97 -> {98};
98 -> {99};
99 -> {100};
100 -> {101};
101 -> {112 102};
102 -> {103};
103 -> {104};
104 -> {105};
105 -> {106};
106 -> {107};
107 -> {108};
108 -> {109};
109 -> {110};
110 -> {111};
111 -> {118};
112 -> {113};
113 -> {114};
114 -> {115};
115 -> {116};
116 -> {117};
117 -> {118};
118 -> {119};
119 -> {120};
120 -> {121};
subgraph cluster_29 {
color=red
122 [label="Enter function test_4" style="filled" fillcolor=red];
123 [label="Variable declaration: lval x: R|kotlin/Any|"];
subgraph cluster_30 {
color=blue
124 [label="Enter when"];
subgraph cluster_31 {
color=blue
125 [label="Enter when branch condition "];
126 [label="Access variable R|<local>/b|"];
127 [label="Exit when branch condition"];
}
subgraph cluster_32 {
color=blue
128 [label="Enter when branch condition else"];
129 [label="Exit when branch condition"];
}
130 [label="Enter when branch result"];
subgraph cluster_33 {
color=blue
131 [label="Enter block"];
132 [label="Access variable R|<local>/a|"];
133 [label="Assignmenet: R|<local>/x|"];
134 [label="Exit block"];
}
135 [label="Exit when branch result"];
136 [label="Enter when branch result"];
subgraph cluster_34 {
color=blue
137 [label="Enter block"];
138 [label="Access variable R|<local>/a|"];
139 [label="Assignmenet: R|<local>/x|"];
140 [label="Exit block"];
}
141 [label="Exit when branch result"];
142 [label="Exit when"];
}
143 [label="Access variable R|<local>/x|"];
144 [label="Type operator: (R|<local>/x| as R|A|)"];
145 [label="Access variable R|<local>/x|"];
146 [label="Access variable R|/A.s|"];
147 [label="Access variable R|<local>/a|"];
148 [label="Access variable R|/A.s|"];
149 [label="Exit function test_4" style="filled" fillcolor=red];
}
122 -> {123};
123 -> {124};
124 -> {125};
125 -> {126};
126 -> {127};
127 -> {136 128};
128 -> {129};
129 -> {130};
130 -> {131};
131 -> {132};
132 -> {133};
133 -> {134};
134 -> {135};
135 -> {142};
136 -> {137};
137 -> {138};
138 -> {139};
139 -> {140};
140 -> {141};
141 -> {142};
142 -> {143};
143 -> {144};
144 -> {145};
145 -> {146};
146 -> {147};
147 -> {148};
148 -> {149};
subgraph cluster_35 {
color=red
150 [label="Enter function test_5" style="filled" fillcolor=red];
151 [label="Variable declaration: lval x: R|kotlin/Any|"];
subgraph cluster_36 {
color=blue
152 [label="Enter when"];
subgraph cluster_37 {
color=blue
153 [label="Enter when branch condition "];
154 [label="Access variable R|<local>/b|"];
155 [label="Exit when branch condition"];
}
subgraph cluster_38 {
color=blue
156 [label="Enter when branch condition else"];
157 [label="Exit when branch condition"];
}
158 [label="Enter when branch result"];
subgraph cluster_39 {
color=blue
159 [label="Enter block"];
160 [label="Access variable R|<local>/a|"];
161 [label="Assignmenet: R|<local>/x|"];
162 [label="Exit block"];
}
163 [label="Exit when branch result"];
164 [label="Enter when branch result"];
subgraph cluster_40 {
color=blue
165 [label="Enter block"];
166 [label="Access variable R|<local>/a|"];
167 [label="Assignmenet: R|<local>/x|"];
168 [label="Exit block"];
}
169 [label="Exit when branch result"];
170 [label="Exit when"];
}
171 [label="Access variable R|<local>/a|"];
172 [label="Type operator: (R|<local>/a| as R|A|)"];
173 [label="Access variable R|<local>/x|"];
174 [label="Access variable R|/A.s|"];
175 [label="Access variable R|<local>/a|"];
176 [label="Access variable R|/A.s|"];
177 [label="Exit function test_5" style="filled" fillcolor=red];
}
150 -> {151};
151 -> {152};
152 -> {153};
153 -> {154};
154 -> {155};
155 -> {164 156};
156 -> {157};
157 -> {158};
158 -> {159};
159 -> {160};
160 -> {161};
161 -> {162};
162 -> {163};
163 -> {170};
164 -> {165};
165 -> {166};
166 -> {167};
167 -> {168};
168 -> {169};
169 -> {170};
170 -> {171};
171 -> {172};
172 -> {173};
173 -> {174};
174 -> {175};
175 -> {176};
176 -> {177};
subgraph cluster_41 {
color=red
178 [label="Enter function test_6" style="filled" fillcolor=red];
179 [label="Variable declaration: lval x: R|kotlin/Any|"];
180 [label="Access variable R|<local>/a|"];
181 [label="Assignmenet: R|<local>/x|"];
182 [label="Access variable R|<local>/x|"];
183 [label="Access variable R|/A.s|"];
184 [label="Exit function test_6" style="filled" fillcolor=red];
}
178 -> {179};
179 -> {180};
180 -> {181};
181 -> {182};
182 -> {183};
183 -> {184};
subgraph cluster_42 {
color=red
185 [label="Enter function test_7" style="filled" fillcolor=red];
186 [label="Const: Null(null)"];
187 [label="Variable declaration: lval z: R|kotlin/String?|"];
188 [label="Access variable R|<local>/z|"];
189 [label="Variable declaration: lvar y: R|kotlin/String?|"];
190 [label="Access variable R|<local>/y|"];
191 [label="Variable declaration: lval x: R|kotlin/String?|"];
subgraph cluster_43 {
color=blue
192 [label="Enter when"];
subgraph cluster_44 {
color=blue
193 [label="Enter when branch condition "];
194 [label="Access variable R|<local>/x|"];
195 [label="Const: Null(null)"];
196 [label="Operator !="];
197 [label="Exit when branch condition"];
}
198 [label="Synthetic else branch"];
199 [label="Enter when branch result"];
subgraph cluster_45 {
color=blue
200 [label="Enter block"];
201 [label="Access variable R|<local>/x|"];
202 [label="Access variable R|kotlin/String.length|"];
203 [label="Access variable R|<local>/y|"];
204 [label="Access variable R|kotlin/String.length|"];
205 [label="Access variable R|<local>/z|"];
206 [label="Access variable R|kotlin/String.length|"];
207 [label="Exit block"];
}
208 [label="Exit when branch result"];
209 [label="Exit when"];
}
subgraph cluster_46 {
color=blue
210 [label="Enter when"];
subgraph cluster_47 {
color=blue
211 [label="Enter when branch condition "];
212 [label="Access variable R|<local>/y|"];
213 [label="Const: Null(null)"];
214 [label="Operator !="];
215 [label="Exit when branch condition"];
}
216 [label="Synthetic else branch"];
217 [label="Enter when branch result"];
subgraph cluster_48 {
color=blue
218 [label="Enter block"];
219 [label="Access variable R|<local>/x|"];
220 [label="Access variable R|kotlin/String.length|"];
221 [label="Access variable R|<local>/y|"];
222 [label="Access variable R|kotlin/String.length|"];
223 [label="Access variable R|<local>/z|"];
224 [label="Access variable R|kotlin/String.length|"];
225 [label="Exit block"];
}
226 [label="Exit when branch result"];
227 [label="Exit when"];
}
subgraph cluster_49 {
color=blue
228 [label="Enter when"];
subgraph cluster_50 {
color=blue
229 [label="Enter when branch condition "];
230 [label="Access variable R|<local>/z|"];
231 [label="Const: Null(null)"];
232 [label="Operator !="];
233 [label="Exit when branch condition"];
}
234 [label="Synthetic else branch"];
235 [label="Enter when branch result"];
subgraph cluster_51 {
color=blue
236 [label="Enter block"];
237 [label="Access variable R|<local>/x|"];
238 [label="Access variable R|kotlin/String.length|"];
239 [label="Access variable R|<local>/y|"];
240 [label="Access variable R|kotlin/String.length|"];
241 [label="Access variable R|<local>/z|"];
242 [label="Access variable R|kotlin/String.length|"];
243 [label="Exit block"];
}
244 [label="Exit when branch result"];
245 [label="Exit when"];
}
246 [label="Const: Null(null)"];
247 [label="Assignmenet: R|<local>/y|"];
subgraph cluster_52 {
color=blue
248 [label="Enter when"];
subgraph cluster_53 {
color=blue
249 [label="Enter when branch condition "];
250 [label="Access variable R|<local>/x|"];
251 [label="Const: Null(null)"];
252 [label="Operator !="];
253 [label="Exit when branch condition"];
}
254 [label="Synthetic else branch"];
255 [label="Enter when branch result"];
subgraph cluster_54 {
color=blue
256 [label="Enter block"];
257 [label="Access variable R|<local>/x|"];
258 [label="Access variable R|kotlin/String.length|"];
259 [label="Access variable R|<local>/y|"];
260 [label="Access variable <Inapplicable(WRONG_RECEIVER): [kotlin/String.length]>#"];
261 [label="Access variable R|<local>/z|"];
262 [label="Access variable R|kotlin/String.length|"];
263 [label="Exit block"];
}
264 [label="Exit when branch result"];
265 [label="Exit when"];
}
subgraph cluster_55 {
color=blue
266 [label="Enter when"];
subgraph cluster_56 {
color=blue
267 [label="Enter when branch condition "];
268 [label="Access variable R|<local>/y|"];
269 [label="Const: Null(null)"];
270 [label="Operator !="];
271 [label="Exit when branch condition"];
}
272 [label="Synthetic else branch"];
273 [label="Enter when branch result"];
subgraph cluster_57 {
color=blue
274 [label="Enter block"];
275 [label="Access variable R|<local>/x|"];
276 [label="Access variable <Inapplicable(WRONG_RECEIVER): [kotlin/String.length]>#"];
277 [label="Access variable R|<local>/y|"];
278 [label="Access variable R|kotlin/String.length|"];
279 [label="Access variable R|<local>/z|"];
280 [label="Access variable <Inapplicable(WRONG_RECEIVER): [kotlin/String.length]>#"];
281 [label="Exit block"];
}
282 [label="Exit when branch result"];
283 [label="Exit when"];
}
subgraph cluster_58 {
color=blue
284 [label="Enter when"];
subgraph cluster_59 {
color=blue
285 [label="Enter when branch condition "];
286 [label="Access variable R|<local>/z|"];
287 [label="Const: Null(null)"];
288 [label="Operator !="];
289 [label="Exit when branch condition"];
}
290 [label="Synthetic else branch"];
291 [label="Enter when branch result"];
subgraph cluster_60 {
color=blue
292 [label="Enter block"];
293 [label="Access variable R|<local>/x|"];
294 [label="Access variable R|kotlin/String.length|"];
295 [label="Access variable R|<local>/y|"];
296 [label="Access variable <Inapplicable(WRONG_RECEIVER): [kotlin/String.length]>#"];
297 [label="Access variable R|<local>/z|"];
298 [label="Access variable R|kotlin/String.length|"];
299 [label="Exit block"];
}
300 [label="Exit when branch result"];
301 [label="Exit when"];
}
302 [label="Exit function test_7" style="filled" fillcolor=red];
}
185 -> {186};
186 -> {187};
187 -> {188};
188 -> {189};
189 -> {190};
190 -> {191};
191 -> {192};
192 -> {193};
193 -> {194};
194 -> {195};
195 -> {196};
196 -> {197};
197 -> {199 198};
198 -> {209};
199 -> {200};
200 -> {201};
201 -> {202};
202 -> {203};
203 -> {204};
204 -> {205};
205 -> {206};
206 -> {207};
207 -> {208};
208 -> {209};
209 -> {210};
210 -> {211};
211 -> {212};
212 -> {213};
213 -> {214};
214 -> {215};
215 -> {217 216};
216 -> {227};
217 -> {218};
218 -> {219};
219 -> {220};
220 -> {221};
221 -> {222};
222 -> {223};
223 -> {224};
224 -> {225};
225 -> {226};
226 -> {227};
227 -> {228};
228 -> {229};
229 -> {230};
230 -> {231};
231 -> {232};
232 -> {233};
233 -> {235 234};
234 -> {245};
235 -> {236};
236 -> {237};
237 -> {238};
238 -> {239};
239 -> {240};
240 -> {241};
241 -> {242};
242 -> {243};
243 -> {244};
244 -> {245};
245 -> {246};
246 -> {247};
247 -> {248};
248 -> {249};
249 -> {250};
250 -> {251};
251 -> {252};
252 -> {253};
253 -> {255 254};
254 -> {265};
255 -> {256};
256 -> {257};
257 -> {258};
258 -> {259};
259 -> {260};
260 -> {261};
261 -> {262};
262 -> {263};
263 -> {264};
264 -> {265};
265 -> {266};
266 -> {267};
267 -> {268};
268 -> {269};
269 -> {270};
270 -> {271};
271 -> {273 272};
272 -> {283};
273 -> {274};
274 -> {275};
275 -> {276};
276 -> {277};
277 -> {278};
278 -> {279};
279 -> {280};
280 -> {281};
281 -> {282};
282 -> {283};
283 -> {284};
284 -> {285};
285 -> {286};
286 -> {287};
287 -> {288};
288 -> {289};
289 -> {291 290};
290 -> {301};
291 -> {292};
292 -> {293};
293 -> {294};
294 -> {295};
295 -> {296};
296 -> {297};
297 -> {298};
298 -> {299};
299 -> {300};
300 -> {301};
301 -> {302};
}
@@ -0,0 +1,121 @@
// !DUMP_CFG
class A {
val s: String = ""
}
fun test_0(list: List<A>) {
var goodA: A? = null
for (a in list) {
if (goodA == null) {
goodA = a
continue
}
goodA.s
}
}
fun test_1(a: A, b: Boolean) {
val x: Any
if (b) {
x = A()
} else {
x = a
}
x.s
}
fun test_2(a: Any, b: Boolean) {
val x: Any
if (b) {
//x1
x = A()
} else {
//x2 = a
x = a
a as A
}
x.s
}
fun test_3(a: Any, b: Boolean) {
val x: Any
if (b) {
x = A()
} else {
a as A
x = a
}
x.s
}
fun test_4(a: Any, b: Boolean) {
val x: Any
if (b) {
x = a
} else {
x = a
}
x as A
x.s
a.s
}
fun test_5(a: Any, b: Boolean) {
val x: Any
if (b) {
x = a
} else {
x = a
}
a as A
x.s
a.s
}
fun test_6(a: A) {
val x: Any
x = a
x.s
}
fun test_7() {
val z: String? = null
var y : String? = z
val x: String? = y
if (x != null) {
x.length // OK
y.length // OK
z.length // OK
}
if (y != null) {
x.length // OK
y.length // OK
z.length // OK
}
if (z != null) {
x.length // OK
y.length // OK
z.length // OK
}
y = null
if (x != null) {
x.length // OK
y.<!INAPPLICABLE_CANDIDATE!>length<!> // Bad
z.length // OK
}
if (y != null) {
x.<!INAPPLICABLE_CANDIDATE!>length<!> // Bad
y.length // OK
z.<!INAPPLICABLE_CANDIDATE!>length<!> // Bad
}
if (z != null) {
x.length // OK
y.<!INAPPLICABLE_CANDIDATE!>length<!> // Bad
z.length // OK
}
}
@@ -0,0 +1,156 @@
FILE: boundSmartcastsInBranches.kt
public final class A : R|kotlin/Any| {
public constructor(): R|A| {
super<R|kotlin/Any|>()
}
public final val s: R|kotlin/String| = String()
public get(): R|kotlin/String|
}
public final fun test_0(list: R|kotlin/collections/List<A>|): R|kotlin/Unit| {
lvar goodA: R|A?| = Null(null)
lval <iterator>: R|kotlin/collections/Iterator<A>| = R|<local>/list|.R|FakeOverride<kotlin/collections/List.iterator: R|kotlin/collections/Iterator<A>|>|()
while(R|<local>/<iterator>|.R|kotlin/collections/Iterator.hasNext|()) {
lval a: R|A| = R|<local>/<iterator>|.R|FakeOverride<kotlin/collections/Iterator.next: R|A|>|()
when () {
==(R|<local>/goodA|, Null(null)) -> {
R|<local>/goodA| = R|<local>/a|
continue@@@[R|<local>/<iterator>|.R|kotlin/collections/Iterator.hasNext|()]
}
}
R|<local>/goodA|.R|/A.s|
}
}
public final fun test_1(a: R|A|, b: R|kotlin/Boolean|): R|kotlin/Unit| {
lval x: R|kotlin/Any|
when () {
R|<local>/b| -> {
R|<local>/x| = R|/A.A|()
}
else -> {
R|<local>/x| = R|<local>/a|
}
}
R|<local>/x|.R|/A.s|
}
public final fun test_2(a: R|kotlin/Any|, b: R|kotlin/Boolean|): R|kotlin/Unit| {
lval x: R|kotlin/Any|
when () {
R|<local>/b| -> {
R|<local>/x| = R|/A.A|()
}
else -> {
R|<local>/x| = R|<local>/a|
(R|<local>/a| as R|A|)
}
}
R|<local>/x|.R|/A.s|
}
public final fun test_3(a: R|kotlin/Any|, b: R|kotlin/Boolean|): R|kotlin/Unit| {
lval x: R|kotlin/Any|
when () {
R|<local>/b| -> {
R|<local>/x| = R|/A.A|()
}
else -> {
(R|<local>/a| as R|A|)
R|<local>/x| = R|<local>/a|
}
}
R|<local>/x|.R|/A.s|
}
public final fun test_4(a: R|kotlin/Any|, b: R|kotlin/Boolean|): R|kotlin/Unit| {
lval x: R|kotlin/Any|
when () {
R|<local>/b| -> {
R|<local>/x| = R|<local>/a|
}
else -> {
R|<local>/x| = R|<local>/a|
}
}
(R|<local>/x| as R|A|)
R|<local>/x|.R|/A.s|
R|<local>/a|.R|/A.s|
}
public final fun test_5(a: R|kotlin/Any|, b: R|kotlin/Boolean|): R|kotlin/Unit| {
lval x: R|kotlin/Any|
when () {
R|<local>/b| -> {
R|<local>/x| = R|<local>/a|
}
else -> {
R|<local>/x| = R|<local>/a|
}
}
(R|<local>/a| as R|A|)
R|<local>/x|.R|/A.s|
R|<local>/a|.R|/A.s|
}
public final fun test_6(a: R|A|): R|kotlin/Unit| {
lval x: R|kotlin/Any|
R|<local>/x| = R|<local>/a|
R|<local>/x|.R|/A.s|
}
public final fun test_7(): R|kotlin/Unit| {
lval z: R|kotlin/String?| = Null(null)
lvar y: R|kotlin/String?| = R|<local>/z|
lval x: R|kotlin/String?| = R|<local>/y|
when () {
!=(R|<local>/x|, Null(null)) -> {
R|<local>/x|.R|kotlin/String.length|
R|<local>/y|.R|kotlin/String.length|
R|<local>/z|.R|kotlin/String.length|
}
}
when () {
!=(R|<local>/y|, Null(null)) -> {
R|<local>/x|.R|kotlin/String.length|
R|<local>/y|.R|kotlin/String.length|
R|<local>/z|.R|kotlin/String.length|
}
}
when () {
!=(R|<local>/z|, Null(null)) -> {
R|<local>/x|.R|kotlin/String.length|
R|<local>/y|.R|kotlin/String.length|
R|<local>/z|.R|kotlin/String.length|
}
}
R|<local>/y| = Null(null)
when () {
!=(R|<local>/x|, Null(null)) -> {
R|<local>/x|.R|kotlin/String.length|
R|<local>/y|.<Inapplicable(WRONG_RECEIVER): [kotlin/String.length]>#
R|<local>/z|.R|kotlin/String.length|
}
}
when () {
!=(R|<local>/y|, Null(null)) -> {
R|<local>/x|.<Inapplicable(WRONG_RECEIVER): [kotlin/String.length]>#
R|<local>/y|.R|kotlin/String.length|
R|<local>/z|.<Inapplicable(WRONG_RECEIVER): [kotlin/String.length]>#
}
}
when () {
!=(R|<local>/z|, Null(null)) -> {
R|<local>/x|.R|kotlin/String.length|
R|<local>/y|.<Inapplicable(WRONG_RECEIVER): [kotlin/String.length]>#
R|<local>/z|.R|kotlin/String.length|
}
}
}
@@ -0,0 +1,143 @@
digraph functionCallBound_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|Base|>()"];
5 [label="Exit function <init>" style="filled" fillcolor=red];
}
3 -> {4};
4 -> {5};
subgraph cluster_2 {
color=red
6 [label="Enter function getter" style="filled" fillcolor=red];
7 [label="Exit function getter" style="filled" fillcolor=red];
}
6 -> {7};
subgraph cluster_3 {
color=red
8 [label="Enter property" style="filled" fillcolor=red];
9 [label="Access variable R|<local>/data|"];
10 [label="Exit property" style="filled" fillcolor=red];
}
8 -> {9};
9 -> {10};
subgraph cluster_4 {
color=red
11 [label="Enter function isOk" style="filled" fillcolor=red];
12 [label="Const: Boolean(true)"];
13 [label="Jump: ^isOk Boolean(true)"];
14 [label="Stub" style="filled" fillcolor=gray];
15 [label="Exit function isOk" style="filled" fillcolor=red];
}
11 -> {12};
12 -> {13};
13 -> {15};
13 -> {14} [style=dotted];
14 -> {15} [style=dotted];
subgraph cluster_5 {
color=red
16 [label="Enter function check" style="filled" fillcolor=red];
subgraph cluster_6 {
color=blue
17 [label="Enter when"];
subgraph cluster_7 {
color=blue
18 [label="Enter when branch condition "];
19 [label="Access variable R|<local>/base|"];
20 [label="Type operator: (R|<local>/base| as? R|Sub|)"];
21 [label="Enter safe call"];
22 [label="Function call: (R|<local>/base| as? R|Sub|)?.R|/isOk|()"];
23 [label="Exit safe call"];
24 [label="Const: Boolean(true)"];
25 [label="Operator =="];
26 [label="Exit when branch condition"];
}
subgraph cluster_8 {
color=blue
27 [label="Enter when branch condition else"];
28 [label="Exit when branch condition"];
}
29 [label="Enter when branch result"];
subgraph cluster_9 {
color=blue
30 [label="Enter block"];
31 [label="Access variable R|<local>/base|"];
32 [label="Exit block"];
}
33 [label="Exit when branch result"];
34 [label="Enter when branch result"];
subgraph cluster_10 {
color=blue
35 [label="Enter block"];
36 [label="Access variable R|<local>/base|"];
37 [label="Access variable R|/Sub.data|"];
38 [label="Exit block"];
}
39 [label="Exit when branch result"];
40 [label="Exit when"];
}
41 [label="Jump: ^check when () {
==((R|<local>/base| as? R|Sub|)?.R|/isOk|(), Boolean(true)) -> {
R|<local>/base|.R|/Sub.data|
}
else -> {
R|<local>/base|
}
}
"];
42 [label="Stub" style="filled" fillcolor=gray];
43 [label="Exit function check" style="filled" fillcolor=red];
}
16 -> {17};
17 -> {18};
18 -> {19};
19 -> {20};
20 -> {21 23};
21 -> {22};
22 -> {23};
23 -> {24};
24 -> {25};
25 -> {26};
26 -> {34 27};
27 -> {28};
28 -> {29};
29 -> {30};
30 -> {31};
31 -> {32};
32 -> {33};
33 -> {40};
34 -> {35};
35 -> {36};
36 -> {37};
37 -> {38};
38 -> {39};
39 -> {40};
40 -> {41};
41 -> {43};
41 -> {42} [style=dotted];
42 -> {43} [style=dotted];
}
@@ -0,0 +1,18 @@
// !DUMP_CFG
open class Base
class Sub(val data: Base): Base()
fun Sub.isOk() = true
fun check(base: Base): Base =
when {
(base as? Sub)?.isOk() == true -> {
base.data
}
else -> {
base
}
}
@@ -0,0 +1,30 @@
FILE: functionCallBound.kt
public open class Base : R|kotlin/Any| {
public constructor(): R|Base| {
super<R|kotlin/Any|>()
}
}
public final class Sub : R|Base| {
public constructor(data: R|Base|): R|Sub| {
super<R|Base|>()
}
public final val data: R|Base| = R|<local>/data|
public get(): R|Base|
}
public final fun R|Sub|.isOk(): R|kotlin/Boolean| {
^isOk Boolean(true)
}
public final fun check(base: R|Base|): R|Base| {
^check when () {
==((R|<local>/base| as? R|Sub|)?.R|/isOk|(), Boolean(true)) -> {
R|<local>/base|.R|/Sub.data|
}
else -> {
R|<local>/base|
}
}
}