[FIR-TEST] Move analysis tests to separate module
This commit is contained in:
+183
@@ -0,0 +1,183 @@
|
||||
digraph inPlaceLambdas_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];
|
||||
subgraph cluster_3 {
|
||||
color=blue
|
||||
5 [label="Enter when"];
|
||||
subgraph cluster_4 {
|
||||
color=blue
|
||||
6 [label="Enter when branch condition "];
|
||||
7 [label="Access variable R|<local>/x|"];
|
||||
8 [label="Type operator: (R|<local>/x| is R|A|)"];
|
||||
9 [label="Exit when branch condition"];
|
||||
}
|
||||
10 [label="Synthetic else branch"];
|
||||
11 [label="Enter when branch result"];
|
||||
subgraph cluster_5 {
|
||||
color=blue
|
||||
12 [label="Enter block"];
|
||||
13 [label="Postponed enter to lambda"];
|
||||
subgraph cluster_6 {
|
||||
color=blue
|
||||
14 [label="Enter function anonymousFunction"];
|
||||
15 [label="Access variable R|<local>/x|"];
|
||||
16 [label="Function call: R|<local>/x|.R|/A.foo|()"];
|
||||
17 [label="Exit function anonymousFunction"];
|
||||
}
|
||||
18 [label="Call arguments union" style="filled" fillcolor=yellow];
|
||||
19 [label="Postponed exit from lambda"];
|
||||
20 [label="Function call: R|kotlin/run|<R|kotlin/Unit|>(...)"];
|
||||
21 [label="Exit block"];
|
||||
}
|
||||
22 [label="Exit when branch result"];
|
||||
23 [label="Exit when"];
|
||||
}
|
||||
24 [label="Exit function test_1" style="filled" fillcolor=red];
|
||||
}
|
||||
|
||||
4 -> {5};
|
||||
5 -> {6};
|
||||
6 -> {7};
|
||||
7 -> {8};
|
||||
8 -> {9};
|
||||
9 -> {11 10};
|
||||
10 -> {23};
|
||||
11 -> {12};
|
||||
12 -> {13};
|
||||
13 -> {14};
|
||||
13 -> {19} [color=red];
|
||||
14 -> {15};
|
||||
15 -> {16};
|
||||
16 -> {17};
|
||||
17 -> {19} [color=green];
|
||||
17 -> {18} [color=red];
|
||||
18 -> {20} [color=red];
|
||||
19 -> {20} [color=green];
|
||||
20 -> {21};
|
||||
21 -> {22};
|
||||
22 -> {23};
|
||||
23 -> {24};
|
||||
|
||||
subgraph cluster_7 {
|
||||
color=red
|
||||
25 [label="Enter function test_2" style="filled" fillcolor=red];
|
||||
26 [label="Postponed enter to lambda"];
|
||||
subgraph cluster_8 {
|
||||
color=blue
|
||||
27 [label="Enter function anonymousFunction"];
|
||||
28 [label="Access variable R|<local>/x|"];
|
||||
29 [label="Type operator: (R|<local>/x| as R|B|)"];
|
||||
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|B|>(...)"];
|
||||
34 [label="Access variable R|<local>/x|"];
|
||||
35 [label="Function call: R|<local>/x|.R|/B.bar|()"];
|
||||
36 [label="Exit function test_2" 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_9 {
|
||||
color=red
|
||||
37 [label="Enter function test_3" style="filled" fillcolor=red];
|
||||
subgraph cluster_10 {
|
||||
color=blue
|
||||
38 [label="Enter when"];
|
||||
subgraph cluster_11 {
|
||||
color=blue
|
||||
39 [label="Enter when branch condition "];
|
||||
40 [label="Access variable R|<local>/x|"];
|
||||
41 [label="Type operator: (R|<local>/x| is R|A|)"];
|
||||
42 [label="Exit when branch condition"];
|
||||
}
|
||||
43 [label="Synthetic else branch"];
|
||||
44 [label="Enter when branch result"];
|
||||
subgraph cluster_12 {
|
||||
color=blue
|
||||
45 [label="Enter block"];
|
||||
46 [label="Postponed enter to lambda"];
|
||||
subgraph cluster_13 {
|
||||
color=blue
|
||||
47 [label="Enter function anonymousFunction"];
|
||||
48 [label="Access variable R|<local>/x|"];
|
||||
49 [label="Function call: R|<local>/x|.R|/A.foo|()"];
|
||||
50 [label="Access variable R|<local>/x|"];
|
||||
51 [label="Type operator: (R|<local>/x| as R|B|)"];
|
||||
52 [label="Exit function anonymousFunction"];
|
||||
}
|
||||
53 [label="Call arguments union" style="filled" fillcolor=yellow];
|
||||
54 [label="Postponed exit from lambda"];
|
||||
55 [label="Function call: R|kotlin/run|<R|B|>(...)"];
|
||||
56 [label="Access variable R|<local>/x|"];
|
||||
57 [label="Function call: R|<local>/x|.R|/B.bar|()"];
|
||||
58 [label="Exit block"];
|
||||
}
|
||||
59 [label="Exit when branch result"];
|
||||
60 [label="Exit when"];
|
||||
}
|
||||
61 [label="Exit function test_3" style="filled" fillcolor=red];
|
||||
}
|
||||
|
||||
37 -> {38};
|
||||
38 -> {39};
|
||||
39 -> {40};
|
||||
40 -> {41};
|
||||
41 -> {42};
|
||||
42 -> {44 43};
|
||||
43 -> {60};
|
||||
44 -> {45};
|
||||
45 -> {46};
|
||||
46 -> {47};
|
||||
46 -> {54} [color=red];
|
||||
47 -> {48};
|
||||
48 -> {49};
|
||||
49 -> {50};
|
||||
50 -> {51};
|
||||
51 -> {52};
|
||||
52 -> {54} [color=green];
|
||||
52 -> {53} [color=red];
|
||||
53 -> {55} [color=red];
|
||||
54 -> {55} [color=green];
|
||||
55 -> {56};
|
||||
56 -> {57};
|
||||
57 -> {58};
|
||||
58 -> {59};
|
||||
59 -> {60};
|
||||
60 -> {61};
|
||||
|
||||
}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
// !DUMP_CFG
|
||||
interface A {
|
||||
fun foo()
|
||||
}
|
||||
|
||||
interface B {
|
||||
fun bar()
|
||||
}
|
||||
|
||||
fun test_1(x: Any?) {
|
||||
if (x is A) {
|
||||
run {
|
||||
x.foo()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun test_2(x: Any?) {
|
||||
run {
|
||||
x as B
|
||||
}
|
||||
x.bar()
|
||||
}
|
||||
|
||||
fun test_3(x: Any?) {
|
||||
if (x is A) {
|
||||
run {
|
||||
x.foo()
|
||||
x as B
|
||||
}
|
||||
x.bar()
|
||||
}
|
||||
}
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
FILE: inPlaceLambdas.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| {
|
||||
when () {
|
||||
(R|<local>/x| is R|A|) -> {
|
||||
R|kotlin/run|<R|kotlin/Unit|>(<L> = run@fun <anonymous>(): R|kotlin/Unit| <kind=EXACTLY_ONCE> {
|
||||
R|<local>/x|.R|/A.foo|()
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
public final fun test_2(x: R|kotlin/Any?|): R|kotlin/Unit| {
|
||||
R|kotlin/run|<R|B|>(<L> = run@fun <anonymous>(): R|B| <kind=EXACTLY_ONCE> {
|
||||
^ (R|<local>/x| as R|B|)
|
||||
}
|
||||
)
|
||||
R|<local>/x|.R|/B.bar|()
|
||||
}
|
||||
public final fun test_3(x: R|kotlin/Any?|): R|kotlin/Unit| {
|
||||
when () {
|
||||
(R|<local>/x| is R|A|) -> {
|
||||
R|kotlin/run|<R|B|>(<L> = run@fun <anonymous>(): R|B| <kind=EXACTLY_ONCE> {
|
||||
R|<local>/x|.R|/A.foo|()
|
||||
^ (R|<local>/x| as R|B|)
|
||||
}
|
||||
)
|
||||
R|<local>/x|.R|/B.bar|()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
digraph smartcastOnLambda_kt {
|
||||
graph [nodesep=3]
|
||||
node [shape=box penwidth=2]
|
||||
edge [penwidth=2]
|
||||
|
||||
subgraph cluster_0 {
|
||||
color=red
|
||||
0 [label="Enter function test" 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>/func|"];
|
||||
4 [label="Const: Null(null)"];
|
||||
5 [label="Operator !="];
|
||||
6 [label="Exit when branch condition"];
|
||||
}
|
||||
7 [label="Synthetic else branch"];
|
||||
8 [label="Enter when branch result"];
|
||||
subgraph cluster_3 {
|
||||
color=blue
|
||||
9 [label="Enter block"];
|
||||
10 [label="Function call: R|<local>/func|.R|FakeOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()"];
|
||||
11 [label="Exit block"];
|
||||
}
|
||||
12 [label="Exit when branch result"];
|
||||
13 [label="Exit when"];
|
||||
}
|
||||
14 [label="Exit function test" style="filled" fillcolor=red];
|
||||
}
|
||||
|
||||
0 -> {1};
|
||||
1 -> {2};
|
||||
2 -> {3};
|
||||
3 -> {4};
|
||||
4 -> {5};
|
||||
5 -> {6};
|
||||
6 -> {8 7};
|
||||
7 -> {13};
|
||||
8 -> {9};
|
||||
9 -> {10};
|
||||
10 -> {11};
|
||||
11 -> {12};
|
||||
12 -> {13};
|
||||
13 -> {14};
|
||||
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
// !DUMP_CFG
|
||||
fun test(func: (() -> Unit)?) {
|
||||
if (func != null) {
|
||||
func()
|
||||
}
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
FILE: smartcastOnLambda.kt
|
||||
public final fun test(func: R|() -> kotlin/Unit|): R|kotlin/Unit| {
|
||||
when () {
|
||||
!=(R|<local>/func|, Null(null)) -> {
|
||||
R|<local>/func|.R|FakeOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user