[FIR-TEST] Move analysis tests to separate module
This commit is contained in:
+95
@@ -0,0 +1,95 @@
|
||||
digraph delayedAssignment_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 foo" style="filled" fillcolor=red];
|
||||
4 [label="Exit function foo" style="filled" fillcolor=red];
|
||||
}
|
||||
|
||||
3 -> {4};
|
||||
|
||||
subgraph cluster_2 {
|
||||
color=red
|
||||
5 [label="Enter function test" style="filled" fillcolor=red];
|
||||
6 [label="Variable declaration: lval a: R|A?|"];
|
||||
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>/b|"];
|
||||
10 [label="Exit when branch condition"];
|
||||
}
|
||||
subgraph cluster_5 {
|
||||
color=blue
|
||||
11 [label="Enter when branch condition else"];
|
||||
12 [label="Exit when branch condition"];
|
||||
}
|
||||
13 [label="Enter when branch result"];
|
||||
subgraph cluster_6 {
|
||||
color=blue
|
||||
14 [label="Enter block"];
|
||||
15 [label="Const: Null(null)"];
|
||||
16 [label="Assignmenet: R|<local>/a|"];
|
||||
17 [label="Exit block"];
|
||||
}
|
||||
18 [label="Exit when branch result"];
|
||||
19 [label="Enter when branch result"];
|
||||
subgraph cluster_7 {
|
||||
color=blue
|
||||
20 [label="Enter block"];
|
||||
21 [label="Function call: R|/A.A|()"];
|
||||
22 [label="Assignmenet: R|<local>/a|"];
|
||||
23 [label="Access variable R|<local>/a|"];
|
||||
24 [label="Function call: R|<local>/a|.R|/A.foo|()"];
|
||||
25 [label="Exit block"];
|
||||
}
|
||||
26 [label="Exit when branch result"];
|
||||
27 [label="Exit when"];
|
||||
}
|
||||
28 [label="Access variable R|<local>/a|"];
|
||||
29 [label="Function call: R|<local>/a|.<Inapplicable(WRONG_RECEIVER): [/A.foo]>#()"];
|
||||
30 [label="Exit function test" style="filled" fillcolor=red];
|
||||
}
|
||||
|
||||
5 -> {6};
|
||||
6 -> {7};
|
||||
7 -> {8};
|
||||
8 -> {9};
|
||||
9 -> {10};
|
||||
10 -> {19 11};
|
||||
11 -> {12};
|
||||
12 -> {13};
|
||||
13 -> {14};
|
||||
14 -> {15};
|
||||
15 -> {16};
|
||||
16 -> {17};
|
||||
17 -> {18};
|
||||
18 -> {27};
|
||||
19 -> {20};
|
||||
20 -> {21};
|
||||
21 -> {22};
|
||||
22 -> {23};
|
||||
23 -> {24};
|
||||
24 -> {25};
|
||||
25 -> {26};
|
||||
26 -> {27};
|
||||
27 -> {28};
|
||||
28 -> {29};
|
||||
29 -> {30};
|
||||
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
// !DUMP_CFG
|
||||
class A {
|
||||
fun foo() {}
|
||||
}
|
||||
|
||||
fun test(b: Boolean) {
|
||||
val a: A?
|
||||
if (b) {
|
||||
a = A()
|
||||
a.foo()
|
||||
} else {
|
||||
a = null
|
||||
}
|
||||
a.<!INAPPLICABLE_CANDIDATE!>foo<!>()
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
FILE: delayedAssignment.kt
|
||||
public final class A : R|kotlin/Any| {
|
||||
public constructor(): R|A| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public final fun foo(): R|kotlin/Unit| {
|
||||
}
|
||||
|
||||
}
|
||||
public final fun test(b: R|kotlin/Boolean|): R|kotlin/Unit| {
|
||||
lval a: R|A?|
|
||||
when () {
|
||||
R|<local>/b| -> {
|
||||
R|<local>/a| = R|/A.A|()
|
||||
R|<local>/a|.R|/A.foo|()
|
||||
}
|
||||
else -> {
|
||||
R|<local>/a| = Null(null)
|
||||
}
|
||||
}
|
||||
|
||||
R|<local>/a|.<Inapplicable(WRONG_RECEIVER): [/A.foo]>#()
|
||||
}
|
||||
Vendored
+107
@@ -0,0 +1,107 @@
|
||||
digraph smartcastAfterReassignment_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];
|
||||
1 [label="Const: Int(1)"];
|
||||
2 [label="Variable declaration: lvar x: R|kotlin/Any|"];
|
||||
3 [label="Const: String()"];
|
||||
4 [label="Assignmenet: R|<local>/x|"];
|
||||
5 [label="Access variable R|<local>/x|"];
|
||||
6 [label="Access variable R|kotlin/String.length|"];
|
||||
7 [label="Exit function test_1" style="filled" fillcolor=red];
|
||||
}
|
||||
|
||||
0 -> {1};
|
||||
1 -> {2};
|
||||
2 -> {3};
|
||||
3 -> {4};
|
||||
4 -> {5};
|
||||
5 -> {6};
|
||||
6 -> {7};
|
||||
|
||||
subgraph cluster_1 {
|
||||
color=red
|
||||
8 [label="Enter function test_2" style="filled" fillcolor=red];
|
||||
9 [label="Const: Null(null)"];
|
||||
10 [label="Variable declaration: lvar x: R|kotlin/String?|"];
|
||||
subgraph cluster_2 {
|
||||
color=blue
|
||||
11 [label="Enter when"];
|
||||
subgraph cluster_3 {
|
||||
color=blue
|
||||
12 [label="Enter when branch condition "];
|
||||
13 [label="Access variable R|<local>/x|"];
|
||||
14 [label="Const: Null(null)"];
|
||||
15 [label="Operator =="];
|
||||
16 [label="Exit when branch condition"];
|
||||
}
|
||||
17 [label="Synthetic else branch"];
|
||||
18 [label="Enter when branch result"];
|
||||
subgraph cluster_4 {
|
||||
color=blue
|
||||
19 [label="Enter block"];
|
||||
20 [label="Const: String()"];
|
||||
21 [label="Assignmenet: R|<local>/x|"];
|
||||
22 [label="Exit block"];
|
||||
}
|
||||
23 [label="Exit when branch result"];
|
||||
24 [label="Exit when"];
|
||||
}
|
||||
25 [label="Access variable R|<local>/x|"];
|
||||
26 [label="Access variable R|kotlin/String.length|"];
|
||||
27 [label="Exit function test_2" style="filled" fillcolor=red];
|
||||
}
|
||||
|
||||
8 -> {9};
|
||||
9 -> {10};
|
||||
10 -> {11};
|
||||
11 -> {12};
|
||||
12 -> {13};
|
||||
13 -> {14};
|
||||
14 -> {15};
|
||||
15 -> {16};
|
||||
16 -> {18 17};
|
||||
17 -> {24};
|
||||
18 -> {19};
|
||||
19 -> {20};
|
||||
20 -> {21};
|
||||
21 -> {22};
|
||||
22 -> {23};
|
||||
23 -> {24};
|
||||
24 -> {25};
|
||||
25 -> {26};
|
||||
26 -> {27};
|
||||
|
||||
subgraph cluster_5 {
|
||||
color=red
|
||||
28 [label="Enter function test_3" style="filled" fillcolor=red];
|
||||
29 [label="Const: Null(null)"];
|
||||
30 [label="Variable declaration: lvar x: R|kotlin/String?|"];
|
||||
31 [label="Const: String()"];
|
||||
32 [label="Assignmenet: R|<local>/x|"];
|
||||
33 [label="Access variable R|<local>/x|"];
|
||||
34 [label="Access variable R|kotlin/String.length|"];
|
||||
35 [label="Const: Null(null)"];
|
||||
36 [label="Assignmenet: R|<local>/x|"];
|
||||
37 [label="Access variable R|<local>/x|"];
|
||||
38 [label="Access variable <Inapplicable(WRONG_RECEIVER): [kotlin/String.length]>#"];
|
||||
39 [label="Exit function test_3" style="filled" fillcolor=red];
|
||||
}
|
||||
|
||||
28 -> {29};
|
||||
29 -> {30};
|
||||
30 -> {31};
|
||||
31 -> {32};
|
||||
32 -> {33};
|
||||
33 -> {34};
|
||||
34 -> {35};
|
||||
35 -> {36};
|
||||
36 -> {37};
|
||||
37 -> {38};
|
||||
38 -> {39};
|
||||
|
||||
}
|
||||
Vendored
+22
@@ -0,0 +1,22 @@
|
||||
// !DUMP_CFG
|
||||
fun test_1() {
|
||||
var x: Any = 1
|
||||
x = ""
|
||||
x.length
|
||||
}
|
||||
|
||||
fun test_2() {
|
||||
var x: String? = null
|
||||
if (x == null) {
|
||||
x = ""
|
||||
}
|
||||
x.length
|
||||
}
|
||||
|
||||
fun test_3() {
|
||||
var x: String? = null
|
||||
x = ""
|
||||
x.length
|
||||
x = null
|
||||
x.<!INAPPLICABLE_CANDIDATE!>length<!>
|
||||
}
|
||||
Vendored
+23
@@ -0,0 +1,23 @@
|
||||
FILE: smartcastAfterReassignment.kt
|
||||
public final fun test_1(): R|kotlin/Unit| {
|
||||
lvar x: R|kotlin/Any| = Int(1)
|
||||
R|<local>/x| = String()
|
||||
R|<local>/x|.R|kotlin/String.length|
|
||||
}
|
||||
public final fun test_2(): R|kotlin/Unit| {
|
||||
lvar x: R|kotlin/String?| = Null(null)
|
||||
when () {
|
||||
==(R|<local>/x|, Null(null)) -> {
|
||||
R|<local>/x| = String()
|
||||
}
|
||||
}
|
||||
|
||||
R|<local>/x|.R|kotlin/String.length|
|
||||
}
|
||||
public final fun test_3(): R|kotlin/Unit| {
|
||||
lvar x: R|kotlin/String?| = Null(null)
|
||||
R|<local>/x| = String()
|
||||
R|<local>/x|.R|kotlin/String.length|
|
||||
R|<local>/x| = Null(null)
|
||||
R|<local>/x|.<Inapplicable(WRONG_RECEIVER): [kotlin/String.length]>#
|
||||
}
|
||||
Reference in New Issue
Block a user