[FIR-TEST] Add !DUMP_CFG directive. Get rid of cfg diagnostic tests

This commit is contained in:
Dmitriy Novozhilov
2020-02-12 15:54:47 +03:00
parent f495c4e215
commit b71e4ebb3f
72 changed files with 1501 additions and 2007 deletions
@@ -1,3 +1,4 @@
// !DUMP_CFG
fun test_1(b1: Boolean, b2: Boolean) { fun test_1(b1: Boolean, b2: Boolean) {
if (b1 || b2) { if (b1 || b2) {
1 1
@@ -1,3 +1,4 @@
// !DUMP_CFG
fun test_1(b: Boolean) { fun test_1(b: Boolean) {
if (b || false) { if (b || false) {
1 1
+217 -368
View File
@@ -5,252 +5,101 @@ digraph complex_kt {
subgraph cluster_0 { subgraph cluster_0 {
color=red color=red
0 [label="Enter function fetchPluginReleaseDate" style="filled" fillcolor=red]; 0 [label="Enter function close" style="filled" fillcolor=red];
1 [label="Const: String(https://plugins.jetbrains.com/api/plugins/)"]; 1 [label="Exit function close" style="filled" fillcolor=red];
2 [label="Access variable R|<local>/pluginId|"];
3 [label="Access variable <Unresolved name: idString>#"];
4 [label="Function call: R|<local>/pluginId|.<Unresolved name: idString>#.R|kotlin/toString|()"];
5 [label="Const: String(/updates?version=)"];
6 [label="Access variable R|<local>/version|"];
7 [label="Function call: R|<local>/version|.R|kotlin/Any.toString|()"];
8 [label="Variable declaration: lval url: R|kotlin/String|"];
subgraph cluster_1 {
color=blue
9 [label="Try expression enter"];
subgraph cluster_2 {
color=blue
10 [label="Try main block enter"];
subgraph cluster_3 {
color=blue
11 [label="Enter block"];
12 [label="Access variable <Unresolved name: HttpRequests>#"];
13 [label="Access variable R|<local>/url|"];
14 [label="Access variable R|<local>/url|"];
15 [label="Access variable R|<local>/url|"];
16 [label="Function call: <Unresolved name: HttpRequests>#.<Unresolved name: request>#(R|<local>/url|)"];
17 [label="Postponed enter to lambda"];
18 [label="Postponed exit from lambda"];
19 [label="Function call: <Unresolved name: HttpRequests>#.<Unresolved name: request>#(R|<local>/url|).<Unresolved name: connect>#(<L> = connect@fun <anonymous>(): R|ERROR CLASS: Unresolved name: fromJson| {
^ <Unresolved name: GsonBuilder>#().<Unresolved name: create>#().<Unresolved name: fromJson>#(<Unresolved name: it>#.<Unresolved name: inputStream>#.<Ambiguity: reader, [kotlin/io/reader, kotlin/io/reader, kotlin/io/reader]>#(), <getClass>(Q|kotlin/Array|).R|kotlin/jvm/java|)
}
)"];
20 [label="Exit block"];
}
21 [label="Try main block exit"];
}
subgraph cluster_4 {
color=blue
22 [label="Catch enter"];
subgraph cluster_5 {
color=blue
23 [label="Enter block"];
24 [label="Const: String(Can't parse json response)"];
25 [label="Access variable R|<local>/syntaxException|"];
26 [label="Access variable R|<local>/syntaxException|"];
27 [label="Access variable R|<local>/syntaxException|"];
28 [label="Function call: <Unresolved name: ResponseParseException>#(String(Can't parse json response), R|<local>/syntaxException|)"];
29 [label="Throw: throw <Unresolved name: ResponseParseException>#(String(Can't parse json response), R|<local>/syntaxException|)"];
30 [label="Stub" style="filled" fillcolor=gray];
31 [label="Exit block" style="filled" fillcolor=gray];
}
32 [label="Catch exit" style="filled" fillcolor=gray];
}
subgraph cluster_6 {
color=blue
33 [label="Catch enter"];
subgraph cluster_7 {
color=blue
34 [label="Enter block"];
35 [label="Access variable R|<local>/ioException|"];
36 [label="Access variable R|<local>/ioException|"];
37 [label="Access variable R|<local>/ioException|"];
38 [label="Function call: <Unresolved name: IOException>#(R|<local>/ioException|)"];
39 [label="Throw: throw <Unresolved name: IOException>#(R|<local>/ioException|)"];
40 [label="Stub" style="filled" fillcolor=gray];
41 [label="Exit block" style="filled" fillcolor=gray];
}
42 [label="Catch exit" style="filled" fillcolor=gray];
}
43 [label="Try expression exit"];
}
44 [label="Variable declaration: lval pluginDTOs: R|kotlin/Array<ERROR CLASS: Symbol not found, for `PluginDTO`>|"];
45 [label="Exit function fetchPluginReleaseDate" style="filled" fillcolor=red];
}
subgraph cluster_8 {
color=blue
46 [label="Enter annotation"];
47 [label="Access variable <Unresolved name: IOException>#"];
48 [label="Access variable <Unresolved name: ResponseParseException>#"];
49 [label="Exit annotation"];
} }
0 -> {1}; 0 -> {1};
1 -> {2};
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}; 2 -> {3};
3 -> {4};
4 -> {5};
5 -> {6};
6 -> {7};
7 -> {8};
8 -> {9};
9 -> {10};
10 -> {45 33 22 11};
11 -> {12};
12 -> {13};
13 -> {14};
14 -> {15};
15 -> {16};
16 -> {17};
17 -> {18 18} [color=green];
18 -> {19};
19 -> {20};
20 -> {21};
21 -> {43};
22 -> {45 23};
23 -> {24};
24 -> {25};
25 -> {26};
26 -> {27};
27 -> {28};
28 -> {29};
29 -> {45};
29 -> {30} [style=dotted];
30 -> {31} [style=dotted];
31 -> {32} [style=dotted];
32 -> {43} [style=dotted];
33 -> {45 34};
34 -> {35};
35 -> {36};
36 -> {37};
37 -> {38};
38 -> {39};
39 -> {45};
39 -> {40} [style=dotted];
40 -> {41} [style=dotted];
41 -> {42} [style=dotted];
42 -> {43} [style=dotted];
43 -> {44};
44 -> {45};
45 -> {46};
46 -> {47};
47 -> {48};
48 -> {49};
subgraph cluster_9 { subgraph cluster_2 {
color=red color=red
50 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; 4 [label="Enter function closeFinally" style="filled" fillcolor=red];
51 [label="Function call: <Unresolved name: GsonBuilder>#()"]; subgraph cluster_3 {
52 [label="Function call: <Unresolved name: GsonBuilder>#().<Unresolved name: create>#()"];
53 [label="Access variable <Unresolved name: it>#"];
54 [label="Access variable <Unresolved name: inputStream>#"];
55 [label="Function call: <Unresolved name: it>#.<Unresolved name: inputStream>#.<Ambiguity: reader, [kotlin/io/reader, kotlin/io/reader, kotlin/io/reader]>#()"];
56 [label="Access variable R|kotlin/jvm/java|"];
57 [label="Access variable R|kotlin/jvm/java|"];
58 [label="Access variable R|kotlin/jvm/java|"];
59 [label="Function call: <Unresolved name: GsonBuilder>#().<Unresolved name: create>#().<Unresolved name: fromJson>#(<Unresolved name: it>#.<Unresolved name: inputStream>#.<Ambiguity: reader, [kotlin/io/reader, kotlin/io/reader, kotlin/io/reader]>#(), <getClass>(Q|kotlin/Array|).R|kotlin/jvm/java|)"];
60 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
}
50 -> {51};
51 -> {52};
52 -> {53};
53 -> {54};
54 -> {55};
55 -> {56};
56 -> {57};
57 -> {58};
58 -> {59};
59 -> {60};
subgraph cluster_10 {
color=red
61 [label="Enter function close" style="filled" fillcolor=red];
62 [label="Exit function close" style="filled" fillcolor=red];
}
61 -> {62};
subgraph cluster_11 {
color=red
63 [label="Enter function closeFinally" style="filled" fillcolor=red];
subgraph cluster_12 {
color=blue color=blue
64 [label="Enter when"]; 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|(R|<local>/closeException|)"];
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 { subgraph cluster_13 {
color=blue color=blue
65 [label="Enter when branch condition "]; 37 [label="Enter block"];
66 [label="Access variable this@R|/closeFinally|"]; 38 [label="Function call: this@R|/closeFinally|.R|/AutoCloseable.close|()"];
67 [label="Const: Null(null)"]; 39 [label="Exit block"];
68 [label="Operator =="];
69 [label="Exit when branch condition"];
} }
40 [label="Exit when branch result"];
41 [label="Enter when branch result"];
subgraph cluster_14 { subgraph cluster_14 {
color=blue color=blue
70 [label="Enter when branch condition "]; 42 [label="Enter block"];
71 [label="Access variable R|<local>/cause|"]; 43 [label="Exit block"];
72 [label="Const: Null(null)"];
73 [label="Operator =="];
74 [label="Exit when branch condition"];
} }
subgraph cluster_15 { 44 [label="Exit when branch result"];
color=blue 45 [label="Exit when"];
75 [label="Enter when branch condition else"];
76 [label="Exit when branch condition"];
}
77 [label="Enter when branch result"];
subgraph cluster_16 {
color=blue
78 [label="Enter block"];
subgraph cluster_17 {
color=blue
79 [label="Try expression enter"];
subgraph cluster_18 {
color=blue
80 [label="Try main block enter"];
subgraph cluster_19 {
color=blue
81 [label="Enter block"];
82 [label="Function call: this@R|/closeFinally|.R|/AutoCloseable.close|()"];
83 [label="Exit block"];
}
84 [label="Try main block exit"];
}
subgraph cluster_20 {
color=blue
85 [label="Catch enter"];
subgraph cluster_21 {
color=blue
86 [label="Enter block"];
87 [label="Access variable R|<local>/cause|"];
88 [label="Access variable R|<local>/closeException|"];
89 [label="Function call: R|<local>/cause|.R|kotlin/addSuppressed|(R|<local>/closeException|)"];
90 [label="Exit block"];
}
91 [label="Catch exit"];
}
92 [label="Try expression exit"];
}
93 [label="Exit block"];
}
94 [label="Exit when branch result"];
95 [label="Enter when branch result"];
subgraph cluster_22 {
color=blue
96 [label="Enter block"];
97 [label="Function call: this@R|/closeFinally|.R|/AutoCloseable.close|()"];
98 [label="Exit block"];
}
99 [label="Exit when branch result"];
100 [label="Enter when branch result"];
subgraph cluster_23 {
color=blue
101 [label="Enter block"];
102 [label="Exit block"];
}
103 [label="Exit when branch result"];
104 [label="Exit when"];
} }
105 [label="Jump: ^closeFinally when () { 46 [label="Jump: ^closeFinally when () {
==(this@R|/closeFinally|, Null(null)) -> { ==(this@R|/closeFinally|, Null(null)) -> {
} }
==(R|<local>/cause|, Null(null)) -> { ==(R|<local>/cause|, Null(null)) -> {
@@ -261,161 +110,161 @@ digraph complex_kt {
this@R|/closeFinally|.R|/AutoCloseable.close|() this@R|/closeFinally|.R|/AutoCloseable.close|()
} }
catch (closeException: R|kotlin/Throwable|) { catch (closeException: R|kotlin/Throwable|) {
R|<local>/cause|.R|kotlin/addSuppressed|(R|<local>/closeException|) R|<local>/cause|.R|/addSuppressed|(R|<local>/closeException|)
} }
} }
} }
"]; "];
106 [label="Stub" style="filled" fillcolor=gray]; 47 [label="Stub" style="filled" fillcolor=gray];
107 [label="Exit function closeFinally" style="filled" fillcolor=red]; 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="Variable declaration: lval <range>: R|kotlin/collections/List<*>|"];
52 [label="Access variable R|<local>/<range>|"];
53 [label="Function call: R|<local>/<range>|.R|FakeOverride<kotlin/collections/List.iterator: R|kotlin/collections/Iterator<kotlin/Any?>|>|()"];
54 [label="Variable declaration: lval <iterator>: R|kotlin/collections/Iterator<kotlin/Any?>|"];
subgraph cluster_16 {
color=blue
55 [label="Enter while loop"];
subgraph cluster_17 {
color=blue
56 [label="Enter loop condition"];
57 [label="Access variable R|<local>/<iterator>|"];
58 [label="Function call: R|<local>/<iterator>|.R|kotlin/collections/Iterator.hasNext|()"];
59 [label="Exit loop condition"];
}
subgraph cluster_18 {
color=blue
60 [label="Enter loop block"];
subgraph cluster_19 {
color=blue
61 [label="Enter block"];
62 [label="Access variable R|<local>/<iterator>|"];
63 [label="Function call: R|<local>/<iterator>|.R|FakeOverride<kotlin/collections/Iterator.next: R|kotlin/Any?|>|()"];
64 [label="Variable declaration: lval element: R|kotlin/Any?|"];
subgraph cluster_20 {
color=blue
65 [label="Enter when"];
subgraph cluster_21 {
color=blue
66 [label="Enter when branch condition "];
67 [label="Access variable R|<local>/element|"];
68 [label="Type operator: element is T"];
69 [label="Exit when branch condition"];
}
70 [label="Synthetic else branch"];
71 [label="Enter when branch result"];
subgraph cluster_22 {
color=blue
72 [label="Enter block"];
73 [label="Access variable R|<local>/element|"];
74 [label="Jump: ^firstIsInstanceOrNull R|<local>/element|"];
75 [label="Stub" style="filled" fillcolor=gray];
76 [label="Exit block" style="filled" fillcolor=gray];
}
77 [label="Exit when branch result" style="filled" fillcolor=gray];
78 [label="Exit when"];
}
79 [label="Exit block"];
}
80 [label="Exit loop block"];
}
81 [label="Exit whileloop"];
}
82 [label="Const: Null(null)"];
83 [label="Jump: ^firstIsInstanceOrNull Null(null)"];
84 [label="Stub" style="filled" fillcolor=gray];
85 [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 -> {58};
58 -> {59};
59 -> {81 60};
60 -> {61};
61 -> {62};
62 -> {63};
63 -> {64}; 63 -> {64};
64 -> {65}; 64 -> {65};
65 -> {66}; 65 -> {66};
66 -> {67}; 66 -> {67};
67 -> {68}; 67 -> {68};
68 -> {69}; 68 -> {69};
69 -> {100 70}; 69 -> {71 70};
70 -> {71}; 70 -> {78};
71 -> {72}; 71 -> {72};
72 -> {73}; 72 -> {73};
73 -> {74}; 73 -> {74};
74 -> {95 75}; 74 -> {85};
75 -> {76}; 74 -> {75} [style=dotted];
76 -> {77}; 75 -> {76} [style=dotted];
77 -> {78}; 76 -> {77} [style=dotted];
77 -> {78} [style=dotted];
78 -> {79}; 78 -> {79};
79 -> {80}; 79 -> {80};
80 -> {107 85 81}; 80 -> {56};
81 -> {82}; 81 -> {82};
82 -> {83}; 82 -> {83};
83 -> {84}; 83 -> {85};
84 -> {92}; 83 -> {84} [style=dotted];
85 -> {107 86}; 84 -> {85} [style=dotted];
86 -> {87};
87 -> {88};
88 -> {89};
89 -> {90};
90 -> {91};
91 -> {92};
92 -> {93};
93 -> {94};
94 -> {104};
95 -> {96};
96 -> {97};
97 -> {98};
98 -> {99};
99 -> {104};
100 -> {101};
101 -> {102};
102 -> {103};
103 -> {104};
104 -> {105};
105 -> {107};
105 -> {106} [style=dotted];
106 -> {107} [style=dotted];
subgraph cluster_24 {
color=red
108 [label="Enter function firstIsInstanceOrNull" style="filled" fillcolor=red];
109 [label="Access variable this@R|/firstIsInstanceOrNull|"];
110 [label="Variable declaration: lval <range>: R|kotlin/sequences/Sequence<*>|"];
111 [label="Access variable R|<local>/<range>|"];
112 [label="Function call: R|<local>/<range>|.R|FakeOverride<kotlin/sequences/Sequence.iterator: R|kotlin/collections/Iterator<kotlin/Any?>|>|()"];
113 [label="Variable declaration: lval <iterator>: R|kotlin/collections/Iterator<kotlin/Any?>|"];
subgraph cluster_25 {
color=blue
114 [label="Enter while loop"];
subgraph cluster_26 {
color=blue
115 [label="Enter loop condition"];
116 [label="Access variable R|<local>/<iterator>|"];
117 [label="Function call: R|<local>/<iterator>|.R|kotlin/collections/Iterator.hasNext|()"];
118 [label="Exit loop condition"];
}
subgraph cluster_27 {
color=blue
119 [label="Enter loop block"];
subgraph cluster_28 {
color=blue
120 [label="Enter block"];
121 [label="Access variable R|<local>/<iterator>|"];
122 [label="Function call: R|<local>/<iterator>|.R|FakeOverride<kotlin/collections/Iterator.next: R|kotlin/Any?|>|()"];
123 [label="Variable declaration: lval element: R|kotlin/Any?|"];
subgraph cluster_29 {
color=blue
124 [label="Enter when"];
subgraph cluster_30 {
color=blue
125 [label="Enter when branch condition "];
126 [label="Access variable R|<local>/element|"];
127 [label="Type operator: element is T"];
128 [label="Exit when branch condition"];
}
129 [label="Synthetic else branch"];
130 [label="Enter when branch result"];
subgraph cluster_31 {
color=blue
131 [label="Enter block"];
132 [label="Access variable R|<local>/element|"];
133 [label="Jump: ^firstIsInstanceOrNull R|<local>/element|"];
134 [label="Stub" style="filled" fillcolor=gray];
135 [label="Exit block" style="filled" fillcolor=gray];
}
136 [label="Exit when branch result" style="filled" fillcolor=gray];
137 [label="Exit when"];
}
138 [label="Exit block"];
}
139 [label="Exit loop block"];
}
140 [label="Exit whileloop"];
}
141 [label="Const: Null(null)"];
142 [label="Jump: ^firstIsInstanceOrNull Null(null)"];
143 [label="Stub" style="filled" fillcolor=gray];
144 [label="Exit function firstIsInstanceOrNull" style="filled" fillcolor=red];
}
108 -> {109};
109 -> {110};
110 -> {111};
111 -> {112};
112 -> {113};
113 -> {114};
114 -> {115};
115 -> {116};
116 -> {117};
117 -> {118};
118 -> {140 119};
119 -> {120};
120 -> {121};
121 -> {122};
122 -> {123};
123 -> {124};
124 -> {125};
125 -> {126};
126 -> {127};
127 -> {128};
128 -> {130 129};
129 -> {137};
130 -> {131};
131 -> {132};
132 -> {133};
133 -> {144};
133 -> {134} [style=dotted];
134 -> {135} [style=dotted];
135 -> {136} [style=dotted];
136 -> {137} [style=dotted];
137 -> {138};
138 -> {139};
139 -> {115};
140 -> {141};
141 -> {142};
142 -> {144};
142 -> {143} [style=dotted];
143 -> {144} [style=dotted];
} }
+4 -16
View File
@@ -1,22 +1,10 @@
@Throws(<!UNRESOLVED_REFERENCE!>IOException<!>::class, <!UNRESOLVED_REFERENCE!>ResponseParseException<!>::class) // !DUMP_CFG
fun fetchPluginReleaseDate(pluginId: PluginId, version: String, channel: String?): LocalDate? {
val url = "https://plugins.jetbrains.com/api/plugins/${pluginId.<!UNRESOLVED_REFERENCE!>idString<!>}/updates?version=$version"
val pluginDTOs: Array<PluginDTO> = try {
<!UNRESOLVED_REFERENCE!>HttpRequests<!>.<!UNRESOLVED_REFERENCE!>request<!>(url).<!UNRESOLVED_REFERENCE!>connect<!> {
<!UNRESOLVED_REFERENCE!>GsonBuilder<!>().<!UNRESOLVED_REFERENCE!>create<!>().<!UNRESOLVED_REFERENCE!>fromJson<!>(<!UNRESOLVED_REFERENCE!>it<!>.<!UNRESOLVED_REFERENCE!>inputStream<!>.<!AMBIGUITY!>reader<!>(), Array<PluginDTO>::class.java)
}
} catch (ioException: JsonIOException) {
throw <!UNRESOLVED_REFERENCE!>IOException<!>(ioException)
} catch (syntaxException: JsonSyntaxException) {
throw <!UNRESOLVED_REFERENCE!>ResponseParseException<!>("Can't parse json response", syntaxException)
}
}
interface AutoCloseable { interface AutoCloseable {
fun close() fun close()
} }
fun Throwable.addSuppressed(other: Throwable) {}
internal fun AutoCloseable?.closeFinally(cause: Throwable?) = when { internal fun AutoCloseable?.closeFinally(cause: Throwable?) = when {
this == null -> {} this == null -> {}
cause == null -> close() cause == null -> close()
@@ -28,7 +16,7 @@ internal fun AutoCloseable?.closeFinally(cause: Throwable?) = when {
} }
} }
inline fun <reified T : Any> Sequence<*>.firstIsInstanceOrNull(): T? { inline fun <reified T : Any> List<*>.firstIsInstanceOrNull(): T? {
for (element in this) if (element is T) return element for (element in this) if (element is T) return element
return null return null
} }
+6 -20
View File
@@ -1,23 +1,9 @@
FILE: complex.kt FILE: complex.kt
@R|kotlin/jvm/Throws|(<getClass>(<Unresolved name: IOException>#), <getClass>(<Unresolved name: ResponseParseException>#)) public final fun fetchPluginReleaseDate(pluginId: R|ERROR CLASS: Symbol not found, for `PluginId`|, version: R|kotlin/String|, channel: R|kotlin/String?|): R|ERROR CLASS: Symbol not found, for `LocalDate?`| {
lval url: R|kotlin/String| = <strcat>(String(https://plugins.jetbrains.com/api/plugins/), R|<local>/pluginId|.<Unresolved name: idString>#.R|kotlin/toString|(), String(/updates?version=), R|<local>/version|.R|kotlin/Any.toString|())
lval pluginDTOs: R|kotlin/Array<ERROR CLASS: Symbol not found, for `PluginDTO`>| = try {
<Unresolved name: HttpRequests>#.<Unresolved name: request>#(R|<local>/url|).<Unresolved name: connect>#(<L> = connect@fun <anonymous>(): R|ERROR CLASS: Unresolved name: fromJson| {
^ <Unresolved name: GsonBuilder>#().<Unresolved name: create>#().<Unresolved name: fromJson>#(<Unresolved name: it>#.<Unresolved name: inputStream>#.<Ambiguity: reader, [kotlin/io/reader, kotlin/io/reader, kotlin/io/reader]>#(), <getClass>(Q|kotlin/Array|).R|kotlin/jvm/java|)
}
)
}
catch (ioException: R|ERROR CLASS: Symbol not found, for `JsonIOException`|) {
throw <Unresolved name: IOException>#(R|<local>/ioException|)
}
catch (syntaxException: R|ERROR CLASS: Symbol not found, for `JsonSyntaxException`|) {
throw <Unresolved name: ResponseParseException>#(String(Can't parse json response), R|<local>/syntaxException|)
}
}
public abstract interface AutoCloseable : R|kotlin/Any| { public abstract interface AutoCloseable : R|kotlin/Any| {
public abstract fun close(): R|kotlin/Unit| 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| { internal final fun R|AutoCloseable?|.closeFinally(cause: R|kotlin/Throwable?|): R|kotlin/Unit| {
^closeFinally when () { ^closeFinally when () {
@@ -31,16 +17,16 @@ FILE: complex.kt
this@R|/closeFinally|.R|/AutoCloseable.close|() this@R|/closeFinally|.R|/AutoCloseable.close|()
} }
catch (closeException: R|kotlin/Throwable|) { catch (closeException: R|kotlin/Throwable|) {
R|<local>/cause|.R|kotlin/addSuppressed|(R|<local>/closeException|) R|<local>/cause|.R|/addSuppressed|(R|<local>/closeException|)
} }
} }
} }
} }
public final inline fun <reified T : R|kotlin/Any|> R|kotlin/sequences/Sequence<*>|.firstIsInstanceOrNull(): R|T?| { public final inline fun <reified T : R|kotlin/Any|> R|kotlin/collections/List<*>|.firstIsInstanceOrNull(): R|T?| {
lval <range>: R|kotlin/sequences/Sequence<*>| = this@R|/firstIsInstanceOrNull| lval <range>: R|kotlin/collections/List<*>| = this@R|/firstIsInstanceOrNull|
lval <iterator>: R|kotlin/collections/Iterator<kotlin/Any?>| = R|<local>/<range>|.R|FakeOverride<kotlin/sequences/Sequence.iterator: R|kotlin/collections/Iterator<kotlin/Any?>|>|() lval <iterator>: R|kotlin/collections/Iterator<kotlin/Any?>| = R|<local>/<range>|.R|FakeOverride<kotlin/collections/List.iterator: R|kotlin/collections/Iterator<kotlin/Any?>|>|()
while(R|<local>/<iterator>|.R|kotlin/collections/Iterator.hasNext|()) { 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?|>|() lval element: R|kotlin/Any?| = R|<local>/<iterator>|.R|FakeOverride<kotlin/collections/Iterator.next: R|kotlin/Any?|>|()
when () { when () {
@@ -1,3 +1,4 @@
// !DUMP_CFG
fun test_1() { fun test_1() {
when {} when {}
} }
@@ -1,3 +1,4 @@
// !DUMP_CFG
class Foo { class Foo {
init { init {
val x = 1 val x = 1
@@ -1,3 +1,4 @@
// !DUMP_CFG
interface B interface B
interface A { interface A {
+3 -3
View File
@@ -34,8 +34,8 @@ digraph jumps_kt {
subgraph cluster_5 { subgraph cluster_5 {
color=blue color=blue
15 [label="Enter block"]; 15 [label="Enter block"];
16 [label="Function call: R|kotlin/KotlinNullPointerException.KotlinNullPointerException|()"]; 16 [label="Function call: R|java/lang/Exception.Exception|()"];
17 [label="Throw: throw R|kotlin/KotlinNullPointerException.KotlinNullPointerException|()"]; 17 [label="Throw: throw R|java/lang/Exception.Exception|()"];
18 [label="Stub" style="filled" fillcolor=gray]; 18 [label="Stub" style="filled" fillcolor=gray];
19 [label="Exit block" style="filled" fillcolor=gray]; 19 [label="Exit block" style="filled" fillcolor=gray];
} }
@@ -118,7 +118,7 @@ digraph jumps_kt {
} }
48 [label="Variable declaration: lval y: R|kotlin/Int?|"]; 48 [label="Variable declaration: lval y: R|kotlin/Int?|"];
49 [label="Access variable R|<local>/y|"]; 49 [label="Access variable R|<local>/y|"];
50 [label="Function call: R|<local>/y|.<Ambiguity: inc, [kotlin/inc, kotlin/inc]>#()"]; 50 [label="Function call: R|<local>/y|.<Inapplicable(WRONG_RECEIVER): [kotlin/Int.inc]>#()"];
51 [label="Exit function test_2" style="filled" fillcolor=red]; 51 [label="Exit function test_2" style="filled" fillcolor=red];
} }
+3 -2
View File
@@ -1,6 +1,7 @@
// !DUMP_CFG
fun test_1(x: Int?) { fun test_1(x: Int?) {
val y = if (x == null) { val y = if (x == null) {
throw KotlinNullPointerException() throw Exception()
} else { } else {
x x
} }
@@ -14,7 +15,7 @@ fun test_2(x: Int?) {
} else { } else {
x x
} }
y.<!AMBIGUITY!>inc<!>() y.<!INAPPLICABLE_CANDIDATE!>inc<!>()
} }
fun test_3(x: Int?) { fun test_3(x: Int?) {
+2 -2
View File
@@ -2,7 +2,7 @@ FILE: jumps.kt
public final fun test_1(x: R|kotlin/Int?|): R|kotlin/Unit| { public final fun test_1(x: R|kotlin/Int?|): R|kotlin/Unit| {
lval y: R|kotlin/Int| = when () { lval y: R|kotlin/Int| = when () {
==(R|<local>/x|, Null(null)) -> { ==(R|<local>/x|, Null(null)) -> {
throw R|kotlin/KotlinNullPointerException.KotlinNullPointerException|() throw R|java/lang/Exception.Exception|()
} }
else -> { else -> {
R|<local>/x| R|<local>/x|
@@ -22,7 +22,7 @@ FILE: jumps.kt
} }
} }
R|<local>/y|.<Ambiguity: inc, [kotlin/inc, kotlin/inc]>#() R|<local>/y|.<Inapplicable(WRONG_RECEIVER): [kotlin/Int.inc]>#()
} }
public final fun test_3(x: R|kotlin/Int?|): R|kotlin/Unit| { public final fun test_3(x: R|kotlin/Int?|): R|kotlin/Unit| {
while(Boolean(true)) { while(Boolean(true)) {
-363
View File
@@ -1,363 +0,0 @@
digraph jumps_kt {
graph [splines=ortho 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|kotlin/KotlinNullPointerException.KotlinNullPointerException|()"];
17 [label="Throw: throw R|kotlin/KotlinNullPointerException.KotlinNullPointerException|()"];
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|.<Ambiguity: inc, [kotlin/inc, kotlin/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: x as 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="Stub" style="filled" fillcolor=gray];
66 [label="Exit whileloop"];
}
67 [label="Access variable R|<local>/x|"];
68 [label="Function call: R|<local>/x|.R|kotlin/Int.inc|()"];
69 [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 -> {66};
61 -> {62} [style=dotted];
62 -> {63} [style=dotted];
63 -> {64} [style=dotted];
64 -> {54} [style=dotted];
65 -> {66} [style=dotted];
66 -> {67};
67 -> {68};
68 -> {69};
subgraph cluster_17 {
color=red
70 [label="Enter function test_4" style="filled" fillcolor=red];
subgraph cluster_18 {
color=blue
71 [label="Enter do-while loop"];
subgraph cluster_19 {
color=blue
72 [label="Enter loop block"];
subgraph cluster_20 {
color=blue
73 [label="Enter block"];
74 [label="Access variable R|<local>/x|"];
75 [label="Type operator: x as Int"];
76 [label="Jump: break@@@[Boolean(true)] "];
77 [label="Stub" style="filled" fillcolor=gray];
78 [label="Exit block" style="filled" fillcolor=gray];
}
79 [label="Exit loop block" style="filled" fillcolor=gray];
}
subgraph cluster_21 {
color=blue
80 [label="Enter loop condition" style="filled" fillcolor=gray];
81 [label="Const: Boolean(true)" style="filled" fillcolor=gray];
82 [label="Exit loop condition" style="filled" fillcolor=gray];
}
83 [label="Stub" style="filled" fillcolor=gray];
84 [label="Exit do-whileloop"];
}
85 [label="Access variable R|<local>/x|"];
86 [label="Function call: R|<local>/x|.R|kotlin/Int.inc|()"];
87 [label="Exit function test_4" style="filled" fillcolor=red];
}
70 -> {71};
71 -> {72};
72 -> {73};
73 -> {74};
74 -> {75};
75 -> {76};
76 -> {84};
76 -> {77} [style=dotted];
77 -> {78} [style=dotted];
78 -> {79} [style=dotted];
79 -> {80} [style=dotted];
80 -> {81} [style=dotted];
81 -> {82} [style=dotted];
82 -> {72 83} [style=dotted];
83 -> {84} [style=dotted];
84 -> {85};
85 -> {86};
86 -> {87};
subgraph cluster_22 {
color=red
88 [label="Enter function test_5" style="filled" fillcolor=red];
subgraph cluster_23 {
color=blue
89 [label="Enter while loop"];
subgraph cluster_24 {
color=blue
90 [label="Enter loop condition"];
91 [label="Access variable R|<local>/b|"];
92 [label="Exit loop condition"];
}
subgraph cluster_25 {
color=blue
93 [label="Enter loop block"];
subgraph cluster_26 {
color=blue
94 [label="Enter block"];
subgraph cluster_27 {
color=blue
95 [label="Enter when"];
subgraph cluster_28 {
color=blue
96 [label="Enter when branch condition "];
97 [label="Access variable R|<local>/b|"];
98 [label="Exit when branch condition"];
}
99 [label="Synthetic else branch"];
100 [label="Enter when branch result"];
subgraph cluster_29 {
color=blue
101 [label="Enter block"];
102 [label="Jump: continue@@@[R|<local>/b|] "];
103 [label="Stub" style="filled" fillcolor=gray];
104 [label="Exit block" style="filled" fillcolor=gray];
}
105 [label="Exit when branch result" style="filled" fillcolor=gray];
106 [label="Exit when"];
}
107 [label="Exit block"];
}
108 [label="Exit loop block"];
}
109 [label="Exit whileloop"];
}
110 [label="Exit function test_5" style="filled" fillcolor=red];
}
88 -> {89};
89 -> {90};
90 -> {91};
91 -> {92};
92 -> {109 93};
93 -> {94};
94 -> {95};
95 -> {96};
96 -> {97};
97 -> {98};
98 -> {100 99};
99 -> {106};
100 -> {101};
101 -> {102};
102 -> {89};
102 -> {103} [style=dotted];
103 -> {104} [style=dotted];
104 -> {105} [style=dotted];
105 -> {106} [style=dotted];
106 -> {107};
107 -> {108};
108 -> {90};
109 -> {110};
subgraph cluster_30 {
color=red
111 [label="Enter function run" style="filled" fillcolor=red];
112 [label="Function call: R|<local>/block|.R|FakeOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()"];
113 [label="Exit function run" style="filled" fillcolor=red];
}
111 -> {112};
112 -> {113};
subgraph cluster_31 {
color=red
114 [label="Enter function test_6" style="filled" fillcolor=red];
subgraph cluster_32 {
color=blue
115 [label="Enter function anonymousFunction"];
116 [label="Jump: ^@run Unit"];
117 [label="Stub" style="filled" fillcolor=gray];
118 [label="Exit function anonymousFunction"];
}
119 [label="Function call: R|/run|(<L> = run@fun <anonymous>(): R|kotlin/Unit| <kind=UNKNOWN> {
^@run Unit
}
)"];
120 [label="Exit function test_6" style="filled" fillcolor=red];
}
114 -> {115};
115 -> {118 116};
116 -> {118};
116 -> {117} [style=dotted];
117 -> {118} [style=dotted];
118 -> {115 119};
119 -> {120};
}
-358
View File
@@ -1,358 +0,0 @@
digraph jumps_kt {
graph [splines=ortho 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|kotlin/KotlinNullPointerException.KotlinNullPointerException|()"];
17 [label="Throw: throw R|kotlin/KotlinNullPointerException.KotlinNullPointerException|()"];
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|.<Ambiguity: inc, [kotlin/inc, kotlin/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: x as 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 -> {65 57};
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: x as 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];
subgraph cluster_32 {
color=blue
113 [label="Enter function anonymousFunction"];
114 [label="Jump: ^@run Unit"];
115 [label="Stub" style="filled" fillcolor=gray];
116 [label="Exit function anonymousFunction"];
}
117 [label="Function call: R|/run|(<L> = run@fun <anonymous>(): R|kotlin/Unit| <kind=UNKNOWN> {
^@run Unit
}
)"];
118 [label="Exit function test_6" style="filled" fillcolor=red];
}
112 -> {113};
113 -> {116 114};
114 -> {116};
114 -> {115} [style=dotted];
115 -> {116} [style=dotted];
116 -> {113 117};
117 -> {118};
}
+1
View File
@@ -1,3 +1,4 @@
// !DUMP_CFG
inline fun run(block: () -> Unit) { inline fun run(block: () -> Unit) {
block() block()
} }
+1
View File
@@ -1,3 +1,4 @@
// !DUMP_CFG
fun testWhile(b: Boolean, x: Any?) { fun testWhile(b: Boolean, x: Any?) {
while (b) { while (b) {
val y = x is String val y = x is String
@@ -1,3 +1,4 @@
// !DUMP_CFG
inline fun foo(vararg x: Any) {} inline fun foo(vararg x: Any) {}
fun test(a: Any, b: Any, c: Any) { fun test(a: Any, b: Any, c: Any) {
@@ -1,3 +1,4 @@
// !DUMP_CFG
inline fun run(block: () -> Unit) { inline fun run(block: () -> Unit) {
block() block()
} }
@@ -1,3 +1,4 @@
// !DUMP_CFG
interface A interface A
class B : A class B : A
@@ -1,3 +1,4 @@
// !DUMP_CFG
interface A { interface A {
fun foo(): A fun foo(): A
fun bar(): A fun bar(): A
+1
View File
@@ -1,3 +1,4 @@
// !DUMP_CFG
fun foo() {} fun foo() {}
fun test() { fun test() {
+1
View File
@@ -1,3 +1,4 @@
// !DUMP_CFG
fun test_1() { fun test_1() {
try { try {
val x = 1 val x = 1
+1
View File
@@ -1,3 +1,4 @@
// !DUMP_CFG
fun test_1(x: Int) { fun test_1(x: Int) {
val y = when { val y = when {
x == 1 -> 10 x == 1 -> 10
@@ -1,3 +1,4 @@
// !DUMP_CFG
interface A { interface A {
fun foo(): Boolean fun foo(): Boolean
} }
@@ -1,3 +1,4 @@
// !DUMP_CFG
interface A { interface A {
fun foo() fun foo()
@@ -1,3 +1,4 @@
// !DUMP_CFG
interface A { interface A {
fun foo() fun foo()
val b: Boolean val b: Boolean
@@ -223,7 +223,7 @@ digraph boundSmartcasts_kt {
83 [label="Access variable R|<local>/y|"]; 83 [label="Access variable R|<local>/y|"];
84 [label="Assignmenet: R|<local>/x|"]; 84 [label="Assignmenet: R|<local>/x|"];
85 [label="Access variable R|<local>/x|"]; 85 [label="Access variable R|<local>/x|"];
86 [label="Function call: R|<local>/x|.<Ambiguity: inc, [kotlin/inc, kotlin/inc]>#()"]; 86 [label="Function call: R|<local>/x|.<Unresolved name: inc>#()"];
subgraph cluster_18 { subgraph cluster_18 {
color=blue color=blue
87 [label="Enter when"]; 87 [label="Enter when"];
@@ -1,3 +1,4 @@
// !DUMP_CFG
interface A { interface A {
fun foo() fun foo()
} }
@@ -39,7 +40,7 @@ fun test_4(y: Any) {
x as Int x as Int
x.inc() x.inc()
x = y x = y
x.<!AMBIGUITY!>inc<!>() x.<!UNRESOLVED_REFERENCE!>inc<!>()
if (y is A) { if (y is A) {
x.foo() x.foo()
y.foo() y.foo()
@@ -49,7 +49,7 @@ FILE: boundSmartcasts.kt
(R|<local>/x| as R|kotlin/Int|) (R|<local>/x| as R|kotlin/Int|)
R|<local>/x|.R|kotlin/Int.inc|() R|<local>/x|.R|kotlin/Int.inc|()
R|<local>/x| = R|<local>/y| R|<local>/x| = R|<local>/y|
R|<local>/x|.<Ambiguity: inc, [kotlin/inc, kotlin/inc]>#() R|<local>/x|.<Unresolved name: inc>#()
when () { when () {
(R|<local>/y| is R|A|) -> { (R|<local>/y| is R|A|) -> {
R|<local>/x|.R|/A.foo|() R|<local>/x|.R|/A.foo|()
@@ -1,3 +1,4 @@
// !DUMP_CFG
class A { class A {
val s: String = "" val s: String = ""
} }
@@ -1,3 +1,4 @@
// !DUMP_CFG
fun test_1(x: Any?) { fun test_1(x: Any?) {
x as String x as String
x.length x.length
@@ -1,3 +1,4 @@
// !DUMP_CFG
interface A { interface A {
fun foo() fun foo()
val b: Boolean val b: Boolean
@@ -427,8 +427,8 @@ digraph returns_kt {
161 [label="Variable declaration: lval length: R|kotlin/Int|"]; 161 [label="Variable declaration: lval length: R|kotlin/Int|"];
162 [label="Postponed enter to lambda"]; 162 [label="Postponed enter to lambda"];
163 [label="Postponed exit from lambda"]; 163 [label="Postponed exit from lambda"];
164 [label="Function call: R|/runHigherOrder|<R|kotlin/Boolean|>(<L> = runHigherOrder@fun <anonymous>(): R|kotlin/Boolean| { 164 [label="Function call: R|/runHigherOrder|<R|kotlin/Int|>(<L> = runHigherOrder@fun <anonymous>(): R|kotlin/Int| {
^ R|<local>/s|.R|kotlin/text/isNotEmpty|() ^ R|<local>/s|.R|kotlin/String.length|
} }
)"]; )"];
165 [label="Exit function test_4" style="filled" fillcolor=red]; 165 [label="Exit function test_4" style="filled" fillcolor=red];
@@ -472,7 +472,7 @@ digraph returns_kt {
color=red color=red
166 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; 166 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
167 [label="Access variable R|<local>/s|"]; 167 [label="Access variable R|<local>/s|"];
168 [label="Function call: R|<local>/s|.R|kotlin/text/isNotEmpty|()"]; 168 [label="Access variable R|kotlin/String.length|"];
169 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; 169 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
} }
@@ -1,3 +1,4 @@
// !DUMP_CFG
fun test_0(x: Any) { fun test_0(x: Any) {
if (x is String) { if (x is String) {
x.length x.length
@@ -57,6 +58,6 @@ fun test_4(a: Any?) {
val s = a as? String val s = a as? String
val length = s?.ext ?: return val length = s?.ext ?: return
runHigherOrder { runHigherOrder {
s.isNotEmpty() // Should be OK s.length // Should be OK
} }
} }
@@ -83,8 +83,8 @@ FILE: returns.kt
} }
} }
R|/runHigherOrder|<R|kotlin/Boolean|>(<L> = runHigherOrder@fun <anonymous>(): R|kotlin/Boolean| { R|/runHigherOrder|<R|kotlin/Int|>(<L> = runHigherOrder@fun <anonymous>(): R|kotlin/Int| {
^ R|<local>/s|.R|kotlin/text/isNotEmpty|() ^ R|<local>/s|.R|kotlin/String.length|
} }
) )
} }
@@ -1,3 +1,4 @@
// !DUMP_CFG
fun test_1(x: Any) { fun test_1(x: Any) {
if (x is String) { if (x is String) {
x.length x.length
@@ -1,3 +1,4 @@
// !DUMP_CFG
interface A { interface A {
fun foo() fun foo()
} }
@@ -1,3 +1,4 @@
// !DUMP_CFG
interface A { interface A {
fun foo() fun foo()
} }
@@ -1,3 +1,4 @@
// !DUMP_CFG
interface A { interface A {
fun foo() fun foo()
} }
@@ -1,3 +1,4 @@
// !DUMP_CFG
interface A { interface A {
fun foo() fun foo()
} }
@@ -1,3 +1,4 @@
// !DUMP_CFG
fun test(func: (() -> Unit)?) { fun test(func: (() -> Unit)?) {
if (func != null) { if (func != null) {
func() func()
@@ -1,3 +1,4 @@
// !DUMP_CFG
interface A { interface A {
fun foo(): Boolean fun foo(): Boolean
} }
@@ -1,3 +1,4 @@
// !DUMP_CFG
interface A { interface A {
fun foo() fun foo()
} }
@@ -1,3 +1,4 @@
// !DUMP_CFG
// There would be ambiguities if some expression was smartcasted to (A & B) and foo() was called. // There would be ambiguities if some expression was smartcasted to (A & B) and foo() was called.
// There was a bug where 2 variables were "bound" together if they are assigned from the same function call or property. // There was a bug where 2 variables were "bound" together if they are assigned from the same function call or property.
interface A { interface A {
@@ -503,7 +503,7 @@ digraph nullability_kt {
176 [label="Access variable R|<local>/q|"]; 176 [label="Access variable R|<local>/q|"];
177 [label="Access variable R|/Q.data|"]; 177 [label="Access variable R|/Q.data|"];
178 [label="Access variable <Inapplicable(WRONG_RECEIVER): [/MyData.s]>#"]; 178 [label="Access variable <Inapplicable(WRONG_RECEIVER): [/MyData.s]>#"];
179 [label="Function call: R|<local>/q|.R|/Q.data|.<Inapplicable(WRONG_RECEIVER): [/MyData.s]>#.<Ambiguity: inc, [kotlin/inc, kotlin/inc]>#()"]; 179 [label="Function call: R|<local>/q|.R|/Q.data|.<Inapplicable(WRONG_RECEIVER): [/MyData.s]>#.<Unresolved name: inc>#()"];
180 [label="Exit block"]; 180 [label="Exit block"];
} }
181 [label="Exit when branch result"]; 181 [label="Exit when branch result"];
@@ -600,7 +600,7 @@ digraph nullability_kt {
220 [label="Access variable R|<local>/q|"]; 220 [label="Access variable R|<local>/q|"];
221 [label="Access variable R|/Q.data|"]; 221 [label="Access variable R|/Q.data|"];
222 [label="Access variable <Inapplicable(WRONG_RECEIVER): [/MyData.s]>#"]; 222 [label="Access variable <Inapplicable(WRONG_RECEIVER): [/MyData.s]>#"];
223 [label="Function call: R|<local>/q|.R|/Q.data|.<Inapplicable(WRONG_RECEIVER): [/MyData.s]>#.<Ambiguity: inc, [kotlin/inc, kotlin/inc]>#()"]; 223 [label="Function call: R|<local>/q|.R|/Q.data|.<Inapplicable(WRONG_RECEIVER): [/MyData.s]>#.<Unresolved name: inc>#()"];
224 [label="Exit function test_6" style="filled" fillcolor=red]; 224 [label="Exit function test_6" style="filled" fillcolor=red];
} }
@@ -682,7 +682,7 @@ digraph nullability_kt {
249 [label="Access variable R|<local>/q|"]; 249 [label="Access variable R|<local>/q|"];
250 [label="Function call: R|<local>/q|.R|/Q.fdata|()"]; 250 [label="Function call: R|<local>/q|.R|/Q.fdata|()"];
251 [label="Function call: R|<local>/q|.R|/Q.fdata|().<Inapplicable(WRONG_RECEIVER): [/MyData.fs]>#()"]; 251 [label="Function call: R|<local>/q|.R|/Q.fdata|().<Inapplicable(WRONG_RECEIVER): [/MyData.fs]>#()"];
252 [label="Function call: R|<local>/q|.R|/Q.fdata|().<Inapplicable(WRONG_RECEIVER): [/MyData.fs]>#().<Ambiguity: inc, [kotlin/inc, kotlin/inc]>#()"]; 252 [label="Function call: R|<local>/q|.R|/Q.fdata|().<Inapplicable(WRONG_RECEIVER): [/MyData.fs]>#().<Unresolved name: inc>#()"];
253 [label="Exit block"]; 253 [label="Exit block"];
} }
254 [label="Exit when branch result"]; 254 [label="Exit when branch result"];
@@ -795,7 +795,7 @@ digraph nullability_kt {
287 [label="Exit when"]; 287 [label="Exit when"];
} }
288 [label="Access variable R|<local>/b|"]; 288 [label="Access variable R|<local>/b|"];
289 [label="Function call: R|<local>/b|.<Ambiguity: inc, [kotlin/inc, kotlin/inc]>#()"]; 289 [label="Function call: R|<local>/b|.<Inapplicable(WRONG_RECEIVER): [kotlin/Int.inc]>#()"];
subgraph cluster_65 { subgraph cluster_65 {
color=blue color=blue
290 [label="Enter when"]; 290 [label="Enter when"];
@@ -820,7 +820,7 @@ digraph nullability_kt {
303 [label="Exit when"]; 303 [label="Exit when"];
} }
304 [label="Access variable R|<local>/b|"]; 304 [label="Access variable R|<local>/b|"];
305 [label="Function call: R|<local>/b|.<Ambiguity: inc, [kotlin/inc, kotlin/inc]>#()"]; 305 [label="Function call: R|<local>/b|.<Inapplicable(WRONG_RECEIVER): [kotlin/Int.inc]>#()"];
subgraph cluster_68 { subgraph cluster_68 {
color=blue color=blue
306 [label="Enter when"]; 306 [label="Enter when"];
@@ -845,7 +845,7 @@ digraph nullability_kt {
319 [label="Exit when"]; 319 [label="Exit when"];
} }
320 [label="Access variable R|<local>/b|"]; 320 [label="Access variable R|<local>/b|"];
321 [label="Function call: R|<local>/b|.<Ambiguity: inc, [kotlin/inc, kotlin/inc]>#()"]; 321 [label="Function call: R|<local>/b|.<Inapplicable(WRONG_RECEIVER): [kotlin/Int.inc]>#()"];
subgraph cluster_71 { subgraph cluster_71 {
color=blue color=blue
322 [label="Enter when"]; 322 [label="Enter when"];
@@ -870,7 +870,7 @@ digraph nullability_kt {
335 [label="Exit when"]; 335 [label="Exit when"];
} }
336 [label="Access variable R|<local>/b|"]; 336 [label="Access variable R|<local>/b|"];
337 [label="Function call: R|<local>/b|.<Ambiguity: inc, [kotlin/inc, kotlin/inc]>#()"]; 337 [label="Function call: R|<local>/b|.<Inapplicable(WRONG_RECEIVER): [kotlin/Int.inc]>#()"];
338 [label="Exit function test_9" style="filled" fillcolor=red]; 338 [label="Exit function test_9" style="filled" fillcolor=red];
} }
@@ -960,14 +960,14 @@ digraph nullability_kt {
color=blue color=blue
348 [label="Enter block"]; 348 [label="Enter block"];
349 [label="Access variable R|<local>/b|"]; 349 [label="Access variable R|<local>/b|"];
350 [label="Function call: R|<local>/b|.<Ambiguity: inc, [kotlin/inc, kotlin/inc]>#()"]; 350 [label="Function call: R|<local>/b|.<Inapplicable(WRONG_RECEIVER): [kotlin/Int.inc]>#()"];
351 [label="Exit block"]; 351 [label="Exit block"];
} }
352 [label="Exit when branch result"]; 352 [label="Exit when branch result"];
353 [label="Exit when"]; 353 [label="Exit when"];
} }
354 [label="Access variable R|<local>/b|"]; 354 [label="Access variable R|<local>/b|"];
355 [label="Function call: R|<local>/b|.<Ambiguity: inc, [kotlin/inc, kotlin/inc]>#()"]; 355 [label="Function call: R|<local>/b|.<Inapplicable(WRONG_RECEIVER): [kotlin/Int.inc]>#()"];
subgraph cluster_78 { subgraph cluster_78 {
color=blue color=blue
356 [label="Enter when"]; 356 [label="Enter when"];
@@ -985,14 +985,14 @@ digraph nullability_kt {
color=blue color=blue
364 [label="Enter block"]; 364 [label="Enter block"];
365 [label="Access variable R|<local>/b|"]; 365 [label="Access variable R|<local>/b|"];
366 [label="Function call: R|<local>/b|.<Ambiguity: inc, [kotlin/inc, kotlin/inc]>#()"]; 366 [label="Function call: R|<local>/b|.<Inapplicable(WRONG_RECEIVER): [kotlin/Int.inc]>#()"];
367 [label="Exit block"]; 367 [label="Exit block"];
} }
368 [label="Exit when branch result"]; 368 [label="Exit when branch result"];
369 [label="Exit when"]; 369 [label="Exit when"];
} }
370 [label="Access variable R|<local>/b|"]; 370 [label="Access variable R|<local>/b|"];
371 [label="Function call: R|<local>/b|.<Ambiguity: inc, [kotlin/inc, kotlin/inc]>#()"]; 371 [label="Function call: R|<local>/b|.<Inapplicable(WRONG_RECEIVER): [kotlin/Int.inc]>#()"];
subgraph cluster_81 { subgraph cluster_81 {
color=blue color=blue
372 [label="Enter when"]; 372 [label="Enter when"];
@@ -1010,14 +1010,14 @@ digraph nullability_kt {
color=blue color=blue
380 [label="Enter block"]; 380 [label="Enter block"];
381 [label="Access variable R|<local>/b|"]; 381 [label="Access variable R|<local>/b|"];
382 [label="Function call: R|<local>/b|.<Ambiguity: inc, [kotlin/inc, kotlin/inc]>#()"]; 382 [label="Function call: R|<local>/b|.<Inapplicable(WRONG_RECEIVER): [kotlin/Int.inc]>#()"];
383 [label="Exit block"]; 383 [label="Exit block"];
} }
384 [label="Exit when branch result"]; 384 [label="Exit when branch result"];
385 [label="Exit when"]; 385 [label="Exit when"];
} }
386 [label="Access variable R|<local>/b|"]; 386 [label="Access variable R|<local>/b|"];
387 [label="Function call: R|<local>/b|.<Ambiguity: inc, [kotlin/inc, kotlin/inc]>#()"]; 387 [label="Function call: R|<local>/b|.<Inapplicable(WRONG_RECEIVER): [kotlin/Int.inc]>#()"];
subgraph cluster_84 { subgraph cluster_84 {
color=blue color=blue
388 [label="Enter when"]; 388 [label="Enter when"];
@@ -1035,14 +1035,14 @@ digraph nullability_kt {
color=blue color=blue
396 [label="Enter block"]; 396 [label="Enter block"];
397 [label="Access variable R|<local>/b|"]; 397 [label="Access variable R|<local>/b|"];
398 [label="Function call: R|<local>/b|.<Ambiguity: inc, [kotlin/inc, kotlin/inc]>#()"]; 398 [label="Function call: R|<local>/b|.<Inapplicable(WRONG_RECEIVER): [kotlin/Int.inc]>#()"];
399 [label="Exit block"]; 399 [label="Exit block"];
} }
400 [label="Exit when branch result"]; 400 [label="Exit when branch result"];
401 [label="Exit when"]; 401 [label="Exit when"];
} }
402 [label="Access variable R|<local>/b|"]; 402 [label="Access variable R|<local>/b|"];
403 [label="Function call: R|<local>/b|.<Ambiguity: inc, [kotlin/inc, kotlin/inc]>#()"]; 403 [label="Function call: R|<local>/b|.<Inapplicable(WRONG_RECEIVER): [kotlin/Int.inc]>#()"];
404 [label="Exit function test_10" style="filled" fillcolor=red]; 404 [label="Exit function test_10" style="filled" fillcolor=red];
} }
@@ -1157,7 +1157,7 @@ digraph nullability_kt {
438 [label="Access variable R|<local>/q2|"]; 438 [label="Access variable R|<local>/q2|"];
439 [label="Access variable R|/QImpl.data|"]; 439 [label="Access variable R|/QImpl.data|"];
440 [label="Access variable <Inapplicable(WRONG_RECEIVER): [/MyData.s]>#"]; 440 [label="Access variable <Inapplicable(WRONG_RECEIVER): [/MyData.s]>#"];
441 [label="Function call: R|<local>/q2|.R|/QImpl.data|.<Inapplicable(WRONG_RECEIVER): [/MyData.s]>#.<Ambiguity: inc, [kotlin/inc, kotlin/inc]>#()"]; 441 [label="Function call: R|<local>/q2|.R|/QImpl.data|.<Inapplicable(WRONG_RECEIVER): [/MyData.s]>#.<Unresolved name: inc>#()"];
subgraph cluster_91 { subgraph cluster_91 {
color=blue color=blue
442 [label="Enter when"]; 442 [label="Enter when"];
@@ -1292,7 +1292,7 @@ digraph nullability_kt {
490 [label="Access variable R|<local>/q|"]; 490 [label="Access variable R|<local>/q|"];
491 [label="Access variable R|/QImplWithCustomGetter.data|"]; 491 [label="Access variable R|/QImplWithCustomGetter.data|"];
492 [label="Access variable <Inapplicable(WRONG_RECEIVER): [/MyData.s]>#"]; 492 [label="Access variable <Inapplicable(WRONG_RECEIVER): [/MyData.s]>#"];
493 [label="Function call: R|<local>/q|.R|/QImplWithCustomGetter.data|.<Inapplicable(WRONG_RECEIVER): [/MyData.s]>#.<Ambiguity: inc, [kotlin/inc, kotlin/inc]>#()"]; 493 [label="Function call: R|<local>/q|.R|/QImplWithCustomGetter.data|.<Inapplicable(WRONG_RECEIVER): [/MyData.s]>#.<Unresolved name: inc>#()"];
494 [label="Exit block"]; 494 [label="Exit block"];
} }
495 [label="Exit when branch result"]; 495 [label="Exit when branch result"];
@@ -1369,7 +1369,7 @@ digraph nullability_kt {
522 [label="Access variable R|<local>/q|"]; 522 [label="Access variable R|<local>/q|"];
523 [label="Access variable R|/QImplMutable.data|"]; 523 [label="Access variable R|/QImplMutable.data|"];
524 [label="Access variable <Inapplicable(WRONG_RECEIVER): [/MyData.s]>#"]; 524 [label="Access variable <Inapplicable(WRONG_RECEIVER): [/MyData.s]>#"];
525 [label="Function call: R|<local>/q|.R|/QImplMutable.data|.<Inapplicable(WRONG_RECEIVER): [/MyData.s]>#.<Ambiguity: inc, [kotlin/inc, kotlin/inc]>#()"]; 525 [label="Function call: R|<local>/q|.R|/QImplMutable.data|.<Inapplicable(WRONG_RECEIVER): [/MyData.s]>#.<Unresolved name: inc>#()"];
526 [label="Exit block"]; 526 [label="Exit block"];
} }
527 [label="Exit when branch result"]; 527 [label="Exit when branch result"];
@@ -1,3 +1,4 @@
// !DUMP_CFG
// CONTAINS ERRORS // CONTAINS ERRORS
interface A { interface A {
@@ -67,7 +68,7 @@ fun test_5(q: Q?) {
if (q?.data?.s?.inc() != null) { if (q?.data?.s?.inc() != null) {
q.data // good q.data // good
q.data.<!INAPPLICABLE_CANDIDATE!>s<!> // should be bad q.data.<!INAPPLICABLE_CANDIDATE!>s<!> // should be bad
q.data.<!INAPPLICABLE_CANDIDATE!>s<!>.<!AMBIGUITY!>inc<!>() // should be bad q.data.<!INAPPLICABLE_CANDIDATE!>s<!>.<!UNRESOLVED_REFERENCE!>inc<!>() // should be bad
} }
} }
@@ -76,14 +77,14 @@ fun test_6(q: Q?) {
q?.data?.s?.inc() ?: return q?.data?.s?.inc() ?: return
q.data // good q.data // good
q.data.<!INAPPLICABLE_CANDIDATE!>s<!> // should be bad q.data.<!INAPPLICABLE_CANDIDATE!>s<!> // should be bad
q.data.<!INAPPLICABLE_CANDIDATE!>s<!>.<!AMBIGUITY!>inc<!>() // should be bad q.data.<!INAPPLICABLE_CANDIDATE!>s<!>.<!UNRESOLVED_REFERENCE!>inc<!>() // should be bad
} }
fun test_7(q: Q?) { fun test_7(q: Q?) {
if (q?.fdata()?.fs()?.inc() != null) { if (q?.fdata()?.fs()?.inc() != null) {
q.fdata() // good q.fdata() // good
q.fdata().<!INAPPLICABLE_CANDIDATE!>fs<!>() // bad q.fdata().<!INAPPLICABLE_CANDIDATE!>fs<!>() // bad
q.fdata().<!INAPPLICABLE_CANDIDATE!>fs<!>().<!AMBIGUITY!>inc<!>() // bad q.fdata().<!INAPPLICABLE_CANDIDATE!>fs<!>().<!UNRESOLVED_REFERENCE!>inc<!>() // bad
} }
} }
@@ -97,44 +98,44 @@ fun test_9(a: Int, b: Int?) {
if (a == b) { if (a == b) {
b.inc() b.inc()
} }
b.<!AMBIGUITY!>inc<!>() b.<!INAPPLICABLE_CANDIDATE!>inc<!>()
if (a === b) { if (a === b) {
b.inc() b.inc()
} }
b.<!AMBIGUITY!>inc<!>() b.<!INAPPLICABLE_CANDIDATE!>inc<!>()
if (b == a) { if (b == a) {
b.inc() b.inc()
} }
b.<!AMBIGUITY!>inc<!>() b.<!INAPPLICABLE_CANDIDATE!>inc<!>()
if (b === a) { if (b === a) {
b.inc() b.inc()
} }
b.<!AMBIGUITY!>inc<!>() b.<!INAPPLICABLE_CANDIDATE!>inc<!>()
} }
fun test_10(a: Int?, b: Int?) { fun test_10(a: Int?, b: Int?) {
if (a == b) { if (a == b) {
b.<!AMBIGUITY!>inc<!>() b.<!INAPPLICABLE_CANDIDATE!>inc<!>()
} }
b.<!AMBIGUITY!>inc<!>() b.<!INAPPLICABLE_CANDIDATE!>inc<!>()
if (a === b) { if (a === b) {
b.<!AMBIGUITY!>inc<!>() b.<!INAPPLICABLE_CANDIDATE!>inc<!>()
} }
b.<!AMBIGUITY!>inc<!>() b.<!INAPPLICABLE_CANDIDATE!>inc<!>()
if (b == a) { if (b == a) {
b.<!AMBIGUITY!>inc<!>() b.<!INAPPLICABLE_CANDIDATE!>inc<!>()
} }
b.<!AMBIGUITY!>inc<!>() b.<!INAPPLICABLE_CANDIDATE!>inc<!>()
if (b === a) { if (b === a) {
b.<!AMBIGUITY!>inc<!>() b.<!INAPPLICABLE_CANDIDATE!>inc<!>()
} }
b.<!AMBIGUITY!>inc<!>() b.<!INAPPLICABLE_CANDIDATE!>inc<!>()
} }
fun test_11(q: QImpl?, q2: QImpl) { fun test_11(q: QImpl?, q2: QImpl) {
@@ -148,7 +149,7 @@ fun test_11(q: QImpl?, q2: QImpl) {
// Issue: Smartcasting of QImpl.data affects all instances // Issue: Smartcasting of QImpl.data affects all instances
q2.data q2.data
q2.data.<!INAPPLICABLE_CANDIDATE!>s<!> // should be bad q2.data.<!INAPPLICABLE_CANDIDATE!>s<!> // should be bad
q2.data.<!INAPPLICABLE_CANDIDATE!>s<!>.<!AMBIGUITY!>inc<!>() // should be bad q2.data.<!INAPPLICABLE_CANDIDATE!>s<!>.<!UNRESOLVED_REFERENCE!>inc<!>() // should be bad
if (q2.data != null) { if (q2.data != null) {
q2.data.s q2.data.s
@@ -162,7 +163,7 @@ fun test_12(q: QImplWithCustomGetter?) {
if (q?.data?.s?.inc() != null) { if (q?.data?.s?.inc() != null) {
q.data // good q.data // good
q.data.<!INAPPLICABLE_CANDIDATE!>s<!> // should be bad q.data.<!INAPPLICABLE_CANDIDATE!>s<!> // should be bad
q.data.<!INAPPLICABLE_CANDIDATE!>s<!>.<!AMBIGUITY!>inc<!>() // should be bad q.data.<!INAPPLICABLE_CANDIDATE!>s<!>.<!UNRESOLVED_REFERENCE!>inc<!>() // should be bad
} }
} }
@@ -171,6 +172,6 @@ fun test_13(q: QImplMutable?) {
if (q?.data?.s?.inc() != null) { if (q?.data?.s?.inc() != null) {
q.data // good q.data // good
q.data.<!INAPPLICABLE_CANDIDATE!>s<!> // should be bad q.data.<!INAPPLICABLE_CANDIDATE!>s<!> // should be bad
q.data.<!INAPPLICABLE_CANDIDATE!>s<!>.<!AMBIGUITY!>inc<!>() // should be bad q.data.<!INAPPLICABLE_CANDIDATE!>s<!>.<!UNRESOLVED_REFERENCE!>inc<!>() // should be bad
} }
} }
@@ -111,7 +111,7 @@ FILE: nullability.kt
!=(R|<local>/q|?.R|/Q.data|?.R|/MyData.s|?.R|kotlin/Int.inc|(), Null(null)) -> { !=(R|<local>/q|?.R|/Q.data|?.R|/MyData.s|?.R|kotlin/Int.inc|(), Null(null)) -> {
R|<local>/q|.R|/Q.data| R|<local>/q|.R|/Q.data|
R|<local>/q|.R|/Q.data|.<Inapplicable(WRONG_RECEIVER): [/MyData.s]># R|<local>/q|.R|/Q.data|.<Inapplicable(WRONG_RECEIVER): [/MyData.s]>#
R|<local>/q|.R|/Q.data|.<Inapplicable(WRONG_RECEIVER): [/MyData.s]>#.<Ambiguity: inc, [kotlin/inc, kotlin/inc]>#() R|<local>/q|.R|/Q.data|.<Inapplicable(WRONG_RECEIVER): [/MyData.s]>#.<Unresolved name: inc>#()
} }
} }
@@ -128,14 +128,14 @@ FILE: nullability.kt
R|<local>/q|.R|/Q.data| R|<local>/q|.R|/Q.data|
R|<local>/q|.R|/Q.data|.<Inapplicable(WRONG_RECEIVER): [/MyData.s]># R|<local>/q|.R|/Q.data|.<Inapplicable(WRONG_RECEIVER): [/MyData.s]>#
R|<local>/q|.R|/Q.data|.<Inapplicable(WRONG_RECEIVER): [/MyData.s]>#.<Ambiguity: inc, [kotlin/inc, kotlin/inc]>#() R|<local>/q|.R|/Q.data|.<Inapplicable(WRONG_RECEIVER): [/MyData.s]>#.<Unresolved name: inc>#()
} }
public final fun test_7(q: R|Q?|): R|kotlin/Unit| { public final fun test_7(q: R|Q?|): R|kotlin/Unit| {
when () { when () {
!=(R|<local>/q|?.R|/Q.fdata|()?.R|/MyData.fs|()?.R|kotlin/Int.inc|(), Null(null)) -> { !=(R|<local>/q|?.R|/Q.fdata|()?.R|/MyData.fs|()?.R|kotlin/Int.inc|(), Null(null)) -> {
R|<local>/q|.R|/Q.fdata|() R|<local>/q|.R|/Q.fdata|()
R|<local>/q|.R|/Q.fdata|().<Inapplicable(WRONG_RECEIVER): [/MyData.fs]>#() R|<local>/q|.R|/Q.fdata|().<Inapplicable(WRONG_RECEIVER): [/MyData.fs]>#()
R|<local>/q|.R|/Q.fdata|().<Inapplicable(WRONG_RECEIVER): [/MyData.fs]>#().<Ambiguity: inc, [kotlin/inc, kotlin/inc]>#() R|<local>/q|.R|/Q.fdata|().<Inapplicable(WRONG_RECEIVER): [/MyData.fs]>#().<Unresolved name: inc>#()
} }
} }
@@ -155,58 +155,58 @@ FILE: nullability.kt
} }
} }
R|<local>/b|.<Ambiguity: inc, [kotlin/inc, kotlin/inc]>#() R|<local>/b|.<Inapplicable(WRONG_RECEIVER): [kotlin/Int.inc]>#()
when () { when () {
===(R|<local>/a|, R|<local>/b|) -> { ===(R|<local>/a|, R|<local>/b|) -> {
R|<local>/b|.R|kotlin/Int.inc|() R|<local>/b|.R|kotlin/Int.inc|()
} }
} }
R|<local>/b|.<Ambiguity: inc, [kotlin/inc, kotlin/inc]>#() R|<local>/b|.<Inapplicable(WRONG_RECEIVER): [kotlin/Int.inc]>#()
when () { when () {
==(R|<local>/b|, R|<local>/a|) -> { ==(R|<local>/b|, R|<local>/a|) -> {
R|<local>/b|.R|kotlin/Int.inc|() R|<local>/b|.R|kotlin/Int.inc|()
} }
} }
R|<local>/b|.<Ambiguity: inc, [kotlin/inc, kotlin/inc]>#() R|<local>/b|.<Inapplicable(WRONG_RECEIVER): [kotlin/Int.inc]>#()
when () { when () {
===(R|<local>/b|, R|<local>/a|) -> { ===(R|<local>/b|, R|<local>/a|) -> {
R|<local>/b|.R|kotlin/Int.inc|() R|<local>/b|.R|kotlin/Int.inc|()
} }
} }
R|<local>/b|.<Ambiguity: inc, [kotlin/inc, kotlin/inc]>#() R|<local>/b|.<Inapplicable(WRONG_RECEIVER): [kotlin/Int.inc]>#()
} }
public final fun test_10(a: R|kotlin/Int?|, b: R|kotlin/Int?|): R|kotlin/Unit| { public final fun test_10(a: R|kotlin/Int?|, b: R|kotlin/Int?|): R|kotlin/Unit| {
when () { when () {
==(R|<local>/a|, R|<local>/b|) -> { ==(R|<local>/a|, R|<local>/b|) -> {
R|<local>/b|.<Ambiguity: inc, [kotlin/inc, kotlin/inc]>#() R|<local>/b|.<Inapplicable(WRONG_RECEIVER): [kotlin/Int.inc]>#()
} }
} }
R|<local>/b|.<Ambiguity: inc, [kotlin/inc, kotlin/inc]>#() R|<local>/b|.<Inapplicable(WRONG_RECEIVER): [kotlin/Int.inc]>#()
when () { when () {
===(R|<local>/a|, R|<local>/b|) -> { ===(R|<local>/a|, R|<local>/b|) -> {
R|<local>/b|.<Ambiguity: inc, [kotlin/inc, kotlin/inc]>#() R|<local>/b|.<Inapplicable(WRONG_RECEIVER): [kotlin/Int.inc]>#()
} }
} }
R|<local>/b|.<Ambiguity: inc, [kotlin/inc, kotlin/inc]>#() R|<local>/b|.<Inapplicable(WRONG_RECEIVER): [kotlin/Int.inc]>#()
when () { when () {
==(R|<local>/b|, R|<local>/a|) -> { ==(R|<local>/b|, R|<local>/a|) -> {
R|<local>/b|.<Ambiguity: inc, [kotlin/inc, kotlin/inc]>#() R|<local>/b|.<Inapplicable(WRONG_RECEIVER): [kotlin/Int.inc]>#()
} }
} }
R|<local>/b|.<Ambiguity: inc, [kotlin/inc, kotlin/inc]>#() R|<local>/b|.<Inapplicable(WRONG_RECEIVER): [kotlin/Int.inc]>#()
when () { when () {
===(R|<local>/b|, R|<local>/a|) -> { ===(R|<local>/b|, R|<local>/a|) -> {
R|<local>/b|.<Ambiguity: inc, [kotlin/inc, kotlin/inc]>#() R|<local>/b|.<Inapplicable(WRONG_RECEIVER): [kotlin/Int.inc]>#()
} }
} }
R|<local>/b|.<Ambiguity: inc, [kotlin/inc, kotlin/inc]>#() R|<local>/b|.<Inapplicable(WRONG_RECEIVER): [kotlin/Int.inc]>#()
} }
public final fun test_11(q: R|QImpl?|, q2: R|QImpl|): R|kotlin/Unit| { public final fun test_11(q: R|QImpl?|, q2: R|QImpl|): R|kotlin/Unit| {
when () { when () {
@@ -216,7 +216,7 @@ FILE: nullability.kt
R|<local>/q|.R|/QImpl.data|.R|/MyData.s|.R|kotlin/Int.inc|() R|<local>/q|.R|/QImpl.data|.R|/MyData.s|.R|kotlin/Int.inc|()
R|<local>/q2|.R|/QImpl.data| R|<local>/q2|.R|/QImpl.data|
R|<local>/q2|.R|/QImpl.data|.<Inapplicable(WRONG_RECEIVER): [/MyData.s]># R|<local>/q2|.R|/QImpl.data|.<Inapplicable(WRONG_RECEIVER): [/MyData.s]>#
R|<local>/q2|.R|/QImpl.data|.<Inapplicable(WRONG_RECEIVER): [/MyData.s]>#.<Ambiguity: inc, [kotlin/inc, kotlin/inc]>#() R|<local>/q2|.R|/QImpl.data|.<Inapplicable(WRONG_RECEIVER): [/MyData.s]>#.<Unresolved name: inc>#()
when () { when () {
!=(R|<local>/q2|.R|/QImpl.data|, Null(null)) -> { !=(R|<local>/q2|.R|/QImpl.data|, Null(null)) -> {
R|<local>/q2|.R|/QImpl.data|.R|/MyData.s| R|<local>/q2|.R|/QImpl.data|.R|/MyData.s|
@@ -233,7 +233,7 @@ FILE: nullability.kt
!=(R|<local>/q|?.R|/QImplWithCustomGetter.data|?.R|/MyData.s|?.R|kotlin/Int.inc|(), Null(null)) -> { !=(R|<local>/q|?.R|/QImplWithCustomGetter.data|?.R|/MyData.s|?.R|kotlin/Int.inc|(), Null(null)) -> {
R|<local>/q|.R|/QImplWithCustomGetter.data| R|<local>/q|.R|/QImplWithCustomGetter.data|
R|<local>/q|.R|/QImplWithCustomGetter.data|.<Inapplicable(WRONG_RECEIVER): [/MyData.s]># R|<local>/q|.R|/QImplWithCustomGetter.data|.<Inapplicable(WRONG_RECEIVER): [/MyData.s]>#
R|<local>/q|.R|/QImplWithCustomGetter.data|.<Inapplicable(WRONG_RECEIVER): [/MyData.s]>#.<Ambiguity: inc, [kotlin/inc, kotlin/inc]>#() R|<local>/q|.R|/QImplWithCustomGetter.data|.<Inapplicable(WRONG_RECEIVER): [/MyData.s]>#.<Unresolved name: inc>#()
} }
} }
@@ -243,7 +243,7 @@ FILE: nullability.kt
!=(R|<local>/q|?.R|/QImplMutable.data|?.R|/MyData.s|?.R|kotlin/Int.inc|(), Null(null)) -> { !=(R|<local>/q|?.R|/QImplMutable.data|?.R|/MyData.s|?.R|kotlin/Int.inc|(), Null(null)) -> {
R|<local>/q|.R|/QImplMutable.data| R|<local>/q|.R|/QImplMutable.data|
R|<local>/q|.R|/QImplMutable.data|.<Inapplicable(WRONG_RECEIVER): [/MyData.s]># R|<local>/q|.R|/QImplMutable.data|.<Inapplicable(WRONG_RECEIVER): [/MyData.s]>#
R|<local>/q|.R|/QImplMutable.data|.<Inapplicable(WRONG_RECEIVER): [/MyData.s]>#.<Ambiguity: inc, [kotlin/inc, kotlin/inc]>#() R|<local>/q|.R|/QImplMutable.data|.<Inapplicable(WRONG_RECEIVER): [/MyData.s]>#.<Unresolved name: inc>#()
} }
} }
@@ -1,3 +1,4 @@
// !DUMP_CFG
fun <X> test_1(a: X) { fun <X> test_1(a: X) {
if (a is String?) { if (a is String?) {
<!INAPPLICABLE_CANDIDATE!>takeString<!>(a!!) <!INAPPLICABLE_CANDIDATE!>takeString<!>(a!!)
@@ -1,3 +1,4 @@
// !DUMP_CFG
fun Any.test_1(): Int = when (this) { fun Any.test_1(): Int = when (this) {
is List<*> -> this.size is List<*> -> this.size
is String -> length is String -> length
@@ -1,3 +1,4 @@
// !DUMP_CFG
class A { class A {
fun foo() {} fun foo() {}
} }
@@ -1,3 +1,4 @@
// !DUMP_CFG
interface A interface A
interface B { interface B {
@@ -9,4 +10,3 @@ val A.check_1: Boolean
val A.check_2: Boolean val A.check_2: Boolean
get() = this is B && this.b get() = this is B && this.b
// 1713
@@ -1,3 +1,4 @@
// !DUMP_CFG
// ----------------- Stable ----------------- // ----------------- Stable -----------------
class A { class A {
@@ -5,286 +5,301 @@ digraph safeCallAndEqualityToBool_kt {
subgraph cluster_0 { subgraph cluster_0 {
color=red color=red
0 [label="Enter function test_1" style="filled" fillcolor=red]; 0 [label="Enter function check" style="filled" fillcolor=red];
subgraph cluster_1 { 1 [label="Const: Boolean(true)"];
color=blue 2 [label="Jump: ^check Boolean(true)"];
1 [label="Enter when"]; 3 [label="Stub" style="filled" fillcolor=gray];
subgraph cluster_2 { 4 [label="Exit function check" style="filled" fillcolor=red];
color=blue
2 [label="Enter when branch condition "];
3 [label="Access variable R|<local>/s|"];
4 [label="Enter safe call"];
5 [label="Function call: R|<local>/s|?.R|kotlin/text/isNotEmpty|()"];
6 [label="Exit safe call"];
7 [label="Const: Boolean(true)"];
8 [label="Operator =="];
9 [label="Exit when branch condition"];
}
subgraph cluster_3 {
color=blue
10 [label="Enter when branch condition else"];
11 [label="Exit when branch condition"];
}
12 [label="Enter when branch result"];
subgraph cluster_4 {
color=blue
13 [label="Enter block"];
14 [label="Access variable R|<local>/s|"];
15 [label="Access variable <Inapplicable(WRONG_RECEIVER): [kotlin/String.length]>#"];
16 [label="Exit block"];
}
17 [label="Exit when branch result"];
18 [label="Enter when branch result"];
subgraph cluster_5 {
color=blue
19 [label="Enter block"];
20 [label="Access variable R|<local>/s|"];
21 [label="Access variable R|kotlin/String.length|"];
22 [label="Exit block"];
}
23 [label="Exit when branch result"];
24 [label="Exit when"];
}
25 [label="Exit function test_1" style="filled" fillcolor=red];
} }
0 -> {1}; 0 -> {1};
1 -> {2}; 1 -> {2};
2 -> {3}; 2 -> {4};
3 -> {4 6}; 2 -> {3} [style=dotted];
4 -> {5}; 3 -> {4} [style=dotted];
subgraph cluster_1 {
color=red
5 [label="Enter function test_1" style="filled" fillcolor=red];
subgraph cluster_2 {
color=blue
6 [label="Enter when"];
subgraph cluster_3 {
color=blue
7 [label="Enter when branch condition "];
8 [label="Access variable R|<local>/s|"];
9 [label="Enter safe call"];
10 [label="Function call: R|<local>/s|?.R|/check|()"];
11 [label="Exit safe call"];
12 [label="Const: Boolean(true)"];
13 [label="Operator =="];
14 [label="Exit when branch condition"];
}
subgraph cluster_4 {
color=blue
15 [label="Enter when branch condition else"];
16 [label="Exit when branch condition"];
}
17 [label="Enter when branch result"];
subgraph cluster_5 {
color=blue
18 [label="Enter block"];
19 [label="Access variable R|<local>/s|"];
20 [label="Access variable <Inapplicable(WRONG_RECEIVER): [kotlin/String.length]>#"];
21 [label="Exit block"];
}
22 [label="Exit when branch result"];
23 [label="Enter when branch result"];
subgraph cluster_6 {
color=blue
24 [label="Enter block"];
25 [label="Access variable R|<local>/s|"];
26 [label="Access variable R|kotlin/String.length|"];
27 [label="Exit block"];
}
28 [label="Exit when branch result"];
29 [label="Exit when"];
}
30 [label="Exit function test_1" style="filled" fillcolor=red];
}
5 -> {6}; 5 -> {6};
6 -> {7}; 6 -> {7};
7 -> {8}; 7 -> {8};
8 -> {9}; 8 -> {9 11};
9 -> {18 10}; 9 -> {10};
10 -> {11}; 10 -> {11};
11 -> {12}; 11 -> {12};
12 -> {13}; 12 -> {13};
13 -> {14}; 13 -> {14};
14 -> {15}; 14 -> {23 15};
15 -> {16}; 15 -> {16};
16 -> {17}; 16 -> {17};
17 -> {24}; 17 -> {18};
18 -> {19}; 18 -> {19};
19 -> {20}; 19 -> {20};
20 -> {21}; 20 -> {21};
21 -> {22}; 21 -> {22};
22 -> {23}; 22 -> {29};
23 -> {24}; 23 -> {24};
24 -> {25}; 24 -> {25};
25 -> {26};
subgraph cluster_6 {
color=red
26 [label="Enter function test_2" style="filled" fillcolor=red];
subgraph cluster_7 {
color=blue
27 [label="Enter when"];
subgraph cluster_8 {
color=blue
28 [label="Enter when branch condition "];
29 [label="Access variable R|<local>/s|"];
30 [label="Enter safe call"];
31 [label="Function call: R|<local>/s|?.R|kotlin/text/isNotEmpty|()"];
32 [label="Exit safe call"];
33 [label="Const: Boolean(false)"];
34 [label="Operator =="];
35 [label="Exit when branch condition"];
}
subgraph cluster_9 {
color=blue
36 [label="Enter when branch condition else"];
37 [label="Exit when branch condition"];
}
38 [label="Enter when branch result"];
subgraph cluster_10 {
color=blue
39 [label="Enter block"];
40 [label="Access variable R|<local>/s|"];
41 [label="Access variable <Inapplicable(WRONG_RECEIVER): [kotlin/String.length]>#"];
42 [label="Exit block"];
}
43 [label="Exit when branch result"];
44 [label="Enter when branch result"];
subgraph cluster_11 {
color=blue
45 [label="Enter block"];
46 [label="Access variable R|<local>/s|"];
47 [label="Access variable R|kotlin/String.length|"];
48 [label="Exit block"];
}
49 [label="Exit when branch result"];
50 [label="Exit when"];
}
51 [label="Exit function test_2" style="filled" fillcolor=red];
}
26 -> {27}; 26 -> {27};
27 -> {28}; 27 -> {28};
28 -> {29}; 28 -> {29};
29 -> {30 32}; 29 -> {30};
30 -> {31};
subgraph cluster_7 {
color=red
31 [label="Enter function test_2" style="filled" fillcolor=red];
subgraph cluster_8 {
color=blue
32 [label="Enter when"];
subgraph cluster_9 {
color=blue
33 [label="Enter when branch condition "];
34 [label="Access variable R|<local>/s|"];
35 [label="Enter safe call"];
36 [label="Function call: R|<local>/s|?.R|/check|()"];
37 [label="Exit safe call"];
38 [label="Const: Boolean(false)"];
39 [label="Operator =="];
40 [label="Exit when branch condition"];
}
subgraph cluster_10 {
color=blue
41 [label="Enter when branch condition else"];
42 [label="Exit when branch condition"];
}
43 [label="Enter when branch result"];
subgraph cluster_11 {
color=blue
44 [label="Enter block"];
45 [label="Access variable R|<local>/s|"];
46 [label="Access variable <Inapplicable(WRONG_RECEIVER): [kotlin/String.length]>#"];
47 [label="Exit block"];
}
48 [label="Exit when branch result"];
49 [label="Enter when branch result"];
subgraph cluster_12 {
color=blue
50 [label="Enter block"];
51 [label="Access variable R|<local>/s|"];
52 [label="Access variable R|kotlin/String.length|"];
53 [label="Exit block"];
}
54 [label="Exit when branch result"];
55 [label="Exit when"];
}
56 [label="Exit function test_2" style="filled" fillcolor=red];
}
31 -> {32}; 31 -> {32};
32 -> {33}; 32 -> {33};
33 -> {34}; 33 -> {34};
34 -> {35}; 34 -> {35 37};
35 -> {44 36}; 35 -> {36};
36 -> {37}; 36 -> {37};
37 -> {38}; 37 -> {38};
38 -> {39}; 38 -> {39};
39 -> {40}; 39 -> {40};
40 -> {41}; 40 -> {49 41};
41 -> {42}; 41 -> {42};
42 -> {43}; 42 -> {43};
43 -> {50}; 43 -> {44};
44 -> {45}; 44 -> {45};
45 -> {46}; 45 -> {46};
46 -> {47}; 46 -> {47};
47 -> {48}; 47 -> {48};
48 -> {49}; 48 -> {55};
49 -> {50}; 49 -> {50};
50 -> {51}; 50 -> {51};
51 -> {52};
subgraph cluster_12 {
color=red
52 [label="Enter function test_3" style="filled" fillcolor=red];
subgraph cluster_13 {
color=blue
53 [label="Enter when"];
subgraph cluster_14 {
color=blue
54 [label="Enter when branch condition "];
55 [label="Access variable R|<local>/s|"];
56 [label="Enter safe call"];
57 [label="Function call: R|<local>/s|?.R|kotlin/text/isNotEmpty|()"];
58 [label="Exit safe call"];
59 [label="Const: Boolean(true)"];
60 [label="Operator !="];
61 [label="Exit when branch condition"];
}
subgraph cluster_15 {
color=blue
62 [label="Enter when branch condition else"];
63 [label="Exit when branch condition"];
}
64 [label="Enter when branch result"];
subgraph cluster_16 {
color=blue
65 [label="Enter block"];
66 [label="Access variable R|<local>/s|"];
67 [label="Access variable R|kotlin/String.length|"];
68 [label="Exit block"];
}
69 [label="Exit when branch result"];
70 [label="Enter when branch result"];
subgraph cluster_17 {
color=blue
71 [label="Enter block"];
72 [label="Access variable R|<local>/s|"];
73 [label="Access variable <Inapplicable(WRONG_RECEIVER): [kotlin/String.length]>#"];
74 [label="Exit block"];
}
75 [label="Exit when branch result"];
76 [label="Exit when"];
}
77 [label="Exit function test_3" style="filled" fillcolor=red];
}
52 -> {53}; 52 -> {53};
53 -> {54}; 53 -> {54};
54 -> {55}; 54 -> {55};
55 -> {56 58}; 55 -> {56};
56 -> {57};
subgraph cluster_13 {
color=red
57 [label="Enter function test_3" style="filled" fillcolor=red];
subgraph cluster_14 {
color=blue
58 [label="Enter when"];
subgraph cluster_15 {
color=blue
59 [label="Enter when branch condition "];
60 [label="Access variable R|<local>/s|"];
61 [label="Enter safe call"];
62 [label="Function call: R|<local>/s|?.R|/check|()"];
63 [label="Exit safe call"];
64 [label="Const: Boolean(true)"];
65 [label="Operator !="];
66 [label="Exit when branch condition"];
}
subgraph cluster_16 {
color=blue
67 [label="Enter when branch condition else"];
68 [label="Exit when branch condition"];
}
69 [label="Enter when branch result"];
subgraph cluster_17 {
color=blue
70 [label="Enter block"];
71 [label="Access variable R|<local>/s|"];
72 [label="Access variable R|kotlin/String.length|"];
73 [label="Exit block"];
}
74 [label="Exit when branch result"];
75 [label="Enter when branch result"];
subgraph cluster_18 {
color=blue
76 [label="Enter block"];
77 [label="Access variable R|<local>/s|"];
78 [label="Access variable <Inapplicable(WRONG_RECEIVER): [kotlin/String.length]>#"];
79 [label="Exit block"];
}
80 [label="Exit when branch result"];
81 [label="Exit when"];
}
82 [label="Exit function test_3" style="filled" fillcolor=red];
}
57 -> {58}; 57 -> {58};
58 -> {59}; 58 -> {59};
59 -> {60}; 59 -> {60};
60 -> {61}; 60 -> {61 63};
61 -> {70 62}; 61 -> {62};
62 -> {63}; 62 -> {63};
63 -> {64}; 63 -> {64};
64 -> {65}; 64 -> {65};
65 -> {66}; 65 -> {66};
66 -> {67}; 66 -> {75 67};
67 -> {68}; 67 -> {68};
68 -> {69}; 68 -> {69};
69 -> {76}; 69 -> {70};
70 -> {71}; 70 -> {71};
71 -> {72}; 71 -> {72};
72 -> {73}; 72 -> {73};
73 -> {74}; 73 -> {74};
74 -> {75}; 74 -> {81};
75 -> {76}; 75 -> {76};
76 -> {77}; 76 -> {77};
77 -> {78};
subgraph cluster_18 {
color=red
78 [label="Enter function test_4" style="filled" fillcolor=red];
subgraph cluster_19 {
color=blue
79 [label="Enter when"];
subgraph cluster_20 {
color=blue
80 [label="Enter when branch condition "];
81 [label="Access variable R|<local>/s|"];
82 [label="Enter safe call"];
83 [label="Function call: R|<local>/s|?.R|kotlin/text/isNotEmpty|()"];
84 [label="Exit safe call"];
85 [label="Const: Boolean(false)"];
86 [label="Operator !="];
87 [label="Exit when branch condition"];
}
subgraph cluster_21 {
color=blue
88 [label="Enter when branch condition else"];
89 [label="Exit when branch condition"];
}
90 [label="Enter when branch result"];
subgraph cluster_22 {
color=blue
91 [label="Enter block"];
92 [label="Access variable R|<local>/s|"];
93 [label="Access variable R|kotlin/String.length|"];
94 [label="Exit block"];
}
95 [label="Exit when branch result"];
96 [label="Enter when branch result"];
subgraph cluster_23 {
color=blue
97 [label="Enter block"];
98 [label="Access variable R|<local>/s|"];
99 [label="Access variable <Inapplicable(WRONG_RECEIVER): [kotlin/String.length]>#"];
100 [label="Exit block"];
}
101 [label="Exit when branch result"];
102 [label="Exit when"];
}
103 [label="Exit function test_4" style="filled" fillcolor=red];
}
78 -> {79}; 78 -> {79};
79 -> {80}; 79 -> {80};
80 -> {81}; 80 -> {81};
81 -> {82 84}; 81 -> {82};
82 -> {83};
subgraph cluster_19 {
color=red
83 [label="Enter function test_4" style="filled" fillcolor=red];
subgraph cluster_20 {
color=blue
84 [label="Enter when"];
subgraph cluster_21 {
color=blue
85 [label="Enter when branch condition "];
86 [label="Access variable R|<local>/s|"];
87 [label="Enter safe call"];
88 [label="Function call: R|<local>/s|?.R|/check|()"];
89 [label="Exit safe call"];
90 [label="Const: Boolean(false)"];
91 [label="Operator !="];
92 [label="Exit when branch condition"];
}
subgraph cluster_22 {
color=blue
93 [label="Enter when branch condition else"];
94 [label="Exit when branch condition"];
}
95 [label="Enter when branch result"];
subgraph cluster_23 {
color=blue
96 [label="Enter block"];
97 [label="Access variable R|<local>/s|"];
98 [label="Access variable R|kotlin/String.length|"];
99 [label="Exit block"];
}
100 [label="Exit when branch result"];
101 [label="Enter when branch result"];
subgraph cluster_24 {
color=blue
102 [label="Enter block"];
103 [label="Access variable R|<local>/s|"];
104 [label="Access variable <Inapplicable(WRONG_RECEIVER): [kotlin/String.length]>#"];
105 [label="Exit block"];
}
106 [label="Exit when branch result"];
107 [label="Exit when"];
}
108 [label="Exit function test_4" style="filled" fillcolor=red];
}
83 -> {84}; 83 -> {84};
84 -> {85}; 84 -> {85};
85 -> {86}; 85 -> {86};
86 -> {87}; 86 -> {87 89};
87 -> {96 88}; 87 -> {88};
88 -> {89}; 88 -> {89};
89 -> {90}; 89 -> {90};
90 -> {91}; 90 -> {91};
91 -> {92}; 91 -> {92};
92 -> {93}; 92 -> {101 93};
93 -> {94}; 93 -> {94};
94 -> {95}; 94 -> {95};
95 -> {102}; 95 -> {96};
96 -> {97}; 96 -> {97};
97 -> {98}; 97 -> {98};
98 -> {99}; 98 -> {99};
99 -> {100}; 99 -> {100};
100 -> {101}; 100 -> {107};
101 -> {102}; 101 -> {102};
102 -> {103}; 102 -> {103};
103 -> {104};
104 -> {105};
105 -> {106};
106 -> {107};
107 -> {108};
} }
@@ -1,5 +1,8 @@
// !DUMP_CFG
fun String.check(): Boolean = true
fun test_1(s: String?) { fun test_1(s: String?) {
if (s?.isNotEmpty() == true) { if (s?.check() == true) {
s.length // Should be OK s.length // Should be OK
} else { } else {
s.<!INAPPLICABLE_CANDIDATE!>length<!> // Should be bad s.<!INAPPLICABLE_CANDIDATE!>length<!> // Should be bad
@@ -7,7 +10,7 @@ fun test_1(s: String?) {
} }
fun test_2(s: String?) { fun test_2(s: String?) {
if (s?.isNotEmpty() == false) { if (s?.check() == false) {
s.length // Should be OK s.length // Should be OK
} else { } else {
s.<!INAPPLICABLE_CANDIDATE!>length<!> // Should be bad s.<!INAPPLICABLE_CANDIDATE!>length<!> // Should be bad
@@ -15,7 +18,7 @@ fun test_2(s: String?) {
} }
fun test_3(s: String?) { fun test_3(s: String?) {
if (s?.isNotEmpty() != true) { if (s?.check() != true) {
s.<!INAPPLICABLE_CANDIDATE!>length<!> // Should be bad s.<!INAPPLICABLE_CANDIDATE!>length<!> // Should be bad
} else { } else {
s.length // Should be OK s.length // Should be OK
@@ -23,7 +26,7 @@ fun test_3(s: String?) {
} }
fun test_4(s: String?) { fun test_4(s: String?) {
if (s?.isNotEmpty() != false) { if (s?.check() != false) {
s.<!INAPPLICABLE_CANDIDATE!>length<!> // Should be bad s.<!INAPPLICABLE_CANDIDATE!>length<!> // Should be bad
} else { } else {
s.length // Should be OK s.length // Should be OK
@@ -1,7 +1,10 @@
FILE: safeCallAndEqualityToBool.kt FILE: safeCallAndEqualityToBool.kt
public final fun R|kotlin/String|.check(): R|kotlin/Boolean| {
^check Boolean(true)
}
public final fun test_1(s: R|kotlin/String?|): R|kotlin/Unit| { public final fun test_1(s: R|kotlin/String?|): R|kotlin/Unit| {
when () { when () {
==(R|<local>/s|?.R|kotlin/text/isNotEmpty|(), Boolean(true)) -> { ==(R|<local>/s|?.R|/check|(), Boolean(true)) -> {
R|<local>/s|.R|kotlin/String.length| R|<local>/s|.R|kotlin/String.length|
} }
else -> { else -> {
@@ -12,7 +15,7 @@ FILE: safeCallAndEqualityToBool.kt
} }
public final fun test_2(s: R|kotlin/String?|): R|kotlin/Unit| { public final fun test_2(s: R|kotlin/String?|): R|kotlin/Unit| {
when () { when () {
==(R|<local>/s|?.R|kotlin/text/isNotEmpty|(), Boolean(false)) -> { ==(R|<local>/s|?.R|/check|(), Boolean(false)) -> {
R|<local>/s|.R|kotlin/String.length| R|<local>/s|.R|kotlin/String.length|
} }
else -> { else -> {
@@ -23,7 +26,7 @@ FILE: safeCallAndEqualityToBool.kt
} }
public final fun test_3(s: R|kotlin/String?|): R|kotlin/Unit| { public final fun test_3(s: R|kotlin/String?|): R|kotlin/Unit| {
when () { when () {
!=(R|<local>/s|?.R|kotlin/text/isNotEmpty|(), Boolean(true)) -> { !=(R|<local>/s|?.R|/check|(), Boolean(true)) -> {
R|<local>/s|.<Inapplicable(WRONG_RECEIVER): [kotlin/String.length]># R|<local>/s|.<Inapplicable(WRONG_RECEIVER): [kotlin/String.length]>#
} }
else -> { else -> {
@@ -34,7 +37,7 @@ FILE: safeCallAndEqualityToBool.kt
} }
public final fun test_4(s: R|kotlin/String?|): R|kotlin/Unit| { public final fun test_4(s: R|kotlin/String?|): R|kotlin/Unit| {
when () { when () {
!=(R|<local>/s|?.R|kotlin/text/isNotEmpty|(), Boolean(false)) -> { !=(R|<local>/s|?.R|/check|(), Boolean(false)) -> {
R|<local>/s|.<Inapplicable(WRONG_RECEIVER): [kotlin/String.length]># R|<local>/s|.<Inapplicable(WRONG_RECEIVER): [kotlin/String.length]>#
} }
else -> { else -> {
@@ -1,3 +1,4 @@
// !DUMP_CFG
fun String.foo(b: Boolean): String = "" fun String.foo(b: Boolean): String = ""
fun String.let(block: () -> Unit) {} fun String.let(block: () -> Unit) {}
@@ -1,3 +1,4 @@
// !DUMP_CFG
interface I interface I
interface S : I { interface S : I {
fun foo() fun foo()
@@ -1,3 +1,4 @@
// !DUMP_CFG
fun getNothing(): Nothing = throw Exception() fun getNothing(): Nothing = throw Exception()
fun getNullableNothing(): Nothing? = null fun getNullableNothing(): Nothing? = null
@@ -1,3 +1,4 @@
// !DUMP_CFG
open class A(open val x: Any) open class A(open val x: Any)
class B(x: Any) : A(x) { class B(x: Any) : A(x) {
@@ -1,3 +1,4 @@
// !DUMP_CFG
class A { class A {
fun foo() {} fun foo() {}
} }
@@ -1,3 +1,4 @@
// !DUMP_CFG
fun test_1() { fun test_1() {
var x: Any = 1 var x: Any = 1
x = "" x = ""
@@ -1,3 +1,4 @@
// !DUMP_CFG
fun test() { fun test() {
val x: Int val x: Int
run { run {
@@ -1,3 +1,4 @@
// !DUMP_CFG
fun test_1(x: Any) { fun test_1(x: Any) {
require(x is Int) require(x is Int)
x.inc() x.inc()
@@ -1,3 +1,4 @@
// !DUMP_CFG
// FULL_JDK // FULL_JDK
fun <T> List<T>.notInPlaceFilter(block: (T) -> Boolean): List<T> = this fun <T> List<T>.notInPlaceFilter(block: (T) -> Boolean): List<T> = this
@@ -1,14 +0,0 @@
/*
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.fir
import org.jetbrains.kotlin.test.ConfigurationKind
abstract class AbstractFirDiagnosticsWithCfgAndStdlibTest : AbstractFirDiagnosticsWithCfgTest() {
override fun getConfigurationKind(): ConfigurationKind {
return ConfigurationKind.ALL
}
}
@@ -5,14 +5,49 @@
package org.jetbrains.kotlin.fir package org.jetbrains.kotlin.fir
import junit.framework.TestCase
import org.jetbrains.kotlin.fir.declarations.FirFile import org.jetbrains.kotlin.fir.declarations.FirFile
import org.jetbrains.kotlin.fir.references.FirControlFlowGraphReference
import org.jetbrains.kotlin.fir.resolve.dfa.FirControlFlowGraphReferenceImpl
import org.jetbrains.kotlin.fir.resolve.dfa.cfg.CFGNode
import org.jetbrains.kotlin.fir.resolve.dfa.cfg.ControlFlowGraph
import org.jetbrains.kotlin.fir.resolve.dfa.cfg.EdgeKind
import org.jetbrains.kotlin.fir.resolve.dfa.cfg.FirControlFlowGraphRenderVisitor
import org.jetbrains.kotlin.fir.resolve.diagnostics.collectors.AbstractDiagnosticCollector import org.jetbrains.kotlin.fir.resolve.diagnostics.collectors.AbstractDiagnosticCollector
import org.jetbrains.kotlin.fir.resolve.diagnostics.collectors.FirDiagnosticsCollector import org.jetbrains.kotlin.fir.resolve.diagnostics.collectors.FirDiagnosticsCollector
import org.jetbrains.kotlin.fir.resolve.transformers.FirTotalResolveTransformer import org.jetbrains.kotlin.fir.resolve.transformers.FirTotalResolveTransformer
import org.jetbrains.kotlin.fir.visitors.FirVisitorVoid
import org.jetbrains.kotlin.test.KotlinTestUtils import org.jetbrains.kotlin.test.KotlinTestUtils
import org.jetbrains.kotlin.test.testFramework.KtUsefulTestCase
import java.io.File import java.io.File
/*
* For comfort viewing dumps of control flow graph you can setup external tool in IDEA that opens .dot files
*
* Example of config for `xdot` viewer:
*
* File -> Settings -> External tools -> Add
*
* Name: XDot
* Program: xdot
* Arguments: $FileNameWithoutExtension$.dot
* Working directory: $FileDir$
* Disable "Open console for tool output"
*
* After that you can run action `XDot` in editor with source of test (or with cfg dump)
* and it will opens xdot with dump for that test
*/
abstract class AbstractFirDiagnosticsTest : AbstractFirBaseDiagnosticsTest() { abstract class AbstractFirDiagnosticsTest : AbstractFirBaseDiagnosticsTest() {
companion object {
val DUMP_CFG_DIRECTIVE = "DUMP_CFG"
val TestFile.withDumpCfgDirective: Boolean
get() = DUMP_CFG_DIRECTIVE in directives
val File.cfgDumpFile: File
get() = File(absolutePath.replace(".kt", ".dot"))
}
override fun runAnalysis(testDataFile: File, testFiles: List<TestFile>, firFilesPerSession: Map<FirSession, List<FirFile>>) { override fun runAnalysis(testDataFile: File, testFiles: List<TestFile>, firFilesPerSession: Map<FirSession, List<FirFile>>) {
for ((_, firFiles) in firFilesPerSession) { for ((_, firFiles) in firFilesPerSession) {
doFirResolveTestBench( doFirResolveTestBench(
@@ -24,6 +59,13 @@ abstract class AbstractFirDiagnosticsTest : AbstractFirBaseDiagnosticsTest() {
val allFirFiles = firFilesPerSession.values.flatten() val allFirFiles = firFilesPerSession.values.flatten()
checkDiagnostics(testDataFile, testFiles, allFirFiles) checkDiagnostics(testDataFile, testFiles, allFirFiles)
checkFir(testDataFile, allFirFiles) checkFir(testDataFile, allFirFiles)
if (testFiles.any { it.withDumpCfgDirective }) {
checkCfg(testDataFile, allFirFiles)
checkCfgEdgeConsistency(allFirFiles)
} else {
checkCfgDumpNotExists(testDataFile)
}
} }
fun checkFir(testDataFile: File, firFiles: List<FirFile>) { fun checkFir(testDataFile: File, firFiles: List<FirFile>) {
@@ -53,4 +95,63 @@ abstract class AbstractFirDiagnosticsTest : AbstractFirBaseDiagnosticsTest() {
protected fun createCollector(): AbstractDiagnosticCollector { protected fun createCollector(): AbstractDiagnosticCollector {
return FirDiagnosticsCollector.create() return FirDiagnosticsCollector.create()
} }
private fun checkCfg(testDataFile: File, firFiles: List<FirFile>) {
val builder = StringBuilder()
firFiles.first().accept(FirControlFlowGraphRenderVisitor(builder), null)
val dotCfgDump = builder.toString()
KotlinTestUtils.assertEqualsToFile(testDataFile.cfgDumpFile, dotCfgDump)
}
private fun checkCfgEdgeConsistency(firFiles: List<FirFile>) {
firFiles.forEach { it.accept(CfgConsistencyChecker) }
}
private object CfgConsistencyChecker : FirVisitorVoid() {
override fun visitElement(element: FirElement) {
element.acceptChildren(this)
}
override fun visitControlFlowGraphReference(controlFlowGraphReference: FirControlFlowGraphReference) {
val graph = (controlFlowGraphReference as? FirControlFlowGraphReferenceImpl)?.controlFlowGraph ?: return
checkConsistency(graph)
}
private fun checkConsistency(graph: ControlFlowGraph) {
for (node in graph.nodes) {
for (to in node.followingNodes) {
checkEdge(node, to)
}
for (from in node.previousNodes) {
checkEdge(from, node)
}
TestCase.assertTrue(node.followingNodes.isNotEmpty() || node.previousNodes.isNotEmpty())
}
}
private fun checkEdge(from: CFGNode<*>, to: CFGNode<*>) {
KtUsefulTestCase.assertContainsElements(from.followingNodes, to)
KtUsefulTestCase.assertContainsElements(to.previousNodes, from)
val fromKind = from.outgoingEdges.getValue(to)
val toKind = to.incomingEdges.getValue(from)
TestCase.assertEquals(fromKind, toKind)
if (from.isDead || to.isDead) {
KtUsefulTestCase.assertContainsElements(listOf(EdgeKind.Dead, EdgeKind.Cfg), toKind)
}
}
}
private fun checkCfgDumpNotExists(testDataFile: File) {
val cfgDumpFile = testDataFile.cfgDumpFile
if (cfgDumpFile.exists()) {
val message = """
Directive `!$DUMP_CFG_DIRECTIVE` is missing, but file with cfg dump is present.
Please remove ${cfgDumpFile.path} or add `!$DUMP_CFG_DIRECTIVE` to test
""".trimIndent()
kotlin.test.fail(message)
}
}
} }
@@ -1,98 +0,0 @@
/*
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.fir
import junit.framework.TestCase
import org.jetbrains.kotlin.fir.declarations.FirFile
import org.jetbrains.kotlin.fir.references.FirControlFlowGraphReference
import org.jetbrains.kotlin.fir.resolve.dfa.FirControlFlowGraphReferenceImpl
import org.jetbrains.kotlin.fir.resolve.dfa.cfg.CFGNode
import org.jetbrains.kotlin.fir.resolve.dfa.cfg.ControlFlowGraph
import org.jetbrains.kotlin.fir.resolve.dfa.cfg.EdgeKind
import org.jetbrains.kotlin.fir.resolve.dfa.cfg.FirControlFlowGraphRenderVisitor
import org.jetbrains.kotlin.fir.visitors.FirVisitorVoid
import org.jetbrains.kotlin.test.ConfigurationKind
import org.jetbrains.kotlin.test.KotlinTestUtils
import org.jetbrains.kotlin.test.testFramework.KtUsefulTestCase
import java.io.File
/*
* For comfort viewing dumps of control flow graph you can setup external tool in IDEA that opens .dot files
*
* Example of config for `xdot` viewer:
*
* File -> Settings -> External tools -> Add
*
* Name: XDot
* Program: xdot
* Arguments: $FileNameWithoutExtension$.dot
* Working directory: $FileDir$
* Disable "Open console for tool output"
*
* After that you can run action `XDot` in editor with source of test (or with cfg dump)
* and it will opens xdot with dump for that test
*/
abstract class AbstractFirDiagnosticsWithCfgTest : AbstractFirDiagnosticsTest() {
override fun getConfigurationKind(): ConfigurationKind {
return ConfigurationKind.ALL
}
override fun runAnalysis(testDataFile: File, testFiles: List<TestFile>, firFilesPerSession: Map<FirSession, List<FirFile>>) {
super.runAnalysis(testDataFile, testFiles, firFilesPerSession)
val allFirFiles = firFilesPerSession.values.flatten()
checkCfg(testDataFile, allFirFiles)
checkCfgEdgeConsistency(allFirFiles)
}
private fun checkCfg(testDataFile: File, firFiles: List<FirFile>) {
val builder = StringBuilder()
firFiles.first().accept(FirControlFlowGraphRenderVisitor(builder), null)
val dotCfgDump = builder.toString()
val dotExpectedPath = testDataFile.absolutePath.replace(".kt", ".dot")
KotlinTestUtils.assertEqualsToFile(File(dotExpectedPath), dotCfgDump)
}
private fun checkCfgEdgeConsistency(firFiles: List<FirFile>) {
firFiles.forEach { it.accept(CfgConsistencyChecker) }
}
private object CfgConsistencyChecker : FirVisitorVoid() {
override fun visitElement(element: FirElement) {
element.acceptChildren(this)
}
override fun visitControlFlowGraphReference(controlFlowGraphReference: FirControlFlowGraphReference) {
val graph = (controlFlowGraphReference as? FirControlFlowGraphReferenceImpl)?.controlFlowGraph ?: return
checkConsistency(graph)
}
private fun checkConsistency(graph: ControlFlowGraph) {
for (node in graph.nodes) {
for (to in node.followingNodes) {
checkEdge(node, to)
}
for (from in node.previousNodes) {
checkEdge(from, node)
}
TestCase.assertTrue(node.followingNodes.isNotEmpty() || node.previousNodes.isNotEmpty())
}
}
private fun checkEdge(from: CFGNode<*>, to: CFGNode<*>) {
KtUsefulTestCase.assertContainsElements(from.followingNodes, to)
KtUsefulTestCase.assertContainsElements(to.previousNodes, from)
val fromKind = from.outgoingEdges.getValue(to)
val toKind = to.incomingEdges.getValue(from)
TestCase.assertEquals(fromKind, toKind)
if (from.isDead || to.isDead) {
KtUsefulTestCase.assertContainsElements(listOf(EdgeKind.Dead, EdgeKind.Cfg), toKind)
}
}
}
}
@@ -25,7 +25,7 @@ public class FirDiagnosticsTestGenerated extends AbstractFirDiagnosticsTest {
} }
public void testAllFilesPresentInResolve() throws Exception { public void testAllFilesPresentInResolve() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/resolve/testData/resolve"), Pattern.compile("^([^.]+)\\.kt$"), null, true, "stdlib", "cfg", "smartcasts"); KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/resolve/testData/resolve"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
} }
@TestMetadata("asImports.kt") @TestMetadata("asImports.kt")
@@ -454,6 +454,99 @@ public class FirDiagnosticsTestGenerated extends AbstractFirDiagnosticsTest {
} }
} }
@TestMetadata("compiler/fir/resolve/testData/resolve/cfg")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Cfg extends AbstractFirDiagnosticsTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInCfg() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/resolve/testData/resolve/cfg"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
}
@TestMetadata("binaryOperations.kt")
public void testBinaryOperations() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/cfg/binaryOperations.kt");
}
@TestMetadata("booleanOperatorsWithConsts.kt")
public void testBooleanOperatorsWithConsts() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/cfg/booleanOperatorsWithConsts.kt");
}
@TestMetadata("complex.kt")
public void testComplex() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/cfg/complex.kt");
}
@TestMetadata("emptyWhen.kt")
public void testEmptyWhen() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/cfg/emptyWhen.kt");
}
@TestMetadata("initBlock.kt")
public void testInitBlock() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/cfg/initBlock.kt");
}
@TestMetadata("initBlockAndInPlaceLambda.kt")
public void testInitBlockAndInPlaceLambda() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/cfg/initBlockAndInPlaceLambda.kt");
}
@TestMetadata("jumps.kt")
public void testJumps() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/cfg/jumps.kt");
}
@TestMetadata("lambdas.kt")
public void testLambdas() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/cfg/lambdas.kt");
}
@TestMetadata("loops.kt")
public void testLoops() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/cfg/loops.kt");
}
@TestMetadata("postponedLambdas.kt")
public void testPostponedLambdas() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/cfg/postponedLambdas.kt");
}
@TestMetadata("propertiesAndInitBlocks.kt")
public void testPropertiesAndInitBlocks() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/cfg/propertiesAndInitBlocks.kt");
}
@TestMetadata("returnValuesFromLambda.kt")
public void testReturnValuesFromLambda() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/cfg/returnValuesFromLambda.kt");
}
@TestMetadata("safeCalls.kt")
public void testSafeCalls() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/cfg/safeCalls.kt");
}
@TestMetadata("simple.kt")
public void testSimple() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/cfg/simple.kt");
}
@TestMetadata("tryCatch.kt")
public void testTryCatch() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/cfg/tryCatch.kt");
}
@TestMetadata("when.kt")
public void testWhen() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/cfg/when.kt");
}
}
@TestMetadata("compiler/fir/resolve/testData/resolve/diagnostics") @TestMetadata("compiler/fir/resolve/testData/resolve/diagnostics")
@TestDataPath("$PROJECT_ROOT") @TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class) @RunWith(JUnit3RunnerWithInners.class)
@@ -1305,4 +1398,297 @@ public class FirDiagnosticsTestGenerated extends AbstractFirDiagnosticsTest {
runTest("compiler/fir/resolve/testData/resolve/samConversions/simple.kt"); runTest("compiler/fir/resolve/testData/resolve/samConversions/simple.kt");
} }
} }
@TestMetadata("compiler/fir/resolve/testData/resolve/smartcasts")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Smartcasts extends AbstractFirDiagnosticsTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInSmartcasts() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/resolve/testData/resolve/smartcasts"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
}
@TestMetadata("bangbang.kt")
public void testBangbang() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/smartcasts/bangbang.kt");
}
@TestMetadata("casts.kt")
public void testCasts() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/smartcasts/casts.kt");
}
@TestMetadata("equalsAndIdentity.kt")
public void testEqualsAndIdentity() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/smartcasts/equalsAndIdentity.kt");
}
@TestMetadata("multipleCasts.kt")
public void testMultipleCasts() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/smartcasts/multipleCasts.kt");
}
@TestMetadata("nullability.kt")
public void testNullability() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/smartcasts/nullability.kt");
}
@TestMetadata("smartCastInInit.kt")
public void testSmartCastInInit() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/smartcasts/smartCastInInit.kt");
}
@TestMetadata("smartcastToNothing.kt")
public void testSmartcastToNothing() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/smartcasts/smartcastToNothing.kt");
}
@TestMetadata("compiler/fir/resolve/testData/resolve/smartcasts/booleans")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Booleans extends AbstractFirDiagnosticsTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInBooleans() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/resolve/testData/resolve/smartcasts/booleans"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
}
@TestMetadata("booleanOperators.kt")
public void testBooleanOperators() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/smartcasts/booleans/booleanOperators.kt");
}
@TestMetadata("equalsToBoolean.kt")
public void testEqualsToBoolean() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/smartcasts/booleans/equalsToBoolean.kt");
}
}
@TestMetadata("compiler/fir/resolve/testData/resolve/smartcasts/boundSmartcasts")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class BoundSmartcasts extends AbstractFirDiagnosticsTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInBoundSmartcasts() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/resolve/testData/resolve/smartcasts/boundSmartcasts"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
}
@TestMetadata("boundSmartcasts.kt")
public void testBoundSmartcasts() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/smartcasts/boundSmartcasts/boundSmartcasts.kt");
}
@TestMetadata("boundSmartcastsInBranches.kt")
public void testBoundSmartcastsInBranches() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/smartcasts/boundSmartcasts/boundSmartcastsInBranches.kt");
}
}
@TestMetadata("compiler/fir/resolve/testData/resolve/smartcasts/controlStructures")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class ControlStructures extends AbstractFirDiagnosticsTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInControlStructures() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/resolve/testData/resolve/smartcasts/controlStructures"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
}
@TestMetadata("elvis.kt")
public void testElvis() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/smartcasts/controlStructures/elvis.kt");
}
@TestMetadata("returns.kt")
public void testReturns() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/smartcasts/controlStructures/returns.kt");
}
@TestMetadata("simpleIf.kt")
public void testSimpleIf() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/smartcasts/controlStructures/simpleIf.kt");
}
@TestMetadata("smartcastFromArgument.kt")
public void testSmartcastFromArgument() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/smartcasts/controlStructures/smartcastFromArgument.kt");
}
@TestMetadata("when.kt")
public void testWhen() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/smartcasts/controlStructures/when.kt");
}
}
@TestMetadata("compiler/fir/resolve/testData/resolve/smartcasts/lambdas")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Lambdas extends AbstractFirDiagnosticsTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInLambdas() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/resolve/testData/resolve/smartcasts/lambdas"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
}
@TestMetadata("inPlaceLambdas.kt")
public void testInPlaceLambdas() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/smartcasts/lambdas/inPlaceLambdas.kt");
}
@TestMetadata("smartcastOnLambda.kt")
public void testSmartcastOnLambda() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/smartcasts/lambdas/smartcastOnLambda.kt");
}
}
@TestMetadata("compiler/fir/resolve/testData/resolve/smartcasts/loops")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Loops extends AbstractFirDiagnosticsTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInLoops() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/resolve/testData/resolve/smartcasts/loops"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
}
@TestMetadata("dataFlowInfoFromWhileCondition.kt")
public void testDataFlowInfoFromWhileCondition() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/smartcasts/loops/dataFlowInfoFromWhileCondition.kt");
}
@TestMetadata("endlessLoops.kt")
public void testEndlessLoops() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/smartcasts/loops/endlessLoops.kt");
}
}
@TestMetadata("compiler/fir/resolve/testData/resolve/smartcasts/problems")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Problems extends AbstractFirDiagnosticsTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInProblems() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/resolve/testData/resolve/smartcasts/problems"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
}
@TestMetadata("smartcastOnBangBang.kt")
public void testSmartcastOnBangBang() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/smartcasts/problems/smartcastOnBangBang.kt");
}
}
@TestMetadata("compiler/fir/resolve/testData/resolve/smartcasts/receivers")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Receivers extends AbstractFirDiagnosticsTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInReceivers() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/resolve/testData/resolve/smartcasts/receivers"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
}
@TestMetadata("implicitReceiverAsWhenSubject.kt")
public void testImplicitReceiverAsWhenSubject() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/smartcasts/receivers/implicitReceiverAsWhenSubject.kt");
}
@TestMetadata("implicitReceivers.kt")
public void testImplicitReceivers() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/smartcasts/receivers/implicitReceivers.kt");
}
@TestMetadata("thisOfExtensionProperty.kt")
public void testThisOfExtensionProperty() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/smartcasts/receivers/thisOfExtensionProperty.kt");
}
}
@TestMetadata("compiler/fir/resolve/testData/resolve/smartcasts/safeCalls")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class SafeCalls extends AbstractFirDiagnosticsTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInSafeCalls() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/resolve/testData/resolve/smartcasts/safeCalls"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
}
@TestMetadata("assignSafeCall.kt")
public void testAssignSafeCall() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/smartcasts/safeCalls/assignSafeCall.kt");
}
@TestMetadata("safeCallAndEqualityToBool.kt")
public void testSafeCallAndEqualityToBool() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/smartcasts/safeCalls/safeCallAndEqualityToBool.kt");
}
@TestMetadata("safeCalls.kt")
public void testSafeCalls() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/smartcasts/safeCalls/safeCalls.kt");
}
}
@TestMetadata("compiler/fir/resolve/testData/resolve/smartcasts/stability")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Stability extends AbstractFirDiagnosticsTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInStability() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/resolve/testData/resolve/smartcasts/stability"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
}
@TestMetadata("overridenOpenVal.kt")
public void testOverridenOpenVal() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/smartcasts/stability/overridenOpenVal.kt");
}
}
@TestMetadata("compiler/fir/resolve/testData/resolve/smartcasts/variables")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Variables extends AbstractFirDiagnosticsTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInVariables() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/resolve/testData/resolve/smartcasts/variables"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
}
@TestMetadata("delayedAssignment.kt")
public void testDelayedAssignment() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/smartcasts/variables/delayedAssignment.kt");
}
@TestMetadata("smartcastAfterReassignment.kt")
public void testSmartcastAfterReassignment() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/smartcasts/variables/smartcastAfterReassignment.kt");
}
}
}
} }
@@ -1,61 +0,0 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.fir;
import com.intellij.testFramework.TestDataPath;
import org.jetbrains.kotlin.test.JUnit3RunnerWithInners;
import org.jetbrains.kotlin.test.KotlinTestUtils;
import org.jetbrains.kotlin.test.TestMetadata;
import org.junit.runner.RunWith;
import java.io.File;
import java.util.regex.Pattern;
/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */
@SuppressWarnings("all")
@RunWith(JUnit3RunnerWithInners.class)
public class FirDiagnosticsWithCfgAndStdlibTestGenerated extends AbstractFirDiagnosticsWithCfgAndStdlibTest {
@TestMetadata("compiler/fir/resolve/testData/resolveWithStdlib/contracts")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Contracts extends AbstractFirDiagnosticsWithCfgAndStdlibTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInContracts() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/resolve/testData/resolveWithStdlib/contracts"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
}
@TestMetadata("callsInPlace.kt")
public void testCallsInPlace() throws Exception {
runTest("compiler/fir/resolve/testData/resolveWithStdlib/contracts/callsInPlace.kt");
}
@TestMetadata("conditionalEffects.kt")
public void testConditionalEffects() throws Exception {
runTest("compiler/fir/resolve/testData/resolveWithStdlib/contracts/conditionalEffects.kt");
}
}
@TestMetadata("compiler/fir/resolve/testData/resolveWithStdlib/smartcasts")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Smartcasts extends AbstractFirDiagnosticsWithCfgAndStdlibTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInSmartcasts() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/resolve/testData/resolveWithStdlib/smartcasts"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
}
@TestMetadata("tryWithLambdaInside.kt")
public void testTryWithLambdaInside() throws Exception {
runTest("compiler/fir/resolve/testData/resolveWithStdlib/smartcasts/tryWithLambdaInside.kt");
}
}
}
@@ -1,406 +0,0 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.fir;
import com.intellij.testFramework.TestDataPath;
import org.jetbrains.kotlin.test.JUnit3RunnerWithInners;
import org.jetbrains.kotlin.test.KotlinTestUtils;
import org.jetbrains.kotlin.test.TestMetadata;
import org.junit.runner.RunWith;
import java.io.File;
import java.util.regex.Pattern;
/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */
@SuppressWarnings("all")
@RunWith(JUnit3RunnerWithInners.class)
public class FirDiagnosticsWithCfgTestGenerated extends AbstractFirDiagnosticsWithCfgTest {
@TestMetadata("compiler/fir/resolve/testData/resolve/cfg")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Cfg extends AbstractFirDiagnosticsWithCfgTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInCfg() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/resolve/testData/resolve/cfg"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
}
@TestMetadata("binaryOperations.kt")
public void testBinaryOperations() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/cfg/binaryOperations.kt");
}
@TestMetadata("booleanOperatorsWithConsts.kt")
public void testBooleanOperatorsWithConsts() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/cfg/booleanOperatorsWithConsts.kt");
}
@TestMetadata("complex.kt")
public void testComplex() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/cfg/complex.kt");
}
@TestMetadata("emptyWhen.kt")
public void testEmptyWhen() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/cfg/emptyWhen.kt");
}
@TestMetadata("initBlock.kt")
public void testInitBlock() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/cfg/initBlock.kt");
}
@TestMetadata("initBlockAndInPlaceLambda.kt")
public void testInitBlockAndInPlaceLambda() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/cfg/initBlockAndInPlaceLambda.kt");
}
@TestMetadata("jumps.kt")
public void testJumps() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/cfg/jumps.kt");
}
@TestMetadata("lambdas.kt")
public void testLambdas() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/cfg/lambdas.kt");
}
@TestMetadata("loops.kt")
public void testLoops() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/cfg/loops.kt");
}
@TestMetadata("postponedLambdas.kt")
public void testPostponedLambdas() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/cfg/postponedLambdas.kt");
}
@TestMetadata("propertiesAndInitBlocks.kt")
public void testPropertiesAndInitBlocks() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/cfg/propertiesAndInitBlocks.kt");
}
@TestMetadata("returnValuesFromLambda.kt")
public void testReturnValuesFromLambda() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/cfg/returnValuesFromLambda.kt");
}
@TestMetadata("safeCalls.kt")
public void testSafeCalls() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/cfg/safeCalls.kt");
}
@TestMetadata("simple.kt")
public void testSimple() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/cfg/simple.kt");
}
@TestMetadata("tryCatch.kt")
public void testTryCatch() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/cfg/tryCatch.kt");
}
@TestMetadata("when.kt")
public void testWhen() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/cfg/when.kt");
}
}
@TestMetadata("compiler/fir/resolve/testData/resolve/smartcasts")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Smartcasts extends AbstractFirDiagnosticsWithCfgTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInSmartcasts() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/resolve/testData/resolve/smartcasts"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
}
@TestMetadata("bangbang.kt")
public void testBangbang() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/smartcasts/bangbang.kt");
}
@TestMetadata("casts.kt")
public void testCasts() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/smartcasts/casts.kt");
}
@TestMetadata("equalsAndIdentity.kt")
public void testEqualsAndIdentity() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/smartcasts/equalsAndIdentity.kt");
}
@TestMetadata("multipleCasts.kt")
public void testMultipleCasts() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/smartcasts/multipleCasts.kt");
}
@TestMetadata("nullability.kt")
public void testNullability() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/smartcasts/nullability.kt");
}
@TestMetadata("smartCastInInit.kt")
public void testSmartCastInInit() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/smartcasts/smartCastInInit.kt");
}
@TestMetadata("smartcastToNothing.kt")
public void testSmartcastToNothing() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/smartcasts/smartcastToNothing.kt");
}
@TestMetadata("compiler/fir/resolve/testData/resolve/smartcasts/booleans")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Booleans extends AbstractFirDiagnosticsWithCfgTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInBooleans() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/resolve/testData/resolve/smartcasts/booleans"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
}
@TestMetadata("booleanOperators.kt")
public void testBooleanOperators() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/smartcasts/booleans/booleanOperators.kt");
}
@TestMetadata("equalsToBoolean.kt")
public void testEqualsToBoolean() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/smartcasts/booleans/equalsToBoolean.kt");
}
}
@TestMetadata("compiler/fir/resolve/testData/resolve/smartcasts/boundSmartcasts")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class BoundSmartcasts extends AbstractFirDiagnosticsWithCfgTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInBoundSmartcasts() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/resolve/testData/resolve/smartcasts/boundSmartcasts"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
}
@TestMetadata("boundSmartcasts.kt")
public void testBoundSmartcasts() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/smartcasts/boundSmartcasts/boundSmartcasts.kt");
}
@TestMetadata("boundSmartcastsInBranches.kt")
public void testBoundSmartcastsInBranches() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/smartcasts/boundSmartcasts/boundSmartcastsInBranches.kt");
}
}
@TestMetadata("compiler/fir/resolve/testData/resolve/smartcasts/controlStructures")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class ControlStructures extends AbstractFirDiagnosticsWithCfgTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInControlStructures() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/resolve/testData/resolve/smartcasts/controlStructures"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
}
@TestMetadata("elvis.kt")
public void testElvis() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/smartcasts/controlStructures/elvis.kt");
}
@TestMetadata("returns.kt")
public void testReturns() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/smartcasts/controlStructures/returns.kt");
}
@TestMetadata("simpleIf.kt")
public void testSimpleIf() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/smartcasts/controlStructures/simpleIf.kt");
}
@TestMetadata("smartcastFromArgument.kt")
public void testSmartcastFromArgument() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/smartcasts/controlStructures/smartcastFromArgument.kt");
}
@TestMetadata("when.kt")
public void testWhen() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/smartcasts/controlStructures/when.kt");
}
}
@TestMetadata("compiler/fir/resolve/testData/resolve/smartcasts/lambdas")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Lambdas extends AbstractFirDiagnosticsWithCfgTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInLambdas() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/resolve/testData/resolve/smartcasts/lambdas"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
}
@TestMetadata("inPlaceLambdas.kt")
public void testInPlaceLambdas() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/smartcasts/lambdas/inPlaceLambdas.kt");
}
@TestMetadata("smartcastOnLambda.kt")
public void testSmartcastOnLambda() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/smartcasts/lambdas/smartcastOnLambda.kt");
}
}
@TestMetadata("compiler/fir/resolve/testData/resolve/smartcasts/loops")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Loops extends AbstractFirDiagnosticsWithCfgTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInLoops() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/resolve/testData/resolve/smartcasts/loops"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
}
@TestMetadata("dataFlowInfoFromWhileCondition.kt")
public void testDataFlowInfoFromWhileCondition() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/smartcasts/loops/dataFlowInfoFromWhileCondition.kt");
}
@TestMetadata("endlessLoops.kt")
public void testEndlessLoops() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/smartcasts/loops/endlessLoops.kt");
}
}
@TestMetadata("compiler/fir/resolve/testData/resolve/smartcasts/problems")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Problems extends AbstractFirDiagnosticsWithCfgTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInProblems() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/resolve/testData/resolve/smartcasts/problems"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
}
@TestMetadata("smartcastOnBangBang.kt")
public void testSmartcastOnBangBang() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/smartcasts/problems/smartcastOnBangBang.kt");
}
}
@TestMetadata("compiler/fir/resolve/testData/resolve/smartcasts/receivers")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Receivers extends AbstractFirDiagnosticsWithCfgTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInReceivers() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/resolve/testData/resolve/smartcasts/receivers"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
}
@TestMetadata("implicitReceiverAsWhenSubject.kt")
public void testImplicitReceiverAsWhenSubject() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/smartcasts/receivers/implicitReceiverAsWhenSubject.kt");
}
@TestMetadata("implicitReceivers.kt")
public void testImplicitReceivers() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/smartcasts/receivers/implicitReceivers.kt");
}
@TestMetadata("thisOfExtensionProperty.kt")
public void testThisOfExtensionProperty() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/smartcasts/receivers/thisOfExtensionProperty.kt");
}
}
@TestMetadata("compiler/fir/resolve/testData/resolve/smartcasts/safeCalls")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class SafeCalls extends AbstractFirDiagnosticsWithCfgTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInSafeCalls() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/resolve/testData/resolve/smartcasts/safeCalls"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
}
@TestMetadata("assignSafeCall.kt")
public void testAssignSafeCall() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/smartcasts/safeCalls/assignSafeCall.kt");
}
@TestMetadata("safeCallAndEqualityToBool.kt")
public void testSafeCallAndEqualityToBool() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/smartcasts/safeCalls/safeCallAndEqualityToBool.kt");
}
@TestMetadata("safeCalls.kt")
public void testSafeCalls() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/smartcasts/safeCalls/safeCalls.kt");
}
}
@TestMetadata("compiler/fir/resolve/testData/resolve/smartcasts/stability")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Stability extends AbstractFirDiagnosticsWithCfgTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInStability() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/resolve/testData/resolve/smartcasts/stability"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
}
@TestMetadata("overridenOpenVal.kt")
public void testOverridenOpenVal() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/smartcasts/stability/overridenOpenVal.kt");
}
}
@TestMetadata("compiler/fir/resolve/testData/resolve/smartcasts/variables")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Variables extends AbstractFirDiagnosticsWithCfgTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInVariables() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/resolve/testData/resolve/smartcasts/variables"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
}
@TestMetadata("delayedAssignment.kt")
public void testDelayedAssignment() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/smartcasts/variables/delayedAssignment.kt");
}
@TestMetadata("smartcastAfterReassignment.kt")
public void testSmartcastAfterReassignment() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/smartcasts/variables/smartcastAfterReassignment.kt");
}
}
}
}
@@ -25,7 +25,7 @@ public class FirDiagnosticsWithLightTreeTestGenerated extends AbstractFirDiagnos
} }
public void testAllFilesPresentInResolve() throws Exception { public void testAllFilesPresentInResolve() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/resolve/testData/resolve"), Pattern.compile("^([^.]+)\\.kt$"), null, true, "stdlib", "cfg", "smartcasts"); KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/resolve/testData/resolve"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
} }
@TestMetadata("asImports.kt") @TestMetadata("asImports.kt")
@@ -454,6 +454,99 @@ public class FirDiagnosticsWithLightTreeTestGenerated extends AbstractFirDiagnos
} }
} }
@TestMetadata("compiler/fir/resolve/testData/resolve/cfg")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Cfg extends AbstractFirDiagnosticsWithLightTreeTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInCfg() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/resolve/testData/resolve/cfg"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
}
@TestMetadata("binaryOperations.kt")
public void testBinaryOperations() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/cfg/binaryOperations.kt");
}
@TestMetadata("booleanOperatorsWithConsts.kt")
public void testBooleanOperatorsWithConsts() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/cfg/booleanOperatorsWithConsts.kt");
}
@TestMetadata("complex.kt")
public void testComplex() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/cfg/complex.kt");
}
@TestMetadata("emptyWhen.kt")
public void testEmptyWhen() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/cfg/emptyWhen.kt");
}
@TestMetadata("initBlock.kt")
public void testInitBlock() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/cfg/initBlock.kt");
}
@TestMetadata("initBlockAndInPlaceLambda.kt")
public void testInitBlockAndInPlaceLambda() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/cfg/initBlockAndInPlaceLambda.kt");
}
@TestMetadata("jumps.kt")
public void testJumps() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/cfg/jumps.kt");
}
@TestMetadata("lambdas.kt")
public void testLambdas() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/cfg/lambdas.kt");
}
@TestMetadata("loops.kt")
public void testLoops() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/cfg/loops.kt");
}
@TestMetadata("postponedLambdas.kt")
public void testPostponedLambdas() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/cfg/postponedLambdas.kt");
}
@TestMetadata("propertiesAndInitBlocks.kt")
public void testPropertiesAndInitBlocks() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/cfg/propertiesAndInitBlocks.kt");
}
@TestMetadata("returnValuesFromLambda.kt")
public void testReturnValuesFromLambda() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/cfg/returnValuesFromLambda.kt");
}
@TestMetadata("safeCalls.kt")
public void testSafeCalls() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/cfg/safeCalls.kt");
}
@TestMetadata("simple.kt")
public void testSimple() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/cfg/simple.kt");
}
@TestMetadata("tryCatch.kt")
public void testTryCatch() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/cfg/tryCatch.kt");
}
@TestMetadata("when.kt")
public void testWhen() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/cfg/when.kt");
}
}
@TestMetadata("compiler/fir/resolve/testData/resolve/diagnostics") @TestMetadata("compiler/fir/resolve/testData/resolve/diagnostics")
@TestDataPath("$PROJECT_ROOT") @TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class) @RunWith(JUnit3RunnerWithInners.class)
@@ -1305,4 +1398,297 @@ public class FirDiagnosticsWithLightTreeTestGenerated extends AbstractFirDiagnos
runTest("compiler/fir/resolve/testData/resolve/samConversions/simple.kt"); runTest("compiler/fir/resolve/testData/resolve/samConversions/simple.kt");
} }
} }
@TestMetadata("compiler/fir/resolve/testData/resolve/smartcasts")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Smartcasts extends AbstractFirDiagnosticsWithLightTreeTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInSmartcasts() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/resolve/testData/resolve/smartcasts"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
}
@TestMetadata("bangbang.kt")
public void testBangbang() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/smartcasts/bangbang.kt");
}
@TestMetadata("casts.kt")
public void testCasts() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/smartcasts/casts.kt");
}
@TestMetadata("equalsAndIdentity.kt")
public void testEqualsAndIdentity() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/smartcasts/equalsAndIdentity.kt");
}
@TestMetadata("multipleCasts.kt")
public void testMultipleCasts() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/smartcasts/multipleCasts.kt");
}
@TestMetadata("nullability.kt")
public void testNullability() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/smartcasts/nullability.kt");
}
@TestMetadata("smartCastInInit.kt")
public void testSmartCastInInit() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/smartcasts/smartCastInInit.kt");
}
@TestMetadata("smartcastToNothing.kt")
public void testSmartcastToNothing() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/smartcasts/smartcastToNothing.kt");
}
@TestMetadata("compiler/fir/resolve/testData/resolve/smartcasts/booleans")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Booleans extends AbstractFirDiagnosticsWithLightTreeTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInBooleans() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/resolve/testData/resolve/smartcasts/booleans"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
}
@TestMetadata("booleanOperators.kt")
public void testBooleanOperators() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/smartcasts/booleans/booleanOperators.kt");
}
@TestMetadata("equalsToBoolean.kt")
public void testEqualsToBoolean() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/smartcasts/booleans/equalsToBoolean.kt");
}
}
@TestMetadata("compiler/fir/resolve/testData/resolve/smartcasts/boundSmartcasts")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class BoundSmartcasts extends AbstractFirDiagnosticsWithLightTreeTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInBoundSmartcasts() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/resolve/testData/resolve/smartcasts/boundSmartcasts"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
}
@TestMetadata("boundSmartcasts.kt")
public void testBoundSmartcasts() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/smartcasts/boundSmartcasts/boundSmartcasts.kt");
}
@TestMetadata("boundSmartcastsInBranches.kt")
public void testBoundSmartcastsInBranches() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/smartcasts/boundSmartcasts/boundSmartcastsInBranches.kt");
}
}
@TestMetadata("compiler/fir/resolve/testData/resolve/smartcasts/controlStructures")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class ControlStructures extends AbstractFirDiagnosticsWithLightTreeTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInControlStructures() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/resolve/testData/resolve/smartcasts/controlStructures"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
}
@TestMetadata("elvis.kt")
public void testElvis() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/smartcasts/controlStructures/elvis.kt");
}
@TestMetadata("returns.kt")
public void testReturns() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/smartcasts/controlStructures/returns.kt");
}
@TestMetadata("simpleIf.kt")
public void testSimpleIf() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/smartcasts/controlStructures/simpleIf.kt");
}
@TestMetadata("smartcastFromArgument.kt")
public void testSmartcastFromArgument() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/smartcasts/controlStructures/smartcastFromArgument.kt");
}
@TestMetadata("when.kt")
public void testWhen() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/smartcasts/controlStructures/when.kt");
}
}
@TestMetadata("compiler/fir/resolve/testData/resolve/smartcasts/lambdas")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Lambdas extends AbstractFirDiagnosticsWithLightTreeTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInLambdas() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/resolve/testData/resolve/smartcasts/lambdas"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
}
@TestMetadata("inPlaceLambdas.kt")
public void testInPlaceLambdas() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/smartcasts/lambdas/inPlaceLambdas.kt");
}
@TestMetadata("smartcastOnLambda.kt")
public void testSmartcastOnLambda() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/smartcasts/lambdas/smartcastOnLambda.kt");
}
}
@TestMetadata("compiler/fir/resolve/testData/resolve/smartcasts/loops")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Loops extends AbstractFirDiagnosticsWithLightTreeTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInLoops() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/resolve/testData/resolve/smartcasts/loops"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
}
@TestMetadata("dataFlowInfoFromWhileCondition.kt")
public void testDataFlowInfoFromWhileCondition() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/smartcasts/loops/dataFlowInfoFromWhileCondition.kt");
}
@TestMetadata("endlessLoops.kt")
public void testEndlessLoops() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/smartcasts/loops/endlessLoops.kt");
}
}
@TestMetadata("compiler/fir/resolve/testData/resolve/smartcasts/problems")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Problems extends AbstractFirDiagnosticsWithLightTreeTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInProblems() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/resolve/testData/resolve/smartcasts/problems"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
}
@TestMetadata("smartcastOnBangBang.kt")
public void testSmartcastOnBangBang() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/smartcasts/problems/smartcastOnBangBang.kt");
}
}
@TestMetadata("compiler/fir/resolve/testData/resolve/smartcasts/receivers")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Receivers extends AbstractFirDiagnosticsWithLightTreeTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInReceivers() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/resolve/testData/resolve/smartcasts/receivers"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
}
@TestMetadata("implicitReceiverAsWhenSubject.kt")
public void testImplicitReceiverAsWhenSubject() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/smartcasts/receivers/implicitReceiverAsWhenSubject.kt");
}
@TestMetadata("implicitReceivers.kt")
public void testImplicitReceivers() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/smartcasts/receivers/implicitReceivers.kt");
}
@TestMetadata("thisOfExtensionProperty.kt")
public void testThisOfExtensionProperty() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/smartcasts/receivers/thisOfExtensionProperty.kt");
}
}
@TestMetadata("compiler/fir/resolve/testData/resolve/smartcasts/safeCalls")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class SafeCalls extends AbstractFirDiagnosticsWithLightTreeTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInSafeCalls() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/resolve/testData/resolve/smartcasts/safeCalls"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
}
@TestMetadata("assignSafeCall.kt")
public void testAssignSafeCall() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/smartcasts/safeCalls/assignSafeCall.kt");
}
@TestMetadata("safeCallAndEqualityToBool.kt")
public void testSafeCallAndEqualityToBool() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/smartcasts/safeCalls/safeCallAndEqualityToBool.kt");
}
@TestMetadata("safeCalls.kt")
public void testSafeCalls() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/smartcasts/safeCalls/safeCalls.kt");
}
}
@TestMetadata("compiler/fir/resolve/testData/resolve/smartcasts/stability")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Stability extends AbstractFirDiagnosticsWithLightTreeTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInStability() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/resolve/testData/resolve/smartcasts/stability"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
}
@TestMetadata("overridenOpenVal.kt")
public void testOverridenOpenVal() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/smartcasts/stability/overridenOpenVal.kt");
}
}
@TestMetadata("compiler/fir/resolve/testData/resolve/smartcasts/variables")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Variables extends AbstractFirDiagnosticsWithLightTreeTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInVariables() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/resolve/testData/resolve/smartcasts/variables"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
}
@TestMetadata("delayedAssignment.kt")
public void testDelayedAssignment() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/smartcasts/variables/delayedAssignment.kt");
}
@TestMetadata("smartcastAfterReassignment.kt")
public void testSmartcastAfterReassignment() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/smartcasts/variables/smartcastAfterReassignment.kt");
}
}
}
} }
@@ -30,7 +30,7 @@ public class FirDiagnosticsWithStdlibTestGenerated extends AbstractFirDiagnostic
} }
public void testAllFilesPresentInResolveWithStdlib() throws Exception { public void testAllFilesPresentInResolveWithStdlib() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/resolve/testData/resolveWithStdlib"), Pattern.compile("^([^.]+)\\.kt$"), null, true, "contracts", "smartcasts"); KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/resolve/testData/resolveWithStdlib"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
} }
@TestMetadata("anonymousInDelegate.kt") @TestMetadata("anonymousInDelegate.kt")
@@ -454,6 +454,29 @@ public class FirDiagnosticsWithStdlibTestGenerated extends AbstractFirDiagnostic
} }
} }
@TestMetadata("compiler/fir/resolve/testData/resolveWithStdlib/contracts")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Contracts extends AbstractFirDiagnosticsWithStdlibTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInContracts() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/resolve/testData/resolveWithStdlib/contracts"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
}
@TestMetadata("callsInPlace.kt")
public void testCallsInPlace() throws Exception {
runTest("compiler/fir/resolve/testData/resolveWithStdlib/contracts/callsInPlace.kt");
}
@TestMetadata("conditionalEffects.kt")
public void testConditionalEffects() throws Exception {
runTest("compiler/fir/resolve/testData/resolveWithStdlib/contracts/conditionalEffects.kt");
}
}
@TestMetadata("compiler/fir/resolve/testData/resolveWithStdlib/inference") @TestMetadata("compiler/fir/resolve/testData/resolveWithStdlib/inference")
@TestDataPath("$PROJECT_ROOT") @TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class) @RunWith(JUnit3RunnerWithInners.class)
@@ -667,4 +690,22 @@ public class FirDiagnosticsWithStdlibTestGenerated extends AbstractFirDiagnostic
runTest("compiler/fir/resolve/testData/resolveWithStdlib/problems/weakHashMap.kt"); runTest("compiler/fir/resolve/testData/resolveWithStdlib/problems/weakHashMap.kt");
} }
} }
@TestMetadata("compiler/fir/resolve/testData/resolveWithStdlib/smartcasts")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Smartcasts extends AbstractFirDiagnosticsWithStdlibTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInSmartcasts() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/resolve/testData/resolveWithStdlib/smartcasts"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
}
@TestMetadata("tryWithLambdaInside.kt")
public void testTryWithLambdaInside() throws Exception {
runTest("compiler/fir/resolve/testData/resolveWithStdlib/smartcasts/tryWithLambdaInside.kt");
}
}
} }
@@ -547,27 +547,17 @@ fun main(args: Array<String>) {
testGroup("compiler/fir/resolve/tests", "compiler/fir/resolve/testData") { testGroup("compiler/fir/resolve/tests", "compiler/fir/resolve/testData") {
testClass<AbstractFirDiagnosticsTest> { testClass<AbstractFirDiagnosticsTest> {
model("resolve", pattern = KT_WITHOUT_DOTS_IN_NAME, excludeDirs = listOf("stdlib", "cfg", "smartcasts")) model("resolve", pattern = KT_WITHOUT_DOTS_IN_NAME)
} }
testClass<AbstractFirDiagnosticsWithLightTreeTest> { testClass<AbstractFirDiagnosticsWithLightTreeTest> {
model("resolve", pattern = KT_WITHOUT_DOTS_IN_NAME, excludeDirs = listOf("stdlib", "cfg", "smartcasts")) model("resolve", pattern = KT_WITHOUT_DOTS_IN_NAME)
}
testClass<AbstractFirDiagnosticsWithCfgTest> {
model("resolve/cfg", pattern = KT_WITHOUT_DOTS_IN_NAME)
model("resolve/smartcasts", pattern = KT_WITHOUT_DOTS_IN_NAME)
} }
} }
testGroup("compiler/fir/resolve/tests", "compiler/fir/resolve/testData") { testGroup("compiler/fir/resolve/tests", "compiler/fir/resolve/testData") {
testClass<AbstractFirDiagnosticsWithStdlibTest> { testClass<AbstractFirDiagnosticsWithStdlibTest> {
model("resolveWithStdlib", pattern = KT_WITHOUT_DOTS_IN_NAME, excludeDirs = listOf("contracts", "smartcasts")) model("resolveWithStdlib", pattern = KT_WITHOUT_DOTS_IN_NAME)
}
testClass<AbstractFirDiagnosticsWithCfgAndStdlibTest> {
model("resolveWithStdlib/contracts", pattern = KT_WITHOUT_DOTS_IN_NAME)
model("resolveWithStdlib/smartcasts", pattern = KT_WITHOUT_DOTS_IN_NAME)
} }
} }