[FIR] Add NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY diagnostic

This commit is contained in:
Andrey Zinovyev
2021-07-08 15:29:31 +03:00
committed by teamcityserver
parent 151478aa27
commit a6984c5198
97 changed files with 939 additions and 1151 deletions
@@ -2,7 +2,7 @@ class StringBuilder {
fun append(s: String) {}
}
fun buildString(init: StringBuilder.() -> Unit): String {}
fun buildString(init: StringBuilder.() -> Unit): String {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
interface Template<in X>
@@ -18,10 +18,10 @@ fun test_2(n: Int) {
val y = n + 1
}
fun Int.bar(): Int {}
fun Int.bar(): Int {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
fun Int.baz(): Int {}
fun Byte.baz(): Byte {}
fun Int.baz(): Int {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
fun Byte.baz(): Byte {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
fun test_3() {
val x = 1.bar()
@@ -71,162 +71,163 @@ digraph flowFromInplaceLambda_kt {
21 [label="Enter block"];
22 [label="Const: Null(null)"];
23 [label="Check not null: Null(null)!!"];
24 [label="Jump: ^materialize Null(null)!!"];
25 [label="Stub" style="filled" fillcolor=gray];
26 [label="Exit block" style="filled" fillcolor=gray];
24 [label="Stub" style="filled" fillcolor=gray];
25 [label="Jump: ^materialize Null(null)!!" style="filled" fillcolor=gray];
26 [label="Stub" style="filled" fillcolor=gray];
27 [label="Exit block" style="filled" fillcolor=gray];
}
27 [label="Exit function materialize" style="filled" fillcolor=red];
28 [label="Exit function materialize" style="filled" fillcolor=red];
}
20 -> {21};
21 -> {22};
22 -> {23};
23 -> {24};
24 -> {27};
23 -> {28} [label=onUncaughtException];
23 -> {24} [style=dotted];
24 -> {25} [style=dotted];
25 -> {26} [style=dotted];
25 -> {28 26} [style=dotted];
26 -> {27} [style=dotted];
27 -> {28} [style=dotted];
subgraph cluster_8 {
color=red
28 [label="Enter function myRun" style="filled" fillcolor=red];
29 [label="Enter function myRun" style="filled" fillcolor=red];
subgraph cluster_9 {
color=blue
29 [label="Enter block"];
30 [label="Function call: R|<local>/block|.R|SubstitutionOverride<kotlin/Function0.invoke: R|R|>|()"];
31 [label="Jump: ^myRun R|<local>/block|.R|SubstitutionOverride<kotlin/Function0.invoke: R|R|>|()"];
32 [label="Stub" style="filled" fillcolor=gray];
33 [label="Exit block" style="filled" fillcolor=gray];
30 [label="Enter block"];
31 [label="Function call: R|<local>/block|.R|SubstitutionOverride<kotlin/Function0.invoke: R|R|>|()"];
32 [label="Jump: ^myRun R|<local>/block|.R|SubstitutionOverride<kotlin/Function0.invoke: R|R|>|()"];
33 [label="Stub" style="filled" fillcolor=gray];
34 [label="Exit block" style="filled" fillcolor=gray];
}
34 [label="Exit function myRun" style="filled" fillcolor=red];
35 [label="Exit function myRun" style="filled" fillcolor=red];
}
28 -> {29};
29 -> {30};
30 -> {31};
31 -> {34};
31 -> {32} [style=dotted];
31 -> {32};
32 -> {35};
32 -> {33} [style=dotted];
33 -> {34} [style=dotted];
34 -> {35} [style=dotted];
subgraph cluster_10 {
color=red
35 [label="Enter function test_1" style="filled" fillcolor=red];
36 [label="Enter function test_1" style="filled" fillcolor=red];
subgraph cluster_11 {
color=blue
36 [label="Enter block"];
37 [label="Postponed enter to lambda"];
37 [label="Enter block"];
38 [label="Postponed enter to lambda"];
subgraph cluster_12 {
color=blue
45 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
46 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
subgraph cluster_13 {
color=blue
46 [label="Enter block"];
47 [label="Access variable R|<local>/x|"];
48 [label="Type operator: (R|<local>/x| as R|kotlin/Int|)"];
49 [label="Exit block"];
47 [label="Enter block"];
48 [label="Access variable R|<local>/x|"];
49 [label="Type operator: (R|<local>/x| as R|kotlin/Int|)"];
50 [label="Exit block"];
}
50 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
51 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
}
38 [label="Call arguments union" style="filled" fillcolor=yellow];
39 [label="Postponed exit from lambda"];
40 [label="Function call: R|kotlin/run|<R|kotlin/Int|>(...)"];
41 [label="Access variable R|<local>/x|"];
42 [label="Function call: R|/takeInt|(...)"];
43 [label="Exit block"];
39 [label="Call arguments union" style="filled" fillcolor=yellow];
40 [label="Postponed exit from lambda"];
41 [label="Function call: R|kotlin/run|<R|kotlin/Int|>(...)"];
42 [label="Access variable R|<local>/x|"];
43 [label="Function call: R|/takeInt|(...)"];
44 [label="Exit block"];
}
44 [label="Exit function test_1" style="filled" fillcolor=red];
45 [label="Exit function test_1" style="filled" fillcolor=red];
}
35 -> {36};
36 -> {37};
37 -> {45};
37 -> {39} [color=red];
37 -> {45} [style=dashed];
37 -> {38};
38 -> {46};
38 -> {40} [color=red];
39 -> {40} [color=green];
40 -> {41};
38 -> {46} [style=dashed];
39 -> {41} [color=red];
40 -> {41} [color=green];
41 -> {42};
42 -> {43};
43 -> {44};
45 -> {46};
44 -> {45};
46 -> {47};
47 -> {48};
48 -> {49};
49 -> {50};
50 -> {38} [color=red];
50 -> {39} [color=green];
50 -> {51};
51 -> {39} [color=red];
51 -> {40} [color=green];
subgraph cluster_14 {
color=red
51 [label="Enter function test_2" style="filled" fillcolor=red];
52 [label="Enter function test_2" style="filled" fillcolor=red];
subgraph cluster_15 {
color=blue
52 [label="Enter block"];
53 [label="Postponed enter to lambda"];
53 [label="Enter block"];
54 [label="Postponed enter to lambda"];
subgraph cluster_16 {
color=blue
74 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
75 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
subgraph cluster_17 {
color=blue
75 [label="Enter block"];
76 [label="Access variable R|<local>/y|"];
77 [label="Function call: R|<local>/y|.<Unresolved name: inc>#()"];
78 [label="Access variable R|<local>/x|"];
79 [label="Type operator: (R|<local>/x| as R|kotlin/Int|)"];
80 [label="Exit block"];
76 [label="Enter block"];
77 [label="Access variable R|<local>/y|"];
78 [label="Function call: R|<local>/y|.<Unresolved name: inc>#()"];
79 [label="Access variable R|<local>/x|"];
80 [label="Type operator: (R|<local>/x| as R|kotlin/Int|)"];
81 [label="Exit block"];
}
81 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
82 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
}
54 [label="Postponed exit from lambda"];
55 [label="Function call: R|kotlin/run|<R|kotlin/Int|>(...)"];
56 [label="Call arguments union" style="filled" fillcolor=yellow];
57 [label="Function call: R|/id|<R|kotlin/Int|>(...)"];
58 [label="Access variable R|<local>/y|"];
59 [label="Type operator: (R|<local>/y| as R|kotlin/Int|)"];
60 [label="Postponed enter to lambda"];
55 [label="Postponed exit from lambda"];
56 [label="Function call: R|kotlin/run|<R|kotlin/Int|>(...)"];
57 [label="Call arguments union" style="filled" fillcolor=yellow];
58 [label="Function call: R|/id|<R|kotlin/Int|>(...)"];
59 [label="Access variable R|<local>/y|"];
60 [label="Type operator: (R|<local>/y| as R|kotlin/Int|)"];
61 [label="Postponed enter to lambda"];
subgraph cluster_18 {
color=blue
82 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
83 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
subgraph cluster_19 {
color=blue
83 [label="Enter block"];
84 [label="Access variable R|<local>/x|"];
85 [label="Function call: R|<local>/x|.R|kotlin/Int.inc|()"];
86 [label="Access variable R|<local>/y|"];
87 [label="Function call: R|<local>/y|.R|kotlin/Int.inc|()"];
88 [label="Const: Int(1)"];
89 [label="Exit block"];
84 [label="Enter block"];
85 [label="Access variable R|<local>/x|"];
86 [label="Function call: R|<local>/x|.R|kotlin/Int.inc|()"];
87 [label="Access variable R|<local>/y|"];
88 [label="Function call: R|<local>/y|.R|kotlin/Int.inc|()"];
89 [label="Const: Int(1)"];
90 [label="Exit block"];
}
90 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
91 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
}
61 [label="Postponed exit from lambda"];
62 [label="Function call: R|kotlin/run|<R|kotlin/Int|>(...)"];
63 [label="Call arguments union" style="filled" fillcolor=yellow];
64 [label="Function call: R|/select|<R|kotlin/Int|>(...)"];
65 [label="Variable declaration: lval a: R|kotlin/Int|"];
66 [label="Access variable R|<local>/x|"];
67 [label="Function call: R|/takeInt|(...)"];
68 [label="Access variable R|<local>/y|"];
69 [label="Function call: R|/takeInt|(...)"];
70 [label="Access variable R|<local>/a|"];
71 [label="Function call: R|/takeInt|(...)"];
72 [label="Exit block"];
62 [label="Postponed exit from lambda"];
63 [label="Function call: R|kotlin/run|<R|kotlin/Int|>(...)"];
64 [label="Call arguments union" style="filled" fillcolor=yellow];
65 [label="Function call: R|/select|<R|kotlin/Int|>(...)"];
66 [label="Variable declaration: lval a: R|kotlin/Int|"];
67 [label="Access variable R|<local>/x|"];
68 [label="Function call: R|/takeInt|(...)"];
69 [label="Access variable R|<local>/y|"];
70 [label="Function call: R|/takeInt|(...)"];
71 [label="Access variable R|<local>/a|"];
72 [label="Function call: R|/takeInt|(...)"];
73 [label="Exit block"];
}
73 [label="Exit function test_2" style="filled" fillcolor=red];
74 [label="Exit function test_2" style="filled" fillcolor=red];
}
51 -> {52};
52 -> {53};
53 -> {74};
53 -> {54} [color=red];
53 -> {74} [style=dashed];
54 -> {55};
53 -> {54};
54 -> {75};
54 -> {55} [color=red];
54 -> {75} [style=dashed];
55 -> {56};
56 -> {57};
57 -> {58};
58 -> {59};
59 -> {60};
60 -> {82};
60 -> {61} [color=red];
60 -> {82} [style=dashed];
61 -> {62};
60 -> {61};
61 -> {83};
61 -> {62} [color=red];
61 -> {83} [style=dashed];
62 -> {63};
63 -> {64};
64 -> {65};
@@ -238,16 +239,16 @@ digraph flowFromInplaceLambda_kt {
70 -> {71};
71 -> {72};
72 -> {73};
74 -> {75};
73 -> {74};
75 -> {76};
76 -> {77};
77 -> {78};
78 -> {79};
79 -> {80};
80 -> {81};
81 -> {56} [color=red];
81 -> {54} [color=green];
82 -> {83};
81 -> {82};
82 -> {57} [color=red];
82 -> {55} [color=green];
83 -> {84};
84 -> {85};
85 -> {86};
@@ -255,79 +256,79 @@ digraph flowFromInplaceLambda_kt {
87 -> {88};
88 -> {89};
89 -> {90};
90 -> {63} [color=red];
90 -> {61} [color=green];
90 -> {91};
91 -> {64} [color=red];
91 -> {62} [color=green];
subgraph cluster_20 {
color=red
91 [label="Enter function test_3" style="filled" fillcolor=red];
92 [label="Enter function test_3" style="filled" fillcolor=red];
subgraph cluster_21 {
color=blue
92 [label="Enter block"];
93 [label="Postponed enter to lambda"];
93 [label="Enter block"];
94 [label="Postponed enter to lambda"];
subgraph cluster_22 {
color=blue
111 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
112 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
subgraph cluster_23 {
color=blue
112 [label="Enter block"];
113 [label="Access variable R|<local>/y|"];
114 [label="Function call: R|<local>/y|.<Unresolved name: inc>#()"];
115 [label="Access variable R|<local>/x|"];
116 [label="Type operator: (R|<local>/x| as R|kotlin/Int|)"];
117 [label="Function call: R|/materialize|<R|kotlin/Int|>()"];
118 [label="Exit block"];
113 [label="Enter block"];
114 [label="Access variable R|<local>/y|"];
115 [label="Function call: R|<local>/y|.<Unresolved name: inc>#()"];
116 [label="Access variable R|<local>/x|"];
117 [label="Type operator: (R|<local>/x| as R|kotlin/Int|)"];
118 [label="Function call: R|/materialize|<R|kotlin/Int|>()"];
119 [label="Exit block"];
}
119 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
120 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
}
94 [label="Postponed exit from lambda"];
95 [label="Function call: R|kotlin/run|<R|kotlin/Int|>(...)"];
96 [label="Function call: R|/id|<R|kotlin/Int|>(...)"];
97 [label="Postponed enter to lambda"];
95 [label="Postponed exit from lambda"];
96 [label="Function call: R|kotlin/run|<R|kotlin/Int|>(...)"];
97 [label="Function call: R|/id|<R|kotlin/Int|>(...)"];
98 [label="Postponed enter to lambda"];
subgraph cluster_24 {
color=blue
120 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
121 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
subgraph cluster_25 {
color=blue
121 [label="Enter block"];
122 [label="Access variable R|<local>/y|"];
123 [label="Type operator: (R|<local>/y| as R|kotlin/Int|)"];
124 [label="Access variable R|<local>/x|"];
125 [label="Function call: R|<local>/x|.<Unresolved name: inc>#()"];
126 [label="Access variable R|<local>/y|"];
127 [label="Function call: R|<local>/y|.R|kotlin/Int.inc|()"];
128 [label="Const: Int(1)"];
129 [label="Exit block"];
122 [label="Enter block"];
123 [label="Access variable R|<local>/y|"];
124 [label="Type operator: (R|<local>/y| as R|kotlin/Int|)"];
125 [label="Access variable R|<local>/x|"];
126 [label="Function call: R|<local>/x|.<Unresolved name: inc>#()"];
127 [label="Access variable R|<local>/y|"];
128 [label="Function call: R|<local>/y|.R|kotlin/Int.inc|()"];
129 [label="Const: Int(1)"];
130 [label="Exit block"];
}
130 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
131 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
}
98 [label="Postponed exit from lambda"];
99 [label="Function call: R|kotlin/run|<R|kotlin/Int|>(...)"];
100 [label="Call arguments union" style="filled" fillcolor=yellow];
101 [label="Function call: R|/select|<R|kotlin/Int|>(...)"];
102 [label="Variable declaration: lval a: R|kotlin/Int|"];
103 [label="Access variable R|<local>/x|"];
104 [label="Function call: R|/takeInt|(...)"];
105 [label="Access variable R|<local>/y|"];
106 [label="Function call: R|/takeInt|(...)"];
107 [label="Access variable R|<local>/a|"];
108 [label="Function call: R|/takeInt|(...)"];
109 [label="Exit block"];
99 [label="Postponed exit from lambda"];
100 [label="Function call: R|kotlin/run|<R|kotlin/Int|>(...)"];
101 [label="Call arguments union" style="filled" fillcolor=yellow];
102 [label="Function call: R|/select|<R|kotlin/Int|>(...)"];
103 [label="Variable declaration: lval a: R|kotlin/Int|"];
104 [label="Access variable R|<local>/x|"];
105 [label="Function call: R|/takeInt|(...)"];
106 [label="Access variable R|<local>/y|"];
107 [label="Function call: R|/takeInt|(...)"];
108 [label="Access variable R|<local>/a|"];
109 [label="Function call: R|/takeInt|(...)"];
110 [label="Exit block"];
}
110 [label="Exit function test_3" style="filled" fillcolor=red];
111 [label="Exit function test_3" style="filled" fillcolor=red];
}
91 -> {92};
92 -> {93};
93 -> {111};
93 -> {94} [color=red];
93 -> {111} [style=dashed];
94 -> {95};
93 -> {94};
94 -> {112};
94 -> {95} [color=red];
94 -> {112} [style=dashed];
95 -> {96};
96 -> {97};
97 -> {120};
97 -> {98} [color=red];
97 -> {120} [style=dashed];
98 -> {99};
97 -> {98};
98 -> {121};
98 -> {99} [color=red];
98 -> {121} [style=dashed];
99 -> {100};
100 -> {101};
101 -> {102};
@@ -339,7 +340,7 @@ digraph flowFromInplaceLambda_kt {
107 -> {108};
108 -> {109};
109 -> {110};
111 -> {112};
110 -> {111};
112 -> {113};
113 -> {114};
114 -> {115};
@@ -347,9 +348,9 @@ digraph flowFromInplaceLambda_kt {
116 -> {117};
117 -> {118};
118 -> {119};
119 -> {100} [color=red];
119 -> {94} [color=green];
120 -> {121};
119 -> {120};
120 -> {101} [color=red];
120 -> {95} [color=green];
121 -> {122};
122 -> {123};
123 -> {124};
@@ -359,77 +360,77 @@ digraph flowFromInplaceLambda_kt {
127 -> {128};
128 -> {129};
129 -> {130};
130 -> {100} [color=red];
130 -> {98} [color=green];
130 -> {131};
131 -> {101} [color=red];
131 -> {99} [color=green];
subgraph cluster_26 {
color=red
131 [label="Enter function test_4" style="filled" fillcolor=red];
132 [label="Enter function test_4" style="filled" fillcolor=red];
subgraph cluster_27 {
color=blue
132 [label="Enter block"];
133 [label="Postponed enter to lambda"];
133 [label="Enter block"];
134 [label="Postponed enter to lambda"];
subgraph cluster_28 {
color=blue
152 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
153 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
subgraph cluster_29 {
color=blue
153 [label="Enter block"];
154 [label="Access variable R|<local>/y|"];
155 [label="Function call: R|<local>/y|.<Unresolved name: inc>#()"];
156 [label="Access variable R|<local>/x|"];
157 [label="Type operator: (R|<local>/x| as R|kotlin/Int|)"];
158 [label="Exit block"];
154 [label="Enter block"];
155 [label="Access variable R|<local>/y|"];
156 [label="Function call: R|<local>/y|.<Unresolved name: inc>#()"];
157 [label="Access variable R|<local>/x|"];
158 [label="Type operator: (R|<local>/x| as R|kotlin/Int|)"];
159 [label="Exit block"];
}
159 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
160 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
}
134 [label="Postponed exit from lambda"];
135 [label="Function call: R|/myRun|<R|kotlin/Int|>(...)"];
136 [label="Function call: R|/id|<R|kotlin/Int|>(...)"];
137 [label="Access variable R|<local>/y|"];
138 [label="Type operator: (R|<local>/y| as R|kotlin/Int|)"];
139 [label="Postponed enter to lambda"];
135 [label="Postponed exit from lambda"];
136 [label="Function call: R|/myRun|<R|kotlin/Int|>(...)"];
137 [label="Function call: R|/id|<R|kotlin/Int|>(...)"];
138 [label="Access variable R|<local>/y|"];
139 [label="Type operator: (R|<local>/y| as R|kotlin/Int|)"];
140 [label="Postponed enter to lambda"];
subgraph cluster_30 {
color=blue
160 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
161 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
subgraph cluster_31 {
color=blue
161 [label="Enter block"];
162 [label="Access variable R|<local>/x|"];
163 [label="Function call: R|<local>/x|.<Unresolved name: inc>#()"];
164 [label="Access variable R|<local>/y|"];
165 [label="Function call: R|<local>/y|.R|kotlin/Int.inc|()"];
166 [label="Const: Int(1)"];
167 [label="Exit block"];
162 [label="Enter block"];
163 [label="Access variable R|<local>/x|"];
164 [label="Function call: R|<local>/x|.<Unresolved name: inc>#()"];
165 [label="Access variable R|<local>/y|"];
166 [label="Function call: R|<local>/y|.R|kotlin/Int.inc|()"];
167 [label="Const: Int(1)"];
168 [label="Exit block"];
}
168 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
169 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
}
140 [label="Postponed exit from lambda"];
141 [label="Function call: R|/myRun|<R|kotlin/Int|>(...)"];
142 [label="Function call: R|/select|<R|kotlin/Int|>(...)"];
143 [label="Variable declaration: lval a: R|kotlin/Int|"];
144 [label="Access variable R|<local>/x|"];
145 [label="Function call: <Inapplicable(INAPPLICABLE): /takeInt>#(...)"];
146 [label="Access variable R|<local>/y|"];
147 [label="Function call: R|/takeInt|(...)"];
148 [label="Access variable R|<local>/a|"];
149 [label="Function call: R|/takeInt|(...)"];
150 [label="Exit block"];
141 [label="Postponed exit from lambda"];
142 [label="Function call: R|/myRun|<R|kotlin/Int|>(...)"];
143 [label="Function call: R|/select|<R|kotlin/Int|>(...)"];
144 [label="Variable declaration: lval a: R|kotlin/Int|"];
145 [label="Access variable R|<local>/x|"];
146 [label="Function call: <Inapplicable(INAPPLICABLE): /takeInt>#(...)"];
147 [label="Access variable R|<local>/y|"];
148 [label="Function call: R|/takeInt|(...)"];
149 [label="Access variable R|<local>/a|"];
150 [label="Function call: R|/takeInt|(...)"];
151 [label="Exit block"];
}
151 [label="Exit function test_4" style="filled" fillcolor=red];
152 [label="Exit function test_4" style="filled" fillcolor=red];
}
131 -> {132};
132 -> {133};
133 -> {134 152};
133 -> {152} [style=dashed];
134 -> {135};
133 -> {134};
134 -> {135 153};
134 -> {153} [style=dashed];
135 -> {136};
136 -> {137};
137 -> {138};
138 -> {139};
139 -> {140 160};
139 -> {160} [style=dashed];
140 -> {141};
139 -> {140};
140 -> {141 161};
140 -> {161} [style=dashed];
141 -> {142};
142 -> {143};
143 -> {144};
@@ -440,14 +441,14 @@ digraph flowFromInplaceLambda_kt {
148 -> {149};
149 -> {150};
150 -> {151};
152 -> {153};
151 -> {152};
153 -> {154};
154 -> {155};
155 -> {156};
156 -> {157};
157 -> {158};
158 -> {159};
160 -> {161};
159 -> {160};
161 -> {162};
162 -> {163};
163 -> {164};
@@ -455,61 +456,61 @@ digraph flowFromInplaceLambda_kt {
165 -> {166};
166 -> {167};
167 -> {168};
168 -> {169};
subgraph cluster_32 {
color=red
169 [label="Enter function test_5" style="filled" fillcolor=red];
170 [label="Enter function test_5" style="filled" fillcolor=red];
subgraph cluster_33 {
color=blue
170 [label="Enter block"];
171 [label="Postponed enter to lambda"];
171 [label="Enter block"];
172 [label="Postponed enter to lambda"];
subgraph cluster_34 {
color=blue
184 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
185 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
subgraph cluster_35 {
color=blue
185 [label="Enter block"];
186 [label="Function call: R|/materialize|<R|kotlin/Int|>()"];
187 [label="Exit block"];
186 [label="Enter block"];
187 [label="Function call: R|/materialize|<R|kotlin/Int|>()"];
188 [label="Exit block"];
}
188 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
189 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
}
172 [label="Postponed exit from lambda"];
173 [label="Function call: R|kotlin/run|<R|kotlin/Int|>(...)"];
174 [label="Postponed enter to lambda"];
173 [label="Postponed exit from lambda"];
174 [label="Function call: R|kotlin/run|<R|kotlin/Int|>(...)"];
175 [label="Postponed enter to lambda"];
subgraph cluster_36 {
color=blue
189 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
190 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
subgraph cluster_37 {
color=blue
190 [label="Enter block"];
191 [label="Function call: R|/materialize|<R|kotlin/Int|>()"];
192 [label="Exit block"];
191 [label="Enter block"];
192 [label="Function call: R|/materialize|<R|kotlin/Int|>()"];
193 [label="Exit block"];
}
193 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
194 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
}
175 [label="Postponed exit from lambda"];
176 [label="Function call: R|kotlin/run|<R|kotlin/Int|>(...)"];
177 [label="Call arguments union" style="filled" fillcolor=yellow];
178 [label="Function call: R|/select|<R|kotlin/Int|>(...)"];
179 [label="Variable declaration: lval x: R|kotlin/Int|"];
180 [label="Access variable R|<local>/x|"];
181 [label="Function call: R|/takeInt|(...)"];
182 [label="Exit block"];
176 [label="Postponed exit from lambda"];
177 [label="Function call: R|kotlin/run|<R|kotlin/Int|>(...)"];
178 [label="Call arguments union" style="filled" fillcolor=yellow];
179 [label="Function call: R|/select|<R|kotlin/Int|>(...)"];
180 [label="Variable declaration: lval x: R|kotlin/Int|"];
181 [label="Access variable R|<local>/x|"];
182 [label="Function call: R|/takeInt|(...)"];
183 [label="Exit block"];
}
183 [label="Exit function test_5" style="filled" fillcolor=red];
184 [label="Exit function test_5" style="filled" fillcolor=red];
}
169 -> {170};
170 -> {171};
171 -> {184};
171 -> {172} [color=red];
171 -> {184} [style=dashed];
172 -> {173};
171 -> {172};
172 -> {185};
172 -> {173} [color=red];
172 -> {185} [style=dashed];
173 -> {174};
174 -> {189};
174 -> {175} [color=red];
174 -> {189} [style=dashed];
175 -> {176};
174 -> {175};
175 -> {190};
175 -> {176} [color=red];
175 -> {190} [style=dashed];
176 -> {177};
177 -> {178};
178 -> {179};
@@ -517,79 +518,80 @@ digraph flowFromInplaceLambda_kt {
180 -> {181};
181 -> {182};
182 -> {183};
184 -> {185};
183 -> {184};
185 -> {186};
186 -> {187};
187 -> {188};
188 -> {177} [color=red];
188 -> {172} [color=green];
189 -> {190};
188 -> {189};
189 -> {178} [color=red];
189 -> {173} [color=green];
190 -> {191};
191 -> {192};
192 -> {193};
193 -> {177} [color=red];
193 -> {175} [color=green];
193 -> {194};
194 -> {178} [color=red];
194 -> {176} [color=green];
subgraph cluster_38 {
color=red
194 [label="Enter function test_6" style="filled" fillcolor=red];
195 [label="Enter function test_6" style="filled" fillcolor=red];
subgraph cluster_39 {
color=blue
195 [label="Enter block"];
196 [label="Postponed enter to lambda"];
196 [label="Enter block"];
197 [label="Postponed enter to lambda"];
subgraph cluster_40 {
color=blue
203 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
204 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
subgraph cluster_41 {
color=blue
204 [label="Enter block"];
205 [label="Postponed enter to lambda"];
205 [label="Enter block"];
206 [label="Postponed enter to lambda"];
subgraph cluster_42 {
color=blue
210 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
211 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
subgraph cluster_43 {
color=blue
211 [label="Enter block"];
212 [label="Function call: R|/materialize|<R|kotlin/String|>()"];
213 [label="Exit block"];
212 [label="Enter block"];
213 [label="Function call: R|/materialize|<R|kotlin/String|>()"];
214 [label="Exit block"];
}
214 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
215 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
}
206 [label="Postponed exit from lambda"];
207 [label="Function call: R|kotlin/run|<R|kotlin/String|>(...)"];
208 [label="Exit block"];
207 [label="Postponed exit from lambda"];
208 [label="Function call: R|kotlin/run|<R|kotlin/String|>(...)"];
209 [label="Exit block"];
}
209 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
210 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
}
197 [label="Postponed exit from lambda"];
198 [label="Function call: R|/myRun|<R|kotlin/String|>(...)"];
199 [label="Function call: R|/id|<R|kotlin/String|>(...)"];
200 [label="Variable declaration: lval x: R|kotlin/String|"];
201 [label="Exit block"];
198 [label="Postponed exit from lambda"];
199 [label="Function call: R|/myRun|<R|kotlin/String|>(...)"];
200 [label="Function call: R|/id|<R|kotlin/String|>(...)"];
201 [label="Variable declaration: lval x: R|kotlin/String|"];
202 [label="Exit block"];
}
202 [label="Exit function test_6" style="filled" fillcolor=red];
203 [label="Exit function test_6" style="filled" fillcolor=red];
}
194 -> {195};
195 -> {196};
196 -> {197 203};
196 -> {203} [style=dashed];
197 -> {198};
196 -> {197};
197 -> {198 204};
197 -> {204} [style=dashed];
198 -> {199};
199 -> {200};
200 -> {201};
201 -> {202};
203 -> {204};
202 -> {203};
204 -> {205};
205 -> {210};
205 -> {206} [color=red];
205 -> {210} [style=dashed];
206 -> {207};
205 -> {206};
206 -> {211};
206 -> {207} [color=red];
206 -> {211} [style=dashed];
207 -> {208};
208 -> {209};
210 -> {211};
209 -> {210};
211 -> {212};
212 -> {213};
213 -> {214};
214 -> {206} [color=green];
214 -> {215};
215 -> {207} [color=green];
}
@@ -11,175 +11,176 @@ digraph inplaceLambdaInControlFlowExpressions_kt {
1 [label="Enter block"];
2 [label="Const: Null(null)"];
3 [label="Check not null: Null(null)!!"];
4 [label="Jump: ^materialize Null(null)!!"];
5 [label="Stub" style="filled" fillcolor=gray];
6 [label="Exit block" style="filled" fillcolor=gray];
4 [label="Stub" style="filled" fillcolor=gray];
5 [label="Jump: ^materialize Null(null)!!" style="filled" fillcolor=gray];
6 [label="Stub" style="filled" fillcolor=gray];
7 [label="Exit block" style="filled" fillcolor=gray];
}
7 [label="Exit function materialize" style="filled" fillcolor=red];
8 [label="Exit function materialize" style="filled" fillcolor=red];
}
0 -> {1};
1 -> {2};
2 -> {3};
3 -> {4};
4 -> {7};
3 -> {8} [label=onUncaughtException];
3 -> {4} [style=dotted];
4 -> {5} [style=dotted];
5 -> {6} [style=dotted];
5 -> {8 6} [style=dotted];
6 -> {7} [style=dotted];
7 -> {8} [style=dotted];
subgraph cluster_2 {
color=red
8 [label="Enter function test_1" style="filled" fillcolor=red];
9 [label="Enter function test_1" style="filled" fillcolor=red];
subgraph cluster_3 {
color=blue
9 [label="Enter block"];
10 [label="Enter block"];
subgraph cluster_4 {
color=blue
10 [label="Enter when"];
11 [label="Enter when"];
subgraph cluster_5 {
color=blue
11 [label="Enter when branch condition "];
12 [label="Const: Boolean(true)"];
13 [label="Exit when branch condition"];
12 [label="Enter when branch condition "];
13 [label="Const: Boolean(true)"];
14 [label="Exit when branch condition"];
}
subgraph cluster_6 {
color=blue
14 [label="Enter when branch condition else"];
15 [label="Exit when branch condition"];
15 [label="Enter when branch condition else"];
16 [label="Exit when branch condition"];
}
16 [label="Enter when branch result"];
17 [label="Enter when branch result"];
subgraph cluster_7 {
color=blue
17 [label="Enter block"];
18 [label="Const: String()"];
19 [label="Exit block"];
18 [label="Enter block"];
19 [label="Const: String()"];
20 [label="Exit block"];
}
20 [label="Exit when branch result"];
21 [label="Enter when branch result"];
21 [label="Exit when branch result"];
22 [label="Enter when branch result"];
subgraph cluster_8 {
color=blue
22 [label="Enter block"];
23 [label="Postponed enter to lambda"];
23 [label="Enter block"];
24 [label="Postponed enter to lambda"];
subgraph cluster_9 {
color=blue
32 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
33 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
subgraph cluster_10 {
color=blue
33 [label="Enter block"];
34 [label="Function call: R|/materialize|<R|kotlin/String|>()"];
35 [label="Exit block"];
34 [label="Enter block"];
35 [label="Function call: R|/materialize|<R|kotlin/String|>()"];
36 [label="Exit block"];
}
36 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
37 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
}
24 [label="Postponed exit from lambda"];
25 [label="Function call: R|kotlin/run|<R|kotlin/String|>(...)"];
26 [label="Exit block"];
25 [label="Postponed exit from lambda"];
26 [label="Function call: R|kotlin/run|<R|kotlin/String|>(...)"];
27 [label="Exit block"];
}
27 [label="Exit when branch result"];
28 [label="Exit when"];
28 [label="Exit when branch result"];
29 [label="Exit when"];
}
29 [label="Variable declaration: lval x: R|kotlin/String|"];
30 [label="Exit block"];
30 [label="Variable declaration: lval x: R|kotlin/String|"];
31 [label="Exit block"];
}
31 [label="Exit function test_1" style="filled" fillcolor=red];
32 [label="Exit function test_1" style="filled" fillcolor=red];
}
8 -> {9};
9 -> {10};
10 -> {11};
11 -> {12};
12 -> {13};
13 -> {21 14};
14 -> {15};
13 -> {14};
14 -> {22 15};
15 -> {16};
16 -> {17};
17 -> {18};
18 -> {19};
19 -> {20};
20 -> {28};
21 -> {22};
20 -> {21};
21 -> {29};
22 -> {23};
23 -> {32};
23 -> {24} [color=red];
23 -> {32} [style=dashed];
24 -> {25};
23 -> {24};
24 -> {33};
24 -> {25} [color=red];
24 -> {33} [style=dashed];
25 -> {26};
26 -> {27};
27 -> {28};
28 -> {29};
29 -> {30};
30 -> {31};
32 -> {33};
31 -> {32};
33 -> {34};
34 -> {35};
35 -> {36};
36 -> {24} [color=green];
36 -> {37};
37 -> {25} [color=green];
subgraph cluster_11 {
color=red
37 [label="Enter function test_2" style="filled" fillcolor=red];
38 [label="Enter function test_2" style="filled" fillcolor=red];
subgraph cluster_12 {
color=blue
38 [label="Enter block"];
39 [label="Enter block"];
subgraph cluster_13 {
color=blue
39 [label="Try expression enter"];
40 [label="Try expression enter"];
subgraph cluster_14 {
color=blue
40 [label="Try main block enter"];
41 [label="Try main block enter"];
subgraph cluster_15 {
color=blue
41 [label="Enter block"];
42 [label="Postponed enter to lambda"];
42 [label="Enter block"];
43 [label="Postponed enter to lambda"];
subgraph cluster_16 {
color=blue
57 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
58 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
subgraph cluster_17 {
color=blue
58 [label="Enter block"];
59 [label="Function call: R|/materialize|<R|kotlin/String|>()"];
60 [label="Exit block"];
59 [label="Enter block"];
60 [label="Function call: R|/materialize|<R|kotlin/String|>()"];
61 [label="Exit block"];
}
61 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
62 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
}
43 [label="Postponed exit from lambda"];
44 [label="Function call: R|kotlin/run|<R|kotlin/String|>(...)"];
45 [label="Exit block"];
44 [label="Postponed exit from lambda"];
45 [label="Function call: R|kotlin/run|<R|kotlin/String|>(...)"];
46 [label="Exit block"];
}
46 [label="Try main block exit"];
47 [label="Try main block exit"];
}
subgraph cluster_18 {
color=blue
47 [label="Catch enter"];
48 [label="Catch enter"];
subgraph cluster_19 {
color=blue
48 [label="Enter block"];
49 [label="Const: String()"];
50 [label="Exit block"];
49 [label="Enter block"];
50 [label="Const: String()"];
51 [label="Exit block"];
}
51 [label="Catch exit"];
52 [label="Catch exit"];
}
52 [label="Try expression exit"];
53 [label="Try expression exit"];
}
53 [label="Call arguments union" style="filled" fillcolor=yellow];
54 [label="Variable declaration: lval x: R|kotlin/String|"];
55 [label="Exit block"];
54 [label="Call arguments union" style="filled" fillcolor=yellow];
55 [label="Variable declaration: lval x: R|kotlin/String|"];
56 [label="Exit block"];
}
56 [label="Exit function test_2" style="filled" fillcolor=red];
57 [label="Exit function test_2" style="filled" fillcolor=red];
}
37 -> {38};
38 -> {39};
39 -> {40 47};
40 -> {41};
39 -> {40};
40 -> {41 48};
41 -> {42};
42 -> {57};
42 -> {43} [color=red];
42 -> {57} [style=dashed];
43 -> {44};
42 -> {43};
43 -> {58};
43 -> {44} [color=red];
43 -> {58} [style=dashed];
44 -> {45};
45 -> {46};
46 -> {52 47};
47 -> {48};
47 -> {56} [label=onUncaughtException];
46 -> {47};
47 -> {53 48};
48 -> {49};
48 -> {57} [label=onUncaughtException];
49 -> {50};
50 -> {51};
51 -> {52};
@@ -187,56 +188,57 @@ digraph inplaceLambdaInControlFlowExpressions_kt {
53 -> {54};
54 -> {55};
55 -> {56};
57 -> {58};
56 -> {57};
58 -> {59};
59 -> {60};
60 -> {61};
61 -> {53} [color=red];
61 -> {43} [color=green];
61 -> {62};
62 -> {54} [color=red];
62 -> {44} [color=green];
subgraph cluster_20 {
color=red
62 [label="Enter function test_3" style="filled" fillcolor=red];
63 [label="Enter function test_3" style="filled" fillcolor=red];
subgraph cluster_21 {
color=blue
63 [label="Enter block"];
64 [label="Postponed enter to lambda"];
64 [label="Enter block"];
65 [label="Postponed enter to lambda"];
subgraph cluster_22 {
color=blue
72 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
73 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
subgraph cluster_23 {
color=blue
73 [label="Enter block"];
74 [label="Function call: R|/materialize|<R|kotlin/String?|>()"];
75 [label="Exit block"];
74 [label="Enter block"];
75 [label="Function call: R|/materialize|<R|kotlin/String?|>()"];
76 [label="Exit block"];
}
76 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
77 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
}
65 [label="Postponed exit from lambda"];
66 [label="Function call: R|kotlin/run|<R|kotlin/String?|>(...)"];
67 [label="Check not null: R|kotlin/run|<R|kotlin/String?|>(...)!!"];
68 [label="Call arguments union" style="filled" fillcolor=yellow];
69 [label="Variable declaration: lval x: R|kotlin/String|"];
70 [label="Exit block"];
66 [label="Postponed exit from lambda"];
67 [label="Function call: R|kotlin/run|<R|kotlin/String?|>(...)"];
68 [label="Check not null: R|kotlin/run|<R|kotlin/String?|>(...)!!"];
69 [label="Call arguments union" style="filled" fillcolor=yellow];
70 [label="Variable declaration: lval x: R|kotlin/String|"];
71 [label="Exit block"];
}
71 [label="Exit function test_3" style="filled" fillcolor=red];
72 [label="Exit function test_3" style="filled" fillcolor=red];
}
62 -> {63};
63 -> {64};
64 -> {72};
64 -> {65} [color=red];
64 -> {72} [style=dashed];
65 -> {66};
64 -> {65};
65 -> {73};
65 -> {66} [color=red];
65 -> {73} [style=dashed];
66 -> {67};
67 -> {68};
68 -> {69};
69 -> {70};
70 -> {71};
72 -> {73};
71 -> {72};
73 -> {74};
74 -> {75};
75 -> {76};
76 -> {68} [color=red];
76 -> {65} [color=green];
76 -> {77};
77 -> {69} [color=red];
77 -> {66} [color=green];
}
@@ -22,5 +22,5 @@ class KClassValue(value: Value) : ConstantValue<KClassValue.Value>(value) {
val (classId, arrayDimensions) = value.value
}
}
}
<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
}
@@ -1,5 +1,5 @@
class Foo {
operator fun plus(f: Foo): Foo {}
operator fun plus(f: Foo): Foo {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
operator fun plusAssign(f: Foo) {}
}
@@ -2,7 +2,7 @@ fun <T> simpleRun(f: (T) -> Unit): Unit = f(<!RETURN_IN_FUNCTION_WITH_EXPRESSION
fun <T, R> List<T>.simpleMap(f: (T) -> R): R {
}
<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
fun <T> simpleWith(t: T, f: T.() -> Unit): Unit = t.f()
@@ -32,7 +32,7 @@ class NamedCompilerPhase<in Context : CommonBackendContext, Data>(
}
}
runAfter(phaseConfig, phaserState, context, output)
}
<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
private fun runAfter(phaseConfig: PhaseConfig, phaserState: PhaserState<Data>, context: Context, output: Data) {
@@ -40,5 +40,5 @@ class NamedCompilerPhase<in Context : CommonBackendContext, Data>(
private fun runAndProfile(phaseConfig: PhaseConfig, phaserState: PhaserState<Data>, context: Context, source: Data): Data {
}
}
<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
}
@@ -33,7 +33,7 @@ public interface Klass extends TypeParametersOwner {
fun List<String>.single(): String = ""
fun List<Int>.single(): Int = 2
fun listOf(): List<String> {}
fun listOf(): List<String> {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
public open class LightMember<D> : Member<D>, Light() {
override fun getName(): String = "Light"
@@ -99,157 +99,158 @@ digraph smartcastToNothing_kt {
31 [label="Enter block"];
32 [label="Const: Null(null)"];
33 [label="Check not null: Null(null)!!"];
34 [label="Jump: ^myListOf Null(null)!!"];
35 [label="Stub" style="filled" fillcolor=gray];
36 [label="Exit block" style="filled" fillcolor=gray];
34 [label="Stub" style="filled" fillcolor=gray];
35 [label="Jump: ^myListOf Null(null)!!" style="filled" fillcolor=gray];
36 [label="Stub" style="filled" fillcolor=gray];
37 [label="Exit block" style="filled" fillcolor=gray];
}
37 [label="Exit function myListOf" style="filled" fillcolor=red];
38 [label="Exit function myListOf" style="filled" fillcolor=red];
}
30 -> {31};
31 -> {32};
32 -> {33};
33 -> {34};
34 -> {37};
33 -> {38} [label=onUncaughtException];
33 -> {34} [style=dotted];
34 -> {35} [style=dotted];
35 -> {36} [style=dotted];
35 -> {38 36} [style=dotted];
36 -> {37} [style=dotted];
37 -> {38} [style=dotted];
subgraph cluster_10 {
color=red
38 [label="Enter function <init>" style="filled" fillcolor=red];
39 [label="Delegated constructor call: super<R|kotlin/Any|>()"];
40 [label="Exit function <init>" style="filled" fillcolor=red];
39 [label="Enter function <init>" style="filled" fillcolor=red];
40 [label="Delegated constructor call: super<R|kotlin/Any|>()"];
41 [label="Exit function <init>" style="filled" fillcolor=red];
}
38 -> {39};
39 -> {40};
40 -> {41};
subgraph cluster_11 {
color=red
41 [label="Enter property" style="filled" fillcolor=red];
42 [label="Const: Int(1)"];
43 [label="Exit property" style="filled" fillcolor=red];
42 [label="Enter property" style="filled" fillcolor=red];
43 [label="Const: Int(1)"];
44 [label="Exit property" style="filled" fillcolor=red];
}
41 -> {42};
42 -> {43};
43 -> {49} [color=green];
43 -> {44};
44 -> {50} [color=green];
subgraph cluster_12 {
color=red
44 [label="Enter property" style="filled" fillcolor=red];
45 [label="Const: Boolean(true)"];
46 [label="Exit property" style="filled" fillcolor=red];
45 [label="Enter property" style="filled" fillcolor=red];
46 [label="Const: Boolean(true)"];
47 [label="Exit property" style="filled" fillcolor=red];
}
44 -> {45};
45 -> {46};
46 -> {50} [color=green];
46 -> {47};
47 -> {51} [color=green];
subgraph cluster_13 {
color=red
47 [label="Enter class A" style="filled" fillcolor=red];
48 [label="Part of class initialization"];
48 [label="Enter class A" style="filled" fillcolor=red];
49 [label="Part of class initialization"];
50 [label="Exit class A" style="filled" fillcolor=red];
50 [label="Part of class initialization"];
51 [label="Exit class A" style="filled" fillcolor=red];
}
47 -> {48} [color=green];
48 -> {49} [style=dotted];
48 -> {41} [color=green];
48 -> {41} [style=dashed];
48 -> {49} [color=green];
49 -> {50} [style=dotted];
49 -> {44} [color=green];
49 -> {44} [style=dashed];
49 -> {42} [color=green];
49 -> {42} [style=dashed];
50 -> {51} [style=dotted];
50 -> {45} [color=green];
50 -> {45} [style=dashed];
subgraph cluster_14 {
color=red
51 [label="Enter function test_0" style="filled" fillcolor=red];
52 [label="Enter function test_0" style="filled" fillcolor=red];
subgraph cluster_15 {
color=blue
52 [label="Enter block"];
53 [label="Const: Null(null)"];
54 [label="Variable declaration: lvar s: R|A?|"];
53 [label="Enter block"];
54 [label="Const: Null(null)"];
55 [label="Variable declaration: lvar s: R|A?|"];
subgraph cluster_16 {
color=blue
55 [label="Enter block"];
56 [label="Access variable R|<local>/results|"];
57 [label="Function call: R|<local>/results|.R|SubstitutionOverride<kotlin/collections/List.iterator: R|kotlin/collections/Iterator<kotlin/Nothing>|>|()"];
58 [label="Variable declaration: lval <iterator>: R|kotlin/collections/Iterator<kotlin/Nothing>|"];
56 [label="Enter block"];
57 [label="Access variable R|<local>/results|"];
58 [label="Function call: R|<local>/results|.R|SubstitutionOverride<kotlin/collections/List.iterator: R|kotlin/collections/Iterator<kotlin/Nothing>|>|()"];
59 [label="Variable declaration: lval <iterator>: R|kotlin/collections/Iterator<kotlin/Nothing>|"];
subgraph cluster_17 {
color=blue
59 [label="Enter while loop"];
60 [label="Enter while loop"];
subgraph cluster_18 {
color=blue
60 [label="Enter loop condition"];
61 [label="Access variable R|<local>/<iterator>|"];
62 [label="Function call: R|<local>/<iterator>|.R|kotlin/collections/Iterator.hasNext|()"];
63 [label="Exit loop condition"];
61 [label="Enter loop condition"];
62 [label="Access variable R|<local>/<iterator>|"];
63 [label="Function call: R|<local>/<iterator>|.R|kotlin/collections/Iterator.hasNext|()"];
64 [label="Exit loop condition"];
}
subgraph cluster_19 {
color=blue
64 [label="Enter loop block"];
65 [label="Enter loop block"];
subgraph cluster_20 {
color=blue
65 [label="Enter block"];
66 [label="Access variable R|<local>/<iterator>|"];
67 [label="Function call: R|<local>/<iterator>|.R|SubstitutionOverride<kotlin/collections/Iterator.next: R|kotlin/Nothing|>|()"];
68 [label="Stub" style="filled" fillcolor=gray];
69 [label="Variable declaration: lval result: R|kotlin/Nothing|" style="filled" fillcolor=gray];
70 [label="Access variable R|<local>/result|" style="filled" fillcolor=gray];
71 [label="Stub" style="filled" fillcolor=gray];
72 [label="Assignment: R|<local>/s|" style="filled" fillcolor=gray];
66 [label="Enter block"];
67 [label="Access variable R|<local>/<iterator>|"];
68 [label="Function call: R|<local>/<iterator>|.R|SubstitutionOverride<kotlin/collections/Iterator.next: R|kotlin/Nothing|>|()"];
69 [label="Stub" style="filled" fillcolor=gray];
70 [label="Variable declaration: lval result: R|kotlin/Nothing|" style="filled" fillcolor=gray];
71 [label="Access variable R|<local>/result|" style="filled" fillcolor=gray];
72 [label="Stub" style="filled" fillcolor=gray];
73 [label="Assignment: R|<local>/s|" style="filled" fillcolor=gray];
subgraph cluster_21 {
color=blue
73 [label="Enter when" style="filled" fillcolor=gray];
74 [label="Enter when" style="filled" fillcolor=gray];
subgraph cluster_22 {
color=blue
74 [label="Enter when branch condition " style="filled" fillcolor=gray];
75 [label="Access variable R|<local>/result|" style="filled" fillcolor=gray];
76 [label="Stub" style="filled" fillcolor=gray];
77 [label="Access variable <Unresolved name: b>#" style="filled" fillcolor=gray];
78 [label="Exit when branch condition" style="filled" fillcolor=gray];
75 [label="Enter when branch condition " style="filled" fillcolor=gray];
76 [label="Access variable R|<local>/result|" style="filled" fillcolor=gray];
77 [label="Stub" style="filled" fillcolor=gray];
78 [label="Access variable <Unresolved name: b>#" style="filled" fillcolor=gray];
79 [label="Exit when branch condition" style="filled" fillcolor=gray];
}
79 [label="Synthetic else branch" style="filled" fillcolor=gray];
80 [label="Enter when branch result" style="filled" fillcolor=gray];
80 [label="Synthetic else branch" style="filled" fillcolor=gray];
81 [label="Enter when branch result" style="filled" fillcolor=gray];
subgraph cluster_23 {
color=blue
81 [label="Enter block" style="filled" fillcolor=gray];
82 [label="Jump: break@@@[R|<local>/<iterator>|.R|kotlin/collections/Iterator.hasNext|()] " style="filled" fillcolor=gray];
83 [label="Stub" style="filled" fillcolor=gray];
84 [label="Exit block" style="filled" fillcolor=gray];
82 [label="Enter block" style="filled" fillcolor=gray];
83 [label="Jump: break@@@[R|<local>/<iterator>|.R|kotlin/collections/Iterator.hasNext|()] " style="filled" fillcolor=gray];
84 [label="Stub" style="filled" fillcolor=gray];
85 [label="Exit block" style="filled" fillcolor=gray];
}
85 [label="Exit when branch result" style="filled" fillcolor=gray];
86 [label="Exit when" style="filled" fillcolor=gray];
86 [label="Exit when branch result" style="filled" fillcolor=gray];
87 [label="Exit when" style="filled" fillcolor=gray];
}
87 [label="Exit block" style="filled" fillcolor=gray];
88 [label="Exit block" style="filled" fillcolor=gray];
}
88 [label="Exit loop block" style="filled" fillcolor=gray];
89 [label="Exit loop block" style="filled" fillcolor=gray];
}
89 [label="Exit whileloop"];
90 [label="Exit whileloop"];
}
90 [label="Exit block"];
91 [label="Exit block"];
}
91 [label="Access variable R|<local>/s|"];
92 [label="Enter safe call"];
93 [label="Postponed enter to lambda"];
92 [label="Access variable R|<local>/s|"];
93 [label="Enter safe call"];
94 [label="Postponed enter to lambda"];
subgraph cluster_24 {
color=blue
100 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
101 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
subgraph cluster_25 {
color=blue
101 [label="Enter block"];
102 [label="Access variable R|<local>/it|"];
103 [label="Access variable R|/A.a|"];
104 [label="Exit block"];
102 [label="Enter block"];
103 [label="Access variable R|<local>/it|"];
104 [label="Access variable R|/A.a|"];
105 [label="Exit block"];
}
105 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
106 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
}
94 [label="Call arguments union" style="filled" fillcolor=yellow];
95 [label="Postponed exit from lambda"];
96 [label="Function call: $subj$.R|kotlin/let|<R|A|, R|kotlin/Int|>(...)"];
97 [label="Exit safe call"];
98 [label="Exit block"];
95 [label="Call arguments union" style="filled" fillcolor=yellow];
96 [label="Postponed exit from lambda"];
97 [label="Function call: $subj$.R|kotlin/let|<R|A|, R|kotlin/Int|>(...)"];
98 [label="Exit safe call"];
99 [label="Exit block"];
}
99 [label="Exit function test_0" style="filled" fillcolor=red];
100 [label="Exit function test_0" style="filled" fillcolor=red];
}
51 -> {52};
52 -> {53};
53 -> {54};
54 -> {55};
@@ -261,53 +262,54 @@ digraph smartcastToNothing_kt {
60 -> {61};
61 -> {62};
62 -> {63};
63 -> {89 64};
64 -> {65};
63 -> {64};
64 -> {90 65};
65 -> {66};
66 -> {67};
67 -> {99} [label=onUncaughtException];
67 -> {68} [style=dotted];
67 -> {68};
68 -> {100} [label=onUncaughtException];
68 -> {69} [style=dotted];
69 -> {70} [style=dotted];
70 -> {71} [style=dotted];
70 -> {99} [style=dotted] [label=onUncaughtException];
71 -> {72} [style=dotted];
71 -> {100} [style=dotted] [label=onUncaughtException];
72 -> {73} [style=dotted];
73 -> {74} [style=dotted];
74 -> {75} [style=dotted];
75 -> {76} [style=dotted];
75 -> {99} [style=dotted] [label=onUncaughtException];
76 -> {77} [style=dotted];
76 -> {100} [style=dotted] [label=onUncaughtException];
77 -> {78} [style=dotted];
78 -> {80 79} [style=dotted];
79 -> {86} [style=dotted];
80 -> {81} [style=dotted];
78 -> {79} [style=dotted];
79 -> {81 80} [style=dotted];
80 -> {87} [style=dotted];
81 -> {82} [style=dotted];
82 -> {89 83} [style=dotted];
83 -> {84} [style=dotted];
82 -> {83} [style=dotted];
83 -> {90 84} [style=dotted];
84 -> {85} [style=dotted];
85 -> {86} [style=dotted];
86 -> {87} [style=dotted];
87 -> {88} [style=dotted];
88 -> {60} [color=green style=dotted];
89 -> {90};
88 -> {89} [style=dotted];
89 -> {61} [color=green style=dotted];
90 -> {91};
91 -> {92 97};
92 -> {93};
93 -> {100};
93 -> {95} [color=red];
93 -> {100} [style=dashed];
91 -> {92};
92 -> {93 98};
93 -> {94};
94 -> {101};
94 -> {96} [color=red];
95 -> {96} [color=green];
96 -> {97};
94 -> {101} [style=dashed];
95 -> {97} [color=red];
96 -> {97} [color=green];
97 -> {98};
98 -> {99};
100 -> {101};
99 -> {100};
101 -> {102};
102 -> {103};
103 -> {104};
104 -> {105};
105 -> {94} [color=red];
105 -> {95} [color=green];
105 -> {106};
106 -> {95} [color=red];
106 -> {96} [color=green];
}
@@ -7,7 +7,7 @@ import java.nio.file.Files
fun detectDirsWithTestsMapFileOnly(file: File): List<String> {
Files.walk(file.toPath()).filter(Files::isRegularFile)
}
<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
interface A
fun foo(x: A, vararg strings: String) {}
@@ -3,7 +3,7 @@ fun interface MySam {
}
class A {
fun bar(x: String): Int {}
fun bar(x: String): Int {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
}
fun foo(x: MySam) {}
@@ -1,5 +1,5 @@
class A {
fun bar(x: String): Int {}
fun bar(x: String): Int {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
}
fun foo(x: (A, String) -> Int) {}
@@ -1,5 +1,5 @@
class A {
fun bar(x: String): Int {}
fun bar(x: String): Int {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
}
fun foo(x: (String) -> Int) {}
@@ -1,6 +1,6 @@
fun foo(x: (String) -> Int) {}
fun bar(x: String): Int {}
fun bar(x: String): Int {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
fun main() {
foo(::bar)
@@ -27,223 +27,225 @@ digraph delegateWithAnonymousObject_kt {
6 [label="Enter block"];
7 [label="Const: Null(null)"];
8 [label="Check not null: Null(null)!!"];
9 [label="Jump: ^delegate Null(null)!!"];
10 [label="Stub" style="filled" fillcolor=gray];
11 [label="Exit block" style="filled" fillcolor=gray];
9 [label="Stub" style="filled" fillcolor=gray];
10 [label="Jump: ^delegate Null(null)!!" style="filled" fillcolor=gray];
11 [label="Stub" style="filled" fillcolor=gray];
12 [label="Exit block" style="filled" fillcolor=gray];
}
12 [label="Exit function delegate" style="filled" fillcolor=red];
13 [label="Exit function delegate" style="filled" fillcolor=red];
}
5 -> {6};
6 -> {7};
7 -> {8};
8 -> {9};
9 -> {12};
8 -> {13} [label=onUncaughtException];
8 -> {9} [style=dotted];
9 -> {10} [style=dotted];
10 -> {11} [style=dotted];
10 -> {13 11} [style=dotted];
11 -> {12} [style=dotted];
12 -> {13} [style=dotted];
subgraph cluster_4 {
color=red
13 [label="Enter function <init>" style="filled" fillcolor=red];
14 [label="Delegated constructor call: super<R|DelegateProvider<IssueListView>|>()"];
15 [label="Exit function <init>" style="filled" fillcolor=red];
14 [label="Enter function <init>" style="filled" fillcolor=red];
15 [label="Delegated constructor call: super<R|DelegateProvider<IssueListView>|>()"];
16 [label="Exit function <init>" style="filled" fillcolor=red];
}
13 -> {14};
14 -> {15};
15 -> {16};
subgraph cluster_5 {
color=red
16 [label="Enter function updateFrom" style="filled" fillcolor=red];
17 [label="Enter function updateFrom" style="filled" fillcolor=red];
subgraph cluster_6 {
color=blue
17 [label="Enter block"];
18 [label="Exit block"];
18 [label="Enter block"];
19 [label="Exit block"];
}
19 [label="Exit function updateFrom" style="filled" fillcolor=red];
20 [label="Exit function updateFrom" style="filled" fillcolor=red];
}
16 -> {17};
17 -> {18};
18 -> {19};
19 -> {20};
subgraph cluster_7 {
color=red
20 [label="Enter class IssueListView" style="filled" fillcolor=red];
21 [label="Exit class IssueListView" style="filled" fillcolor=red];
21 [label="Enter class IssueListView" style="filled" fillcolor=red];
22 [label="Exit class IssueListView" style="filled" fillcolor=red];
}
20 -> {21} [color=green];
21 -> {22} [color=green];
subgraph cluster_8 {
color=red
22 [label="Enter function <init>" style="filled" fillcolor=red];
23 [label="Delegated constructor call: super<R|DelegateProvider<IssuesListUserProfile>|>()"];
24 [label="Exit function <init>" style="filled" fillcolor=red];
23 [label="Enter function <init>" style="filled" fillcolor=red];
24 [label="Delegated constructor call: super<R|DelegateProvider<IssuesListUserProfile>|>()"];
25 [label="Exit function <init>" style="filled" fillcolor=red];
}
22 -> {23};
23 -> {24};
24 -> {25};
subgraph cluster_9 {
color=red
33 [label="Enter function <init>" style="filled" fillcolor=red];
34 [label="Delegated constructor call: super<R|kotlin/Any|>()"];
35 [label="Exit function <init>" style="filled" fillcolor=red];
34 [label="Enter function <init>" style="filled" fillcolor=red];
35 [label="Delegated constructor call: super<R|kotlin/Any|>()"];
36 [label="Exit function <init>" style="filled" fillcolor=red];
}
33 -> {34};
34 -> {35};
35 -> {36};
subgraph cluster_10 {
color=red
36 [label="Enter function getValue" style="filled" fillcolor=red];
37 [label="Enter function getValue" style="filled" fillcolor=red];
subgraph cluster_11 {
color=blue
37 [label="Enter block"];
38 [label="Function call: R|/IssueListView.IssueListView|()"];
39 [label="Jump: ^getValue R|/IssueListView.IssueListView|()"];
40 [label="Stub" style="filled" fillcolor=gray];
41 [label="Exit block" style="filled" fillcolor=gray];
38 [label="Enter block"];
39 [label="Function call: R|/IssueListView.IssueListView|()"];
40 [label="Jump: ^getValue R|/IssueListView.IssueListView|()"];
41 [label="Stub" style="filled" fillcolor=gray];
42 [label="Exit block" style="filled" fillcolor=gray];
}
42 [label="Exit function getValue" style="filled" fillcolor=red];
43 [label="Exit function getValue" style="filled" fillcolor=red];
}
36 -> {37};
37 -> {38};
38 -> {39};
39 -> {42};
39 -> {40} [style=dotted];
39 -> {40};
40 -> {43};
40 -> {41} [style=dotted];
41 -> {42} [style=dotted];
42 -> {43} [style=dotted];
subgraph cluster_12 {
color=red
43 [label="Enter function setValue" style="filled" fillcolor=red];
44 [label="Enter function setValue" style="filled" fillcolor=red];
subgraph cluster_13 {
color=blue
44 [label="Enter block"];
45 [label="Function call: R|/IssueListView.IssueListView|()"];
46 [label="Access variable R|<local>/value|"];
47 [label="Function call: R|/IssueListView.IssueListView|().R|/IssueListView.updateFrom|(...)"];
48 [label="Jump: ^setValue R|/IssueListView.IssueListView|().R|/IssueListView.updateFrom|(R|<local>/value|)"];
49 [label="Stub" style="filled" fillcolor=gray];
50 [label="Exit block" style="filled" fillcolor=gray];
45 [label="Enter block"];
46 [label="Function call: R|/IssueListView.IssueListView|()"];
47 [label="Access variable R|<local>/value|"];
48 [label="Function call: R|/IssueListView.IssueListView|().R|/IssueListView.updateFrom|(...)"];
49 [label="Jump: ^setValue R|/IssueListView.IssueListView|().R|/IssueListView.updateFrom|(R|<local>/value|)"];
50 [label="Stub" style="filled" fillcolor=gray];
51 [label="Exit block" style="filled" fillcolor=gray];
}
51 [label="Exit function setValue" style="filled" fillcolor=red];
52 [label="Exit function setValue" style="filled" fillcolor=red];
}
43 -> {44};
44 -> {45};
45 -> {46};
46 -> {47};
47 -> {48};
48 -> {51};
48 -> {49} [style=dotted];
48 -> {49};
49 -> {52};
49 -> {50} [style=dotted];
50 -> {51} [style=dotted];
51 -> {52} [style=dotted];
subgraph cluster_14 {
color=red
52 [label="Enter function getter" style="filled" fillcolor=red];
53 [label="Enter function getter" style="filled" fillcolor=red];
subgraph cluster_15 {
color=blue
53 [label="Enter block"];
54 [label="Access variable D|/IssuesListUserProfile.issueListView|"];
55 [label="Access variable this@R|/IssuesListUserProfile|"];
56 [label="Function call: this@R|/IssuesListUserProfile|.D|/IssuesListUserProfile.issueListView|.R|SubstitutionOverride<kotlin/properties/ReadWriteProperty.getValue: R|IssueListView|>|(...)"];
57 [label="Jump: ^ this@R|/IssuesListUserProfile|.D|/IssuesListUserProfile.issueListView|.R|SubstitutionOverride<kotlin/properties/ReadWriteProperty.getValue: R|IssueListView|>|(this@R|/IssuesListUserProfile|, ::R|/IssuesListUserProfile.issueListView|)"];
58 [label="Stub" style="filled" fillcolor=gray];
59 [label="Exit block" style="filled" fillcolor=gray];
54 [label="Enter block"];
55 [label="Access variable D|/IssuesListUserProfile.issueListView|"];
56 [label="Access variable this@R|/IssuesListUserProfile|"];
57 [label="Function call: this@R|/IssuesListUserProfile|.D|/IssuesListUserProfile.issueListView|.R|SubstitutionOverride<kotlin/properties/ReadWriteProperty.getValue: R|IssueListView|>|(...)"];
58 [label="Jump: ^ this@R|/IssuesListUserProfile|.D|/IssuesListUserProfile.issueListView|.R|SubstitutionOverride<kotlin/properties/ReadWriteProperty.getValue: R|IssueListView|>|(this@R|/IssuesListUserProfile|, ::R|/IssuesListUserProfile.issueListView|)"];
59 [label="Stub" style="filled" fillcolor=gray];
60 [label="Exit block" style="filled" fillcolor=gray];
}
60 [label="Exit function getter" style="filled" fillcolor=red];
61 [label="Exit function getter" style="filled" fillcolor=red];
}
52 -> {53};
53 -> {54};
54 -> {55};
55 -> {56};
56 -> {57};
57 -> {60};
57 -> {58} [style=dotted];
57 -> {58};
58 -> {61};
58 -> {59} [style=dotted];
59 -> {60} [style=dotted];
60 -> {61} [style=dotted];
subgraph cluster_16 {
color=red
61 [label="Enter function setter" style="filled" fillcolor=red];
62 [label="Enter function setter" style="filled" fillcolor=red];
subgraph cluster_17 {
color=blue
62 [label="Enter block"];
63 [label="Access variable D|/IssuesListUserProfile.issueListView|"];
64 [label="Access variable this@R|/IssuesListUserProfile|"];
65 [label="Access variable R|<local>/issueListView|"];
66 [label="Function call: this@R|/IssuesListUserProfile|.D|/IssuesListUserProfile.issueListView|.R|SubstitutionOverride<kotlin/properties/ReadWriteProperty.setValue: R|kotlin/Unit|>|(...)"];
67 [label="Exit block"];
63 [label="Enter block"];
64 [label="Access variable D|/IssuesListUserProfile.issueListView|"];
65 [label="Access variable this@R|/IssuesListUserProfile|"];
66 [label="Access variable R|<local>/issueListView|"];
67 [label="Function call: this@R|/IssuesListUserProfile|.D|/IssuesListUserProfile.issueListView|.R|SubstitutionOverride<kotlin/properties/ReadWriteProperty.setValue: R|kotlin/Unit|>|(...)"];
68 [label="Exit block"];
}
68 [label="Exit function setter" style="filled" fillcolor=red];
69 [label="Exit function setter" style="filled" fillcolor=red];
}
61 -> {62};
62 -> {63};
63 -> {64};
64 -> {65};
65 -> {66};
66 -> {67};
67 -> {68};
68 -> {69};
subgraph cluster_18 {
color=red
69 [label="Enter property" style="filled" fillcolor=red];
70 [label="Postponed enter to lambda"];
71 [label="Postponed exit from lambda"];
72 [label="Function call: this@R|/IssuesListUserProfile|.R|/delegate|<R|IssuesListUserProfile|, R|IssuesListUserProfile|, R|IssueListView|>(...)"];
73 [label="Access variable this@R|/IssuesListUserProfile|"];
74 [label="Function call: this@R|/IssuesListUserProfile|.R|/delegate|<R|IssuesListUserProfile|, R|IssuesListUserProfile|, R|IssueListView|>(...).<Unresolved name: provideDelegate>#(...)"];
75 [label="Postponed enter to lambda"];
70 [label="Enter property" style="filled" fillcolor=red];
71 [label="Postponed enter to lambda"];
72 [label="Postponed exit from lambda"];
73 [label="Function call: this@R|/IssuesListUserProfile|.R|/delegate|<R|IssuesListUserProfile|, R|IssuesListUserProfile|, R|IssueListView|>(...)"];
74 [label="Access variable this@R|/IssuesListUserProfile|"];
75 [label="Function call: this@R|/IssuesListUserProfile|.R|/delegate|<R|IssuesListUserProfile|, R|IssuesListUserProfile|, R|IssueListView|>(...).<Unresolved name: provideDelegate>#(...)"];
76 [label="Postponed enter to lambda"];
subgraph cluster_19 {
color=blue
25 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
26 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
subgraph cluster_20 {
color=blue
26 [label="Enter block"];
27 [label="Exit anonymous object"];
28 [label="Exit anonymous object expression"];
29 [label="Exit block"];
27 [label="Enter block"];
28 [label="Exit anonymous object"];
29 [label="Exit anonymous object expression"];
30 [label="Exit block"];
}
30 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
31 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
}
subgraph cluster_21 {
color=blue
31 [label="Enter class <anonymous object>" style="filled" fillcolor=red];
32 [label="Exit class <anonymous object>" style="filled" fillcolor=red];
32 [label="Enter class <anonymous object>" style="filled" fillcolor=red];
33 [label="Exit class <anonymous object>" style="filled" fillcolor=red];
}
76 [label="Postponed exit from lambda"];
77 [label="Function call: this@R|/IssuesListUserProfile|.R|/delegate|<R|IssuesListUserProfile|, R|IssuesListUserProfile|, R|IssueListView|>(...)"];
78 [label="Exit property" style="filled" fillcolor=red];
77 [label="Postponed exit from lambda"];
78 [label="Function call: this@R|/IssuesListUserProfile|.R|/delegate|<R|IssuesListUserProfile|, R|IssuesListUserProfile|, R|IssueListView|>(...)"];
79 [label="Exit property" style="filled" fillcolor=red];
}
69 -> {70};
70 -> {71};
70 -> {} [style=dashed];
71 -> {72};
71 -> {} [style=dashed];
72 -> {73};
73 -> {74};
74 -> {75};
75 -> {76 25};
75 -> {25} [style=dashed];
76 -> {77};
75 -> {76};
76 -> {77 26};
76 -> {26} [style=dashed];
77 -> {78};
78 -> {81} [color=green];
25 -> {26};
78 -> {79};
79 -> {82} [color=green];
26 -> {27};
26 -> {33 36 43} [color=red];
27 -> {28};
27 -> {33 36 43 31} [color=green];
27 -> {33 36 43 31} [style=dashed];
27 -> {34 37 44} [color=red];
28 -> {29};
28 -> {34 37 44 32} [color=green];
28 -> {34 37 44 32} [style=dashed];
29 -> {30};
31 -> {32} [color=green];
30 -> {31};
32 -> {33} [color=green];
subgraph cluster_22 {
color=red
79 [label="Enter class IssuesListUserProfile" style="filled" fillcolor=red];
80 [label="Part of class initialization"];
81 [label="Exit class IssuesListUserProfile" style="filled" fillcolor=red];
80 [label="Enter class IssuesListUserProfile" style="filled" fillcolor=red];
81 [label="Part of class initialization"];
82 [label="Exit class IssuesListUserProfile" style="filled" fillcolor=red];
}
79 -> {80} [color=green];
80 -> {81} [style=dotted];
80 -> {69} [color=green];
80 -> {69} [style=dashed];
80 -> {81} [color=green];
81 -> {82} [style=dotted];
81 -> {70} [color=green];
81 -> {70} [style=dashed];
}
@@ -11,151 +11,153 @@ digraph plusAssignWithLambdaInRhs_kt {
1 [label="Enter block"];
2 [label="Const: Null(null)"];
3 [label="Check not null: Null(null)!!"];
4 [label="Variable declaration: lval list: R|kotlin/collections/MutableList<kotlin/Function1<kotlin/String, kotlin/String>>|"];
5 [label="Access variable R|<local>/list|"];
6 [label="Postponed enter to lambda"];
4 [label="Stub" style="filled" fillcolor=gray];
5 [label="Variable declaration: lval list: R|kotlin/collections/MutableList<kotlin/Function1<kotlin/String, kotlin/String>>|" style="filled" fillcolor=gray];
6 [label="Access variable R|<local>/list|" style="filled" fillcolor=gray];
7 [label="Postponed enter to lambda" style="filled" fillcolor=gray];
subgraph cluster_2 {
color=blue
11 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
12 [label="Enter function anonymousFunction" style="filled" fillcolor=red style="filled" fillcolor=gray];
subgraph cluster_3 {
color=blue
12 [label="Enter block"];
13 [label="Access variable R|<local>/it|"];
14 [label="Exit block"];
13 [label="Enter block" style="filled" fillcolor=gray];
14 [label="Access variable R|<local>/it|" style="filled" fillcolor=gray];
15 [label="Exit block" style="filled" fillcolor=gray];
}
15 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
16 [label="Exit function anonymousFunction" style="filled" fillcolor=red style="filled" fillcolor=gray];
}
7 [label="Postponed exit from lambda"];
8 [label="Function call: R|<local>/list|.R|kotlin/collections/plusAssign|<R|(kotlin/String) -> kotlin/String|>(...)"];
9 [label="Exit block"];
8 [label="Postponed exit from lambda" style="filled" fillcolor=gray];
9 [label="Function call: R|<local>/list|.R|kotlin/collections/plusAssign|<R|(kotlin/String) -> kotlin/String|>(...)" style="filled" fillcolor=gray];
10 [label="Exit block" style="filled" fillcolor=gray];
}
10 [label="Exit function test" style="filled" fillcolor=red];
11 [label="Exit function test" style="filled" fillcolor=red];
}
0 -> {1};
1 -> {2};
2 -> {3};
3 -> {4};
4 -> {5};
5 -> {6};
6 -> {11};
6 -> {7} [color=red];
6 -> {11} [style=dashed];
7 -> {8};
8 -> {9};
9 -> {10};
11 -> {15 12};
12 -> {13};
13 -> {14};
14 -> {15};
15 -> {7} [color=green];
15 -> {11} [color=green style=dashed];
3 -> {11} [label=onUncaughtException];
3 -> {4} [style=dotted];
4 -> {5} [style=dotted];
5 -> {6} [style=dotted];
6 -> {7} [style=dotted];
7 -> {8 12} [style=dotted];
7 -> {12} [style=dashed];
8 -> {9} [style=dotted];
9 -> {10} [style=dotted];
10 -> {11} [style=dotted];
12 -> {16 13} [style=dotted];
13 -> {14} [style=dotted];
14 -> {15} [style=dotted];
15 -> {16} [style=dotted];
16 -> {8} [style=dotted];
16 -> {12} [color=green style=dotted];
subgraph cluster_4 {
color=red
16 [label="Enter function <init>" style="filled" fillcolor=red];
17 [label="Delegated constructor call: super<R|kotlin/Any|>()"];
18 [label="Exit function <init>" style="filled" fillcolor=red];
17 [label="Enter function <init>" style="filled" fillcolor=red];
18 [label="Delegated constructor call: super<R|kotlin/Any|>()"];
19 [label="Exit function <init>" style="filled" fillcolor=red];
}
16 -> {17};
17 -> {18};
18 -> {19};
subgraph cluster_5 {
color=red
19 [label="Enter property" style="filled" fillcolor=red];
20 [label="Access variable R|<local>/executor|"];
21 [label="Exit property" style="filled" fillcolor=red];
20 [label="Enter property" style="filled" fillcolor=red];
21 [label="Access variable R|<local>/executor|"];
22 [label="Exit property" style="filled" fillcolor=red];
}
19 -> {20};
20 -> {21};
21 -> {24} [color=green];
21 -> {22};
22 -> {25} [color=green];
subgraph cluster_6 {
color=red
22 [label="Enter class A" style="filled" fillcolor=red];
23 [label="Part of class initialization"];
24 [label="Exit class A" style="filled" fillcolor=red];
23 [label="Enter class A" style="filled" fillcolor=red];
24 [label="Part of class initialization"];
25 [label="Exit class A" style="filled" fillcolor=red];
}
22 -> {23} [color=green];
23 -> {24} [style=dotted];
23 -> {19} [color=green];
23 -> {19} [style=dashed];
23 -> {24} [color=green];
24 -> {25} [style=dotted];
24 -> {20} [color=green];
24 -> {20} [style=dashed];
subgraph cluster_7 {
color=red
25 [label="Enter function postpone" style="filled" fillcolor=red];
26 [label="Enter function postpone" style="filled" fillcolor=red];
subgraph cluster_8 {
color=blue
26 [label="Enter block"];
27 [label="Function call: R|kotlin/collections/mutableListOf|<R|() -> kotlin/Unit|>()"];
28 [label="Variable declaration: lval queue: R|kotlin/collections/MutableList<kotlin/Function0<kotlin/Unit>>|"];
29 [label="Postponed enter to lambda"];
27 [label="Enter block"];
28 [label="Function call: R|kotlin/collections/mutableListOf|<R|() -> kotlin/Unit|>()"];
29 [label="Variable declaration: lval queue: R|kotlin/collections/MutableList<kotlin/Function0<kotlin/Unit>>|"];
30 [label="Postponed enter to lambda"];
subgraph cluster_9 {
color=blue
36 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
37 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
subgraph cluster_10 {
color=blue
37 [label="Enter block"];
38 [label="Access variable R|<local>/queue|"];
39 [label="Postponed enter to lambda"];
38 [label="Enter block"];
39 [label="Access variable R|<local>/queue|"];
40 [label="Postponed enter to lambda"];
subgraph cluster_11 {
color=blue
44 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
45 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
subgraph cluster_12 {
color=blue
45 [label="Enter block"];
46 [label="Function call: R|<local>/computation|.R|SubstitutionOverride<kotlin/Function0.invoke: R|T|>|()"];
47 [label="Function call: R|<local>/resolve|.R|SubstitutionOverride<kotlin/Function1.invoke: R|kotlin/Unit|>|(...)"];
48 [label="Exit block"];
46 [label="Enter block"];
47 [label="Function call: R|<local>/computation|.R|SubstitutionOverride<kotlin/Function0.invoke: R|T|>|()"];
48 [label="Function call: R|<local>/resolve|.R|SubstitutionOverride<kotlin/Function1.invoke: R|kotlin/Unit|>|(...)"];
49 [label="Exit block"];
}
49 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
50 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
}
40 [label="Postponed exit from lambda"];
41 [label="Function call: R|<local>/queue|.R|kotlin/collections/plusAssign|<R|() -> kotlin/Unit|>(...)"];
42 [label="Exit block"];
41 [label="Postponed exit from lambda"];
42 [label="Function call: R|<local>/queue|.R|kotlin/collections/plusAssign|<R|() -> kotlin/Unit|>(...)"];
43 [label="Exit block"];
}
43 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
44 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
}
30 [label="Postponed exit from lambda"];
31 [label="Function call: R|/A.A|<R|T|>(...)"];
32 [label="Jump: ^postpone R|/A.A|<R|T|>(<L> = A@fun <anonymous>(resolve: R|(T) -> kotlin/Unit|): R|kotlin/Unit| <inline=NoInline> {
31 [label="Postponed exit from lambda"];
32 [label="Function call: R|/A.A|<R|T|>(...)"];
33 [label="Jump: ^postpone R|/A.A|<R|T|>(<L> = A@fun <anonymous>(resolve: R|(T) -> kotlin/Unit|): R|kotlin/Unit| <inline=NoInline> {
R|<local>/queue|.R|kotlin/collections/plusAssign|<R|() -> kotlin/Unit|>(A@fun <anonymous>(): R|kotlin/Unit| <inline=Inline, kind=UNKNOWN> {
R|<local>/resolve|.R|SubstitutionOverride<kotlin/Function1.invoke: R|kotlin/Unit|>|(R|<local>/computation|.R|SubstitutionOverride<kotlin/Function0.invoke: R|T|>|())
}
)
}
)"];
33 [label="Stub" style="filled" fillcolor=gray];
34 [label="Exit block" style="filled" fillcolor=gray];
34 [label="Stub" style="filled" fillcolor=gray];
35 [label="Exit block" style="filled" fillcolor=gray];
}
35 [label="Exit function postpone" style="filled" fillcolor=red];
36 [label="Exit function postpone" style="filled" fillcolor=red];
}
25 -> {26};
26 -> {27};
27 -> {28};
28 -> {29};
29 -> {30 36};
29 -> {36} [style=dashed];
30 -> {31};
29 -> {30};
30 -> {31 37};
30 -> {37} [style=dashed];
31 -> {32};
32 -> {35};
32 -> {33} [style=dotted];
32 -> {33};
33 -> {36};
33 -> {34} [style=dotted];
34 -> {35} [style=dotted];
36 -> {37};
35 -> {36} [style=dotted];
37 -> {38};
38 -> {39};
39 -> {44};
39 -> {40} [color=red];
39 -> {44} [style=dashed];
40 -> {41};
39 -> {40};
40 -> {45};
40 -> {41} [color=red];
40 -> {45} [style=dashed];
41 -> {42};
42 -> {43};
44 -> {49 45};
45 -> {46};
43 -> {44};
45 -> {50 46};
46 -> {47};
47 -> {48};
48 -> {49};
49 -> {40} [color=green];
49 -> {44} [color=green style=dashed];
49 -> {50};
50 -> {41} [color=green];
50 -> {45} [color=green style=dashed];
}
@@ -1036,6 +1036,7 @@ object DIAGNOSTICS_LIST : DiagnosticList("FirErrors") {
val RETURNS by object : DiagnosticGroup("Returns") {
val RETURN_NOT_ALLOWED by error<KtReturnExpression>(PositioningStrategy.RETURN_WITH_LABEL)
val RETURN_IN_FUNCTION_WITH_EXPRESSION_BODY by error<KtReturnExpression>(PositioningStrategy.RETURN_WITH_LABEL)
val NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY by error<KtDeclarationWithBody>(PositioningStrategy.DECLARATION_WITH_BODY)
}
val INLINE by object : DiagnosticGroup("Inline") {
@@ -76,6 +76,7 @@ enum class PositioningStrategy(private val strategy: String? = null) {
IMPORT_LAST_NAME,
DATA_MODIFIER,
SPREAD_OPERATOR,
DECLARATION_WITH_BODY,
;
@@ -41,6 +41,7 @@ import org.jetbrains.kotlin.psi.KtCallExpression
import org.jetbrains.kotlin.psi.KtClass
import org.jetbrains.kotlin.psi.KtClassOrObject
import org.jetbrains.kotlin.psi.KtDeclaration
import org.jetbrains.kotlin.psi.KtDeclarationWithBody
import org.jetbrains.kotlin.psi.KtDestructuringDeclaration
import org.jetbrains.kotlin.psi.KtElement
import org.jetbrains.kotlin.psi.KtExpression
@@ -546,6 +547,7 @@ object FirErrors {
// Returns
val RETURN_NOT_ALLOWED by error0<KtReturnExpression>(SourceElementPositioningStrategies.RETURN_WITH_LABEL)
val RETURN_IN_FUNCTION_WITH_EXPRESSION_BODY by error0<KtReturnExpression>(SourceElementPositioningStrategies.RETURN_WITH_LABEL)
val NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY by error0<KtDeclarationWithBody>(SourceElementPositioningStrategies.DECLARATION_WITH_BODY)
// Inline
val USAGE_IS_NOT_INLINABLE by error1<KtElement, FirBasedSymbol<*>>(SourceElementPositioningStrategies.REFERENCE_BY_QUALIFIED)
@@ -36,7 +36,8 @@ object CommonDeclarationCheckers : DeclarationCheckers() {
get() = setOf(
FirContractChecker,
FirFunctionParameterChecker,
FirInlineDeclarationChecker
FirInlineDeclarationChecker,
FirFunctionReturnChecker,
)
override val simpleFunctionCheckers: Set<FirSimpleFunctionChecker>
@@ -0,0 +1,41 @@
/*
* Copyright 2010-2021 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.analysis.checkers.declaration
import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext
import org.jetbrains.kotlin.fir.analysis.diagnostics.DiagnosticReporter
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors
import org.jetbrains.kotlin.fir.analysis.diagnostics.reportOn
import org.jetbrains.kotlin.fir.declarations.*
import org.jetbrains.kotlin.fir.declarations.utils.hasBody
import org.jetbrains.kotlin.fir.resolve.dfa.cfg.BlockExitNode
import org.jetbrains.kotlin.fir.resolve.dfa.controlFlowGraph
import org.jetbrains.kotlin.fir.types.isNothing
import org.jetbrains.kotlin.fir.types.isUnit
object FirFunctionReturnChecker : FirFunctionChecker() {
override fun check(declaration: FirFunction, context: CheckerContext, reporter: DiagnosticReporter) {
checkHasReturnIfBlock(declaration, reporter, context)
}
private fun checkHasReturnIfBlock(
declaration: FirFunction,
reporter: DiagnosticReporter,
context: CheckerContext
) {
if (declaration is FirPropertyAccessor && declaration.isSetter) return
if (declaration is FirConstructor) return
if (declaration is FirAnonymousFunction && declaration.isLambda) return
if (declaration.returnTypeRef.isUnit || declaration.returnTypeRef.isNothing) return
val graph = declaration.controlFlowGraphReference?.controlFlowGraph ?: return
val blockExitNode = graph.exitNode.previousNodes.lastOrNull { it is BlockExitNode } ?: return
if (!blockExitNode.isDead) {
reporter.reportOn(declaration.source, FirErrors.NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY, context)
}
}
}
@@ -56,6 +56,7 @@ object FirPropertyAccessorsTypesChecker : FirPropertyChecker() {
reporter.reportOn(getterReturnTypeSource, FirErrors.WRONG_GETTER_RETURN_TYPE, propertyType, getterReturnType, context)
}
}
// FirFunctionReturnChecker.checkHasReturnIfBlock(getter, reporter, context)
}
}
@@ -247,6 +247,7 @@ import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.NOT_NULL_ASSERTIO
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.NO_COMPANION_OBJECT
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.NO_ELSE_IN_WHEN
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.NO_GET_METHOD
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.NO_SET_METHOD
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.NO_THIS
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.NO_VALUE_FOR_PARAMETER
@@ -814,6 +815,8 @@ class FirDefaultErrorMessages {
map.put(TYPE_PARAMETER_OF_PROPERTY_NOT_USED_IN_RECEIVER, "Type parameter of a property must be used in its receiver type")
map.put(NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY, "A 'return' expression required in a function with a block body ('{...}')")
map.put(RETURN_TYPE_MISMATCH, "Return type mismatch: expected {0}, actual {1}", RENDER_TYPE, RENDER_TYPE, NOT_RENDERED)
map.put(CYCLIC_GENERIC_UPPER_BOUND, "Type parameter has cyclic upper bounds")
@@ -793,6 +793,29 @@ object LightTreePositioningStrategies {
return super.mark(node, startOffset, startOffset + 1, tree)
}
}
val DECLARATION_WITH_BODY: LightTreePositioningStrategy = object : LightTreePositioningStrategy() {
override fun mark(
node: LighterASTNode,
startOffset: Int,
endOffset: Int,
tree: FlyweightCapableTreeStructure<LighterASTNode>
): List<TextRange> {
val blockNode =
if (node.tokenType != KtNodeTypes.BLOCK) tree.findChildByType(node, KtNodeTypes.BLOCK)
else node
val bracket = tree.findLastChildByType(blockNode ?: node, KtTokens.RBRACE)
return when {
bracket != null -> markElement(bracket, startOffset, endOffset, tree, node)
blockNode != null -> markElement(blockNode, startOffset, endOffset, tree, node).map(::lastSymbol)
else -> super.mark(node, startOffset, endOffset, tree)
}
}
//body of block node is in the separate tree, so here is hack - mark last symbol of block
private fun lastSymbol(range: TextRange): TextRange =
if (range.isEmpty) range else TextRange.create(range.endOffset - 1, range.endOffset)
}
}
fun FirSourceElement.hasValOrVar(): Boolean =
@@ -267,4 +267,9 @@ object SourceElementPositioningStrategies {
LightTreePositioningStrategies.SPREAD_OPERATOR,
PositioningStrategies.SPREAD_OPERATOR
)
val DECLARATION_WITH_BODY = SourceElementPositioningStrategy(
LightTreePositioningStrategies.DECLARATION_WITH_BODY,
PositioningStrategies.DECLARATION_WITH_BODY
)
}
@@ -135,7 +135,8 @@ class ControlFlowGraphBuilder {
fun CFGNode<*>.extractArgument(): FirElement? = when (this) {
is FunctionEnterNode, is TryMainBlockEnterNode, is FinallyBlockExitNode, is CatchClauseEnterNode -> null
is StubNode, is BlockExitNode -> firstPreviousNode.extractArgument()
is BlockExitNode -> if (function.isLambda || isDead) firstPreviousNode.extractArgument() else null
is StubNode -> firstPreviousNode.extractArgument()
else -> fir.extractArgument()
}
@@ -562,10 +562,16 @@ class FirCallCompletionResultsWriterTransformer(
}
val initialType = anonymousFunction.returnTypeRef.coneTypeSafe<ConeKotlinType>()
val finalType =
val finalType = if (anonymousFunction.isLambda) {
expectedType?.returnType(session) as? ConeClassLikeType
?: (data as? ExpectedArgumentType.ArgumentsMap)?.lambdasReturnTypes?.get(anonymousFunction)
?: initialType?.let(finalSubstitutor::substituteOrSelf)
} else {
initialType?.let(finalSubstitutor::substituteOrSelf)
?: expectedType?.returnType(session) as? ConeClassLikeType
?: (data as? ExpectedArgumentType.ArgumentsMap)?.lambdasReturnTypes?.get(anonymousFunction)
}
if (finalType != null) {
val resultType = anonymousFunction.returnTypeRef.withReplacedConeType(finalType)
@@ -31,12 +31,12 @@ fun unitShort() : Unit = Unit
fun unitShortConv() : Unit = <!RETURN_TYPE_MISMATCH!>1<!>
fun unitShortNull() : Unit = <!NULL_FOR_NONNULL_TYPE!>null<!>
fun intEmpty() : Int {}
fun intEmpty() : Int {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
fun intShortInfer() = 1
fun intShort() : Int = 1
//fun intBlockInfer() {1}
fun intBlock() : Int {return 1}
fun intBlock1() : Int {1}
fun intBlock1() : Int {1<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
fun intString(): Int = <!RETURN_TYPE_MISMATCH!>"s"<!>
fun intFunctionLiteral(): Int = <!RETURN_TYPE_MISMATCH!>{ 10 }<!>
@@ -48,7 +48,7 @@ fun blockReturnValueTypeMismatchUnit() : Int {return <!RETURN_TYPE_MISMATCH!>Uni
fun blockAndAndMismatch() : Int {
true && false
}
<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
fun blockAndAndMismatch1() : Int {
return <!RETURN_TYPE_MISMATCH!>true && false<!>
}
@@ -58,7 +58,7 @@ fun blockAndAndMismatch2() : Int {
fun blockAndAndMismatch3() : Int {
true || false
}
<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
fun blockAndAndMismatch4() : Int {
return <!RETURN_TYPE_MISMATCH!>true || false<!>
}
@@ -93,7 +93,7 @@ fun blockReturnValueTypeMatch7() : Int {
if (1 > 2)
1.0
else 2.0
}
<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
fun blockReturnValueTypeMatch8() : Int {
if (1 > 2)
1.0
@@ -103,7 +103,7 @@ fun blockReturnValueTypeMatch8() : Int {
fun blockReturnValueTypeMatch9() : Int {
if (1 > 2)
1.0
}
<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
fun blockReturnValueTypeMatch10() : Int {
return <!INVALID_IF_AS_EXPRESSION!>if<!> (1 > 2)
1
@@ -111,7 +111,7 @@ fun blockReturnValueTypeMatch10() : Int {
fun blockReturnValueTypeMatch11() : Int {
if (1 > 2)
else 1.0
}
<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
fun blockReturnValueTypeMatch12() : Int {
if (1 > 2)
return 1
@@ -119,10 +119,10 @@ fun blockReturnValueTypeMatch12() : Int {
}
fun blockNoReturnIfValDeclaration(): Int {
val x = 1
}
<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
fun blockNoReturnIfEmptyIf(): Int {
if (1 < 2) {} else {}
}
<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
fun blockNoReturnIfUnitInOneBranch(): Int {
if (1 < 2) {
return 1
@@ -132,7 +132,7 @@ fun blockNoReturnIfUnitInOneBranch(): Int {
return 2
}
}
}
<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
fun nonBlockReturnIfEmptyIf(): Int = <!RETURN_TYPE_MISMATCH!>if (1 < 2) {} else {}<!>
fun nonBlockNoReturnIfUnitInOneBranch(): Int = <!RETURN_TYPE_MISMATCH!>if (1 < 2) {} else 2<!>
+48 -48
View File
@@ -98,33 +98,33 @@ interface Example3 {
operator fun Example.plus(o: Any): Example {}
operator fun Example.div(o: Example): Example {}
operator fun Example.plus(o: Example, s: String = ""): Example {}
operator fun Example.minus(vararg o: Example): Example {}
operator fun Example.plus(): Example {}
operator fun Example.minus(): Example {}
operator fun Example.plus(o: Any): Example {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
operator fun Example.div(o: Example): Example {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
operator fun Example.plus(o: Example, s: String = ""): Example {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
operator fun Example.minus(vararg o: Example): Example {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
operator fun Example.plus(): Example {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
operator fun Example.minus(): Example {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
operator fun Example.unaryPlus(): Example {}
operator fun Example.unaryMinus(): Example {}
operator fun Example.unaryPlus(): Example {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
operator fun Example.unaryMinus(): Example {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
operator fun Example.unaryPlus(s: String = ""): Example {}
operator fun Example.unaryPlus(s: String = ""): Example {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
operator fun Example.unaryMinus(o: Example) {}
operator fun Example.inc(): Example {}
operator fun Example.dec(): Example? {}
operator fun Example.inc(): Example {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
operator fun Example.dec(): Example? {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
operator fun Example.plusAssign(n: Int) {}
operator fun Example.minusAssign(n: Int): String {}
operator fun Example.minusAssign(n: Int): String {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
operator fun Example.divAssign(n: Int, a: String = "") {}
operator fun Example.modAssign(vararg n: Int) {}
operator fun Example.compareTo(other: Example): Int {}
operator fun Example.compareTo(other: Example): Int {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
operator fun Example.equals(a: String): Boolean {}
operator fun Example.equals(a: String): Boolean {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
operator fun Example.contains(n: Int): Boolean {}
operator fun Example.contains(n: Int, s: String = ""): Boolean {}
operator fun Example.contains(n: Int): Boolean {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
operator fun Example.contains(n: Int, s: String = ""): Boolean {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
operator fun Example.invoke() {}
@@ -140,18 +140,18 @@ operator fun Example.rangeTo(o: Int) {}
operator fun Example.rangeTo(o: Int, o2: Int) {}
operator fun Example.rangeTo(vararg o: String) {}
operator fun Example.component1(): Int {}
operator fun Example.component1(n: Int): Int {}
operator fun Example.componentN(): Int {}
operator fun Example.component1(): Int {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
operator fun Example.component1(n: Int): Int {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
operator fun Example.componentN(): Int {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
operator fun Example.iterator(): String {}
operator fun Example.iterator(n: Int): String {}
operator fun Example.iterator(): String {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
operator fun Example.iterator(n: Int): String {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
operator fun Example.next(): String {}
operator fun Example.next(n: Int): String {}
operator fun Example.next(): String {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
operator fun Example.next(n: Int): String {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
operator fun Example.hasNext(): Boolean {}
operator fun Example.hasNext(n: Int): String {}
operator fun Example.hasNext(): Boolean {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
operator fun Example.hasNext(n: Int): String {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
infix fun Example.i1(n: Int) {}
<!INAPPLICABLE_INFIX_MODIFIER!>infix fun Example.i1(n: Int, n2: Int) {}<!>
@@ -161,31 +161,31 @@ infix fun Example.i1(vararg n: Int) {}
operator fun plus(o: String): Example {}
operator fun div(o: Example): Example {}
operator fun plus(o: Example, s: String = ""): Example {}
operator fun minus(vararg o: Example): Example {}
operator fun plus(o: String): Example {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
operator fun div(o: Example): Example {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
operator fun plus(o: Example, s: String = ""): Example {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
operator fun minus(vararg o: Example): Example {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
operator fun unaryPlus(): Example {}
operator fun unaryMinus(): Example {}
operator fun unaryPlus(): Example {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
operator fun unaryMinus(): Example {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
operator fun unaryPlus(s: String = ""): Example {}
operator fun unaryPlus(s: String = ""): Example {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
operator fun unaryMinus(o: Example) {}
operator fun inc(): Example {}
operator fun dec(): Example? {}
operator fun inc(): Example {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
operator fun dec(): Example? {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
operator fun plusAssign(n: Int) {}
operator fun minusAssign(n: Int): String {}
operator fun minusAssign(n: Int): String {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
operator fun divAssign(n: Int, a: String = "") {}
operator fun modAssign(vararg n: Int) {}
operator fun compareTo(other: Example): Int {}
operator fun compareTo(other: Example): Int {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
operator fun equals(a: String): Boolean {}
operator fun equals(a: String): Boolean {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
operator fun contains(n: Int): Boolean {}
operator fun contains(n: Int, s: String = ""): Boolean {}
operator fun contains(n: Int): Boolean {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
operator fun contains(n: Int, s: String = ""): Boolean {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
operator fun invoke() {}
@@ -201,18 +201,18 @@ operator fun rangeTo(o: Int) {}
operator fun rangeTo(o: Int, o2: Int) {}
operator fun rangeTo(vararg o: String) {}
operator fun component1(): Int {}
operator fun component1(n: Int): Int {}
operator fun componentN(): Int {}
operator fun component1(): Int {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
operator fun component1(n: Int): Int {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
operator fun componentN(): Int {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
operator fun iterator(): String {}
operator fun iterator(n: Int): String {}
operator fun iterator(): String {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
operator fun iterator(n: Int): String {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
operator fun next(): String {}
operator fun next(n: Int): String {}
operator fun next(): String {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
operator fun next(n: Int): String {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
operator fun hasNext(): Boolean {}
operator fun hasNext(n: Int): String {}
operator fun hasNext(): Boolean {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
operator fun hasNext(n: Int): String {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
<!INAPPLICABLE_INFIX_MODIFIER!>infix fun i1(n: Int) {}<!>
<!INAPPLICABLE_INFIX_MODIFIER!>infix fun i1(n: Int, n2: Int) {}<!>
@@ -1,18 +0,0 @@
class C<T>() {
fun foo() : T {}
}
fun foo(c: C<Int>) {}
fun <T> bar() : C<T> {}
fun main() {
val a : C<Int> = C();
val x : C<in String> = C()
val y : C<out String> = C()
val z : C<*> = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>C<!>()
val ba : C<Int> = bar();
val bx : C<in String> = bar()
val by : C<out String> = bar()
val bz : C<*> = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>bar<!>()
}
+1
View File
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
class C<T>() {
fun foo() : T {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
}
@@ -1,13 +0,0 @@
interface X {
fun f(): Boolean
}
val m = object : X {
override fun f(): Boolean {
}
fun foo() {
fun local(): Int {
}
}
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
interface X {
fun f(): Boolean
}
@@ -1,17 +0,0 @@
package f
//KT-3444 Front-end doesn't check if local function or function of anonymous class returns value
fun box(): Int {
fun local(): Int {
}
return local()
}
fun main() {
box()
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
package f
@@ -7,10 +7,10 @@ class A {}
package test.p; class C {fun f() {}}
// FILE: c.kt
package test.p; open class G<T> {open fun f(): T {} fun a() {}}
package test.p; open class G<T> {open fun f(): T {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!> fun a() {}}
// FILE: d.kt
package test.p; class G2<E> : <!SUPERTYPE_NOT_INITIALIZED!>G<E><!> { fun g() : E {} override fun f() : E {}}
package test.p; class G2<E> : <!SUPERTYPE_NOT_INITIALIZED!>G<E><!> { fun g() : E {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!> override fun f() : E {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>}
// FILE: e.kt
package test.p; fun foo() {}
@@ -3,4 +3,4 @@ fun illegalWhenBlock(a: Any): Int {
is Int -> return a
is String -> return a.length
}
}
<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
@@ -1,13 +0,0 @@
fun box() {
fun local():Int {
}
}
interface X {
fun f(): Boolean
}
val m = object : X {
override fun f(): Boolean {
}
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
fun box() {
fun local():Int {
<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
@@ -10,19 +10,19 @@ val closure = {
}
fun h(): Int { // error: should be NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY
}
<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
}
class A {
init {
fun foo(): Int {
}
<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
val closure = {
val x = ""
fun local(): Int {
}
<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
}
val y = ""
@@ -7,7 +7,7 @@ fun f() {
fun loc1(): Int {
val x1_ = "" // ok: unused
}
<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
}
fun f() {
@@ -15,12 +15,12 @@ fun f() {
fun loc2(): Int {
val x2_ = "" // error: should be UNUSED_VARIABLE
}
<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
}
val v: String
get() {
val x3 = "" // ok: unused
}
<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
}
}
@@ -9,7 +9,7 @@ fun foo() : Int {
<!ELSE_MISPLACED_IN_WHEN!>else<!> -> { z = -1000 }
return z -> 34
}
}
<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
//test unreachable code
fun fff(): Int {
@@ -18,13 +18,13 @@ fun main() {
val a6: () -> Int = (fun() = 1)
val a7: () -> Int = (fun(): String = "1") as () -> Int
val a8: () -> Int = <!INITIALIZER_TYPE_MISMATCH!>fun(): String = "1"<!>
val a9: () -> () -> () -> Int = fun(): () -> () -> String = fun(): () -> String = fun(): String = "1"
val a9: () -> () -> () -> Int = <!INITIALIZER_TYPE_MISMATCH!>fun(): () -> () -> String = fun(): () -> String = fun(): String = "1"<!>
foo(<!ARGUMENT_TYPE_MISMATCH!>fun(): String = "1"<!>)
foo(((<!ARGUMENT_TYPE_MISMATCH!>fun(): String = "1"<!>)))
val a10: Int.(String) -> Int = fun (x: String) = 10
val a11: () -> () -> () -> Int = fun() = fun() = fun(): String = "1"
val a11: () -> () -> () -> Int = <!INITIALIZER_TYPE_MISMATCH!>fun() = fun() = fun(): String = "1"<!>
val a12: Int = <!INITIALIZER_TYPE_MISMATCH!>fun(): String = "1"<!>
val a13: Int = <!INITIALIZER_TYPE_MISMATCH!>fun() = fun(): String = "1"<!>
@@ -34,7 +34,7 @@ fun main() {
val a17: () -> Unit = fun() {}
val a18: () -> Int = <!INITIALIZER_TYPE_MISMATCH!>fun() {}<!>
val a19: () -> () -> Int = fun() = fun() {}
val a19: () -> () -> Int = <!INITIALIZER_TYPE_MISMATCH!>fun() = fun() {}<!>
val a20: () -> () -> () -> Unit = fun() = fun() = {}
val a21: () -> () -> () -> Int = fun() = fun() = {}
}
@@ -33,4 +33,4 @@ fun <T: Foo<<!UNRESOLVED_REFERENCE!>String.Bar<!>>> x() {}
fun Foo<String>.Bar.ext() {}
fun ex1(a: Foo<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!><String><!>.Bar<String>): Foo<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!><String><!>.Bar<String> {
}
<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
@@ -21,4 +21,4 @@ fun bar(i: Int, a: <!UNRESOLVED_REFERENCE!>U<!>) {
}
//from standard library
public inline fun <T> comparator(fn: (T,T) -> Int): Comparator<T> {}
public inline fun <T> comparator(fn: (T,T) -> Int): Comparator<T> {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
@@ -3,7 +3,7 @@ package d
interface A<T>
fun <T> infer(a: A<T>) : T {}
fun <T> infer(a: A<T>) : T {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
fun test(nothing: Nothing?) {
val i = infer(<!ARGUMENT_TYPE_MISMATCH!>nothing<!>)
@@ -12,4 +12,4 @@ fun test(nothing: Nothing?) {
fun sum(a : IntArray) : Int {
for (n
<!SYNTAX!>return<!><!SYNTAX!><!> "?"
}
<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
@@ -1,3 +1,5 @@
// COMPARE_WITH_LIGHT_TREE
package sum
import java.util.*
@@ -6,7 +8,7 @@ fun sum(a : IntArray) : Int {
<!UNRESOLVED_REFERENCE!>res<!> = 0
for (e in a)
<!UNRESOLVED_REFERENCE, VARIABLE_EXPECTED!>res<!> +=<!SYNTAX!><!>
}
<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY{LT}!>}<!>
fun main() {
test(0)
test(1, 1)
@@ -27,4 +29,4 @@ fun <T: Any> assertEquals(actual : T?, expected : T?, message : Any? = null) {
else
throw AssertionError(message)
}
}
}
@@ -1,3 +1,5 @@
// COMPARE_WITH_LIGHT_TREE
package sum
import java.util.*
@@ -268,7 +268,7 @@ class Main<L>(x: L?, y: L) {
}
fun <T : Comparable<T>> nullsLast() = null as Foo<T?>
fun <K> take(x: Foo<K>, comparator: Foo<K>): Foo<K> {}
fun <K> take(x: Foo<K>, comparator: Foo<K>): Foo<K> {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
fun <L> test() {
take(null as Foo<String?>, nullsLast())
}
@@ -1,14 +0,0 @@
package b
//+JDK
import java.util.*
import java.util.Collections.*
fun foo(list: List<String>) : String {
val w : String = max(list, comparator<String?> {o1, o2 -> 1
})
return w
}
//from library
fun <T> comparator(fn: (T,T) -> Int): Comparator<T> {}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
package b
//+JDK
@@ -31,6 +31,6 @@ fun foo() {
@Suppress("UNCHECKED_CAST")
fun <T> array(vararg t : T) : Array<T> = t as Array<T>
infix fun <T, R> Array<T>.map(transform : (T) -> R) : List<R> {}
infix fun <T, R> Array<T>.map(transform : (T) -> R) : List<R> {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
infix fun <T, R> Iterable<T>.map(transform : (T) -> R) : List<R> {}
infix fun <T, R> Iterable<T>.map(transform : (T) -> R) : List<R> {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
@@ -6,8 +6,8 @@ package i
import java.util.*
import checkSubtype
fun <T, R> Collection<T>.map1(f : (T) -> R) : List<R> {}
fun <T, R> java.lang.Iterable<T>.map1(f : (T) -> R) : List<R> {}
fun <T, R> Collection<T>.map1(f : (T) -> R) : List<R> {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
fun <T, R> java.lang.Iterable<T>.map1(f : (T) -> R) : List<R> {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
fun test(list: List<Int>) {
val res = list.map1 { it }
@@ -2,7 +2,7 @@ package a
import java.util.*
fun <T> g (f: () -> List<T>) : T {}
fun <T> g (f: () -> List<T>) : T {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
fun test() {
//here possibly can be a cycle on constraints
@@ -1,19 +0,0 @@
// !CHECK_TYPE
//KT-1029 Wrong type inference
package i
import checkSubtype
public fun<T> from(yielder: ()->Iterable<T>) : Iterable<T> {
}
public infix fun<T> Iterable<T>.where(predicate : (T)->Boolean) : ()->Iterable<T> {
}
fun a() {
val x = 0..200
val odd = from (x where {it%2==0}) // I believe it should infer here
checkSubtype<Iterable<Int>>(odd)
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !CHECK_TYPE
//KT-1029 Wrong type inference
@@ -1,22 +0,0 @@
// !CHECK_TYPE
//KT-1031 Can't infer type of `it` with two lambdas
package i
import java.util.ArrayList
import checkSubtype
public infix fun<TItem> Iterable<TItem>.where(predicate : (TItem)->Boolean) : ()->Iterable<TItem> {
}
public fun<TItem, TResult> select(yielder: ()->Iterable<TItem>, selector : (TItem)->TResult) : ()->Iterable<TResult> {
}
fun a() {
val x = 0..200
val z = x where { i: Int -> i % 2 == 0 }
val yielder = select(x where { it%2==0 }, { it.toString() })
checkSubtype<() -> Iterable<Int>>(z)
checkSubtype<() -> Iterable<String>>(yielder)
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !CHECK_TYPE
//KT-1031 Can't infer type of `it` with two lambdas
@@ -2,7 +2,7 @@
package d
fun <T> asList(t: T) : List<T>? {}
fun <T> asList(t: T) : List<T>? {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
fun main() {
val list : List<String> = <!INITIALIZER_TYPE_MISMATCH, TYPE_MISMATCH!>asList("")<!>
@@ -12,6 +12,6 @@ fun test(numbers: Iterable<Int>) {
}
//from library
fun <T, R> Iterable<T>.map(transform : (T) -> R) : List<R> {}
fun <T, R> Iterable<T>.map(transform : (T) -> R) : List<R> {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
fun <T> Iterable<T>.fold(initial: T, operation: (T, T) -> T): T {}
fun <T> Iterable<T>.fold(initial: T, operation: (T, T) -> T): T {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
@@ -1,28 +0,0 @@
// !CHECK_TYPE
// KT-1410 Compiler does automatically infer type argument when using variance
//+JDK
package d
import checkSubtype
public fun <T> MutableCollection<out T>.filterToMy(result : MutableList<in T>, filter : (T) -> Boolean) : MutableCollection<out T> {
for (t in this){
if (filter(t)){
result.add(t)
}
}
return this
}
fun foo(result: MutableList<in String>, collection: MutableCollection<String>, prefix : String){
collection.filterToMy(result, {it.startsWith(prefix)})
}
fun test(result: MutableList<in Any>, collection: MutableCollection<String>, prefix : String){
val c = collection.filterToMy(result, {it.startsWith(prefix)})
checkSubtype<MutableCollection<out String>>(c)
}
//from library
fun String.startsWith(prefix: String) : Boolean {}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !CHECK_TYPE
// KT-1410 Compiler does automatically infer type argument when using variance
@@ -14,5 +14,5 @@ fun test() {
}
//from library
fun <T> arrayList(vararg values: T) : ArrayList<T> {}
operator fun <T> Iterable<T>.plus(elements: Iterable<T>): List<T> {}
fun <T> arrayList(vararg values: T) : ArrayList<T> {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
operator fun <T> Iterable<T>.plus(elements: Iterable<T>): List<T> {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
@@ -24,4 +24,4 @@ abstract class Buggy {
}
//from library
fun <T: Any> Iterable<T>.find(predicate: (T) -> Boolean) : T? {}
fun <T: Any> Iterable<T>.find(predicate: (T) -> Boolean) : T? {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
@@ -12,8 +12,8 @@ fun test() {
}
//from library
fun <T> arrayList(vararg values: T) : ArrayList<T> {}
fun <T> arrayList(vararg values: T) : ArrayList<T> {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
fun <T, R> Collection<T>.map(transform : (T) -> R) : List<R> {}
fun <T, R> Collection<T>.map(transform : (T) -> R) : List<R> {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
fun <T> Iterable<T>.fold(initial: T, operation: (T, T) -> T): T {}
fun <T> Iterable<T>.fold(initial: T, operation: (T, T) -> T): T {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
@@ -1,10 +0,0 @@
//KT-2459 Type inference error
package b
import java.util.*
class B<T>(val x: List<T>)
fun <T> f(x: T): B<T> = B(arrayList(x))
// from standard library
fun <T> arrayList(vararg values: T) : ArrayList<T> {}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
//KT-2459 Type inference error
package b
@@ -1,27 +0,0 @@
package c
interface A<T>
fun test(a: A<Int>?) {
a<!UNSAFE_CALL!>.<!>foo() //no error
}
fun <R> A<R>.foo() {}
//------------
fun test(nullabilityInfoMap: Map<Int, Any>?) {
nullabilityInfoMap<!UNSAFE_CALL!>.<!>iterator() //no error
}
//resolves to
public fun <K,V> Map<K,V>.iterator(): Iterator<Map.Entry<K,V>> {}
//-------------
fun foo() : Boolean {
val nullableList = getNullableList()
return nullableList<!UNSAFE_CALL!>.<!>contains("")
}
fun getNullableList(): List<String>? = null
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
package c
interface A<T>
@@ -8,7 +8,7 @@ class Y<TItem>(val itemToString: (TItem) -> String){
}
fun <TItem> bar(context : Y<TItem>) : TItem{
}
<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
fun foo(){
val stringToString : (String) -> String = { it }
@@ -1,43 +0,0 @@
//KT-3007 Kotlin plugin 0.4.126 does not compile KAnnotator revision ba0a93eb
package a
enum class SomeEnum {
FIRST,
SECOND
}
// Doesn't work
fun Iterable<Int>.some() {
this.fold(SomeEnum.FIRST, {res : SomeEnum, value ->
if (res == SomeEnum.FIRST) SomeEnum.FIRST else SomeEnum.SECOND
})
}
fun tempFun() : SomeEnum {
return SomeEnum.FIRST
}
// Doesn't work
fun Iterable<Int>.someSimpleWithFun() {
this.fold(SomeEnum.FIRST, {res : SomeEnum, value ->
tempFun()
})
}
// Works
fun Iterable<Int>.someSimple() {
this.fold(SomeEnum.FIRST, {res : SomeEnum, value ->
SomeEnum.FIRST
})
}
// Works
fun Iterable<Int>.someInt() {
this.fold(0, {res : Int, value ->
if (res == 0) 1 else 0
})
}
//from standard library
fun <T,R> Iterable<T>.fold(initial: R, operation: (R, T) -> R): R {}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
//KT-3007 Kotlin plugin 0.4.126 does not compile KAnnotator revision ba0a93eb
package a
@@ -1,20 +0,0 @@
//KT-3301 Inference with several supertypes fails
package arrays
interface A
interface B
object CAB : A, B
object DAB : A, B
fun m(args : Array<A>) {
}
fun test122() {
m(array(CAB, DAB)) // Wrong error here: Array<Any> is inferred while expected Array<A> is satisfied
}
//from library
fun <T> array(vararg t: T): Array<T> {}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
//KT-3301 Inference with several supertypes fails
package arrays
@@ -2,7 +2,7 @@
package a
//+JDK
fun <T> getJavaClass() : java.lang.Class<T> { }
fun <T> getJavaClass() : java.lang.Class<T> { <!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
public class Throwables() {
companion object {
@@ -1,23 +0,0 @@
// !CHECK_TYPE
//KT-943 Type inference failed
package maze
//+JDK
import java.util.Collections.*
import java.util.*
import checkSubtype
fun foo(lines: List<String>) {
val w = max(lines, comparator {o1, o2 ->
val l1 : Int = o1.length // Types of o1 and o2 are ERROR
val l2 = o2.length
l1 - l2
}).sure()
checkSubtype<String>(w)
}
//standard library
fun <T : Any> T?.sure() : T = this!!
public inline fun <T> comparator(fn: (T,T) -> Int): Comparator<T> {}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !CHECK_TYPE
//KT-943 Type inference failed
@@ -1,12 +0,0 @@
package a
fun <R> foo (f: ()->R, r: MutableList<R>) = r.add(f())
fun <R> bar (r: MutableList<R>, f: ()->R) = r.add(f())
fun test() {
val a = foo({1}, arrayListOf("")) //no type inference error on 'arrayListOf'
val b = bar(arrayListOf(""), {1})
}
// from standard library
fun <T> arrayListOf(vararg values: T) : MutableList<T> {}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
package a
fun <R> foo (f: ()->R, r: MutableList<R>) = r.add(f())
@@ -19,4 +19,4 @@ fun test(a: Any, s: MutableSet<String>) {
}
//from standard library
fun <T> arrayListOf(vararg t: T): MutableList<T> {}
fun <T> arrayListOf(vararg t: T): MutableList<T> {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
@@ -150,7 +150,7 @@ fun illegalWhenBlock(a: Any): Int {
is Int -> return a
is String -> return <!RETURN_TYPE_MISMATCH!>a<!>
}
}
<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
fun declarations(a: Any?) {
if (a is String) {
val p4: String = a
@@ -107,4 +107,4 @@ fun <K, V> testMutableMap(m: MutableMap<K, V>) {
val mutableSet1: MutableSet<MutableMap.MutableEntry<K, V>> = m.entries
}
fun <T> array(vararg t: T): Array<T> {}
fun <T> array(vararg t: T): Array<T> {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
@@ -1,8 +0,0 @@
package kt402
fun getTypeChecker() : (Any)->Boolean {
{ a : Any -> a is <!UNRESOLVED_REFERENCE!>T<!> } // reports unsupported
}
fun f() : (Any) -> Boolean {
return { a : Any -> a is String }
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
package kt402
fun getTypeChecker() : (Any)->Boolean {
@@ -1,31 +0,0 @@
// KT-442 Type inference fails on with()
fun <T> funny(f : () -> T) : T = f()
fun testFunny() {
val a : Int = funny {1}
}
fun <T> funny2(f : (t : T) -> T) : T {}
fun testFunny2() {
val a : Int = funny2 {it}
}
fun box() : String {
return generic_invoker { it }
}
fun <T> generic_invoker(gen : (String) -> T) : T {
return gen("")
}
infix fun <T> T.with(f : T.() -> Unit) {
f()
}
fun main() {
val a = 1 with {
plus(1)
}
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// KT-442 Type inference fails on with()
fun <T> funny(f : () -> T) : T = f()
@@ -1,30 +0,0 @@
//KT-456 No check for obligatory return in getters
package kt456
class A() {
val i: Int
get() : Int { //no error
}
}
//more tests
class B() {
val i: Int
get() { //no error
}
}
class C() {
val i : Int
get() : Int {
try {
doSmth()
}
finally {
doSmth()
}
}
}
fun doSmth() {}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
//KT-456 No check for obligatory return in getters
package kt456
@@ -85,7 +85,7 @@ fun t7() : Int {
finally {
doSmth(3)
}
}
<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
fun doSmth(i: Int) {
}
@@ -3,7 +3,7 @@ data class StringPair(val first: String, val second: String)
infix fun String.to(second: String) = StringPair(this, second)
fun hashMapOf(pair: StringPair): MutableMap<String, String> {
}
<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
fun F() : MutableMap<String, String> {
val value: String? = "xyz"
@@ -14,10 +14,10 @@ fun bad(): String {
val x: String? = null
x?.myRun { return "" }
}
<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
fun ok(): String {
val x: String? = null
x?.run { return "non-null" } ?: return "null"
}
<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
@@ -85,6 +85,6 @@ fun case_6() {
null!!
}
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any?"), UNINITIALIZED_VARIABLE!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any?"), UNINITIALIZED_VARIABLE!>x<!>.<!INAPPLICABLE_CANDIDATE!>minus<!>(10.0)
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.Double")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.Double")!>x<!>.minus(10.0)
}
@@ -78,7 +78,7 @@ fun case_5(x: Any?) {
fun case_6(x: Any?) {
var y = x ?: null!!
while (false || y is Number) {
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any?")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.Any")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any")!>y<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any")!>y<!>.<!UNRESOLVED_REFERENCE!>toByte<!>()
}
@@ -91,7 +91,7 @@ fun case_6(x: Any?) {
fun case_7(x: Any?, z: Any) {
var y = x ?: null!!
while (false || y === z) {
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any?")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.Any")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any")!>y<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any")!>y<!>.equals(10)
}
@@ -104,7 +104,7 @@ fun case_7(x: Any?, z: Any) {
fun case_8(x: Any?, z: Any) {
var y = x ?: null!!
y == z || return
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any?")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.Any")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any")!>y<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any")!>y<!>.equals(10)
}
@@ -129,7 +129,7 @@ fun case_10(x: Any?, z: Any, b: Boolean?) {
null -> throw Exception()
}
z === y || if (b == true) return else if (b === false) null!! else throw Exception()
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any?")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.Any")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any")!>y<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any")!>y<!>.equals(10)
}
@@ -27,6 +27,7 @@ import org.jetbrains.kotlin.psi.KtCallExpression
import org.jetbrains.kotlin.psi.KtClass
import org.jetbrains.kotlin.psi.KtClassOrObject
import org.jetbrains.kotlin.psi.KtDeclaration
import org.jetbrains.kotlin.psi.KtDeclarationWithBody
import org.jetbrains.kotlin.psi.KtDestructuringDeclaration
import org.jetbrains.kotlin.psi.KtElement
import org.jetbrains.kotlin.psi.KtExpression
@@ -2797,6 +2798,12 @@ internal val KT_DIAGNOSTIC_CONVERTER = KtDiagnosticConverterBuilder.buildConvert
token,
)
}
add(FirErrors.NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY) { firDiagnostic ->
NoReturnInFunctionWithBlockBodyImpl(
firDiagnostic as FirPsiDiagnostic,
token,
)
}
add(FirErrors.USAGE_IS_NOT_INLINABLE) { firDiagnostic ->
UsageIsNotInlinableImpl(
firSymbolBuilder.buildSymbol(firDiagnostic.a.fir),
@@ -34,6 +34,7 @@ import org.jetbrains.kotlin.psi.KtCallExpression
import org.jetbrains.kotlin.psi.KtClass
import org.jetbrains.kotlin.psi.KtClassOrObject
import org.jetbrains.kotlin.psi.KtDeclaration
import org.jetbrains.kotlin.psi.KtDeclarationWithBody
import org.jetbrains.kotlin.psi.KtDestructuringDeclaration
import org.jetbrains.kotlin.psi.KtElement
import org.jetbrains.kotlin.psi.KtExpression
@@ -1964,6 +1965,10 @@ sealed class KtFirDiagnostic<PSI : PsiElement> : KtDiagnosticWithPsi<PSI> {
override val diagnosticClass get() = ReturnInFunctionWithExpressionBody::class
}
abstract class NoReturnInFunctionWithBlockBody : KtFirDiagnostic<KtDeclarationWithBody>() {
override val diagnosticClass get() = NoReturnInFunctionWithBlockBody::class
}
abstract class UsageIsNotInlinable : KtFirDiagnostic<KtElement>() {
override val diagnosticClass get() = UsageIsNotInlinable::class
abstract val parameter: KtSymbol
@@ -36,6 +36,7 @@ import org.jetbrains.kotlin.psi.KtCallExpression
import org.jetbrains.kotlin.psi.KtClass
import org.jetbrains.kotlin.psi.KtClassOrObject
import org.jetbrains.kotlin.psi.KtDeclaration
import org.jetbrains.kotlin.psi.KtDeclarationWithBody
import org.jetbrains.kotlin.psi.KtDestructuringDeclaration
import org.jetbrains.kotlin.psi.KtElement
import org.jetbrains.kotlin.psi.KtExpression
@@ -3177,6 +3178,13 @@ internal class ReturnInFunctionWithExpressionBodyImpl(
override val firDiagnostic: FirPsiDiagnostic by weakRef(firDiagnostic)
}
internal class NoReturnInFunctionWithBlockBodyImpl(
firDiagnostic: FirPsiDiagnostic,
override val token: ValidityToken,
) : KtFirDiagnostic.NoReturnInFunctionWithBlockBody(), KtAbstractFirDiagnostic<KtDeclarationWithBody> {
override val firDiagnostic: FirPsiDiagnostic by weakRef(firDiagnostic)
}
internal class UsageIsNotInlinableImpl(
override val parameter: KtSymbol,
firDiagnostic: FirPsiDiagnostic,