[FIR] Create separated FirBlock for loop local val

Refactor FIR builders code for ForExpression
This commit is contained in:
Ivan Kochurkin
2022-12-05 18:02:22 +01:00
committed by Space Team
parent e49bb1fe37
commit a3e7a35cb1
30 changed files with 1426 additions and 1222 deletions
@@ -5,4 +5,7 @@ FIR source kind: KtRealSourceElementKind
FIR element rendered:
while(R|<local>/<iterator>|.R|SubstitutionOverride<kotlin/collections/IntIterator.hasNext: R|kotlin/Boolean|>|()) {
lval x: R|kotlin/Int| = R|<local>/<iterator>|.R|kotlin/collections/IntIterator.next|()
{
}
}
+46 -39
View File
@@ -208,42 +208,47 @@ digraph complex_kt {
68 [label="Variable declaration: lval element: R|kotlin/Any?|"];
subgraph cluster_23 {
color=blue
69 [label="Enter when"];
69 [label="Enter block"];
subgraph cluster_24 {
color=blue
70 [label="Enter when branch condition "];
71 [label="Access variable R|<local>/element|"];
72 [label="Type operator: (R|<local>/element| is R|T|)"];
73 [label="Exit when branch condition"];
70 [label="Enter when"];
subgraph cluster_25 {
color=blue
71 [label="Enter when branch condition "];
72 [label="Access variable R|<local>/element|"];
73 [label="Type operator: (R|<local>/element| is R|T|)"];
74 [label="Exit when branch condition"];
}
75 [label="Synthetic else branch"];
76 [label="Enter when branch result"];
subgraph cluster_26 {
color=blue
77 [label="Enter block"];
78 [label="Access variable R|<local>/element|"];
79 [label="Smart cast: R|<local>/element|"];
80 [label="Jump: ^firstIsInstanceOrNull R|<local>/element|"];
81 [label="Stub" style="filled" fillcolor=gray];
82 [label="Exit block" style="filled" fillcolor=gray];
}
83 [label="Exit when branch result" style="filled" fillcolor=gray];
84 [label="Exit when"];
}
74 [label="Synthetic else branch"];
75 [label="Enter when branch result"];
subgraph cluster_25 {
color=blue
76 [label="Enter block"];
77 [label="Access variable R|<local>/element|"];
78 [label="Smart cast: R|<local>/element|"];
79 [label="Jump: ^firstIsInstanceOrNull R|<local>/element|"];
80 [label="Stub" style="filled" fillcolor=gray];
81 [label="Exit block" style="filled" fillcolor=gray];
}
82 [label="Exit when branch result" style="filled" fillcolor=gray];
83 [label="Exit when"];
85 [label="Exit block"];
}
84 [label="Exit block"];
86 [label="Exit block"];
}
85 [label="Exit loop block"];
87 [label="Exit loop block"];
}
86 [label="Exit while loop"];
88 [label="Exit while loop"];
}
87 [label="Exit block"];
89 [label="Exit block"];
}
88 [label="Const: Null(null)"];
89 [label="Jump: ^firstIsInstanceOrNull Null(null)"];
90 [label="Stub" style="filled" fillcolor=gray];
91 [label="Exit block" style="filled" fillcolor=gray];
90 [label="Const: Null(null)"];
91 [label="Jump: ^firstIsInstanceOrNull Null(null)"];
92 [label="Stub" style="filled" fillcolor=gray];
93 [label="Exit block" style="filled" fillcolor=gray];
}
92 [label="Exit function firstIsInstanceOrNull" style="filled" fillcolor=red];
94 [label="Exit function firstIsInstanceOrNull" style="filled" fillcolor=red];
}
53 -> {54};
54 -> {55};
@@ -255,7 +260,7 @@ digraph complex_kt {
60 -> {61};
61 -> {62};
62 -> {63};
63 -> {64 86};
63 -> {64 88};
64 -> {65};
65 -> {66};
66 -> {67};
@@ -265,26 +270,28 @@ digraph complex_kt {
70 -> {71};
71 -> {72};
72 -> {73};
73 -> {74 75};
74 -> {83};
75 -> {76};
73 -> {74};
74 -> {75 76};
75 -> {84};
76 -> {77};
77 -> {78};
78 -> {79};
79 -> {92};
79 -> {80} [style=dotted];
79 -> {80};
80 -> {94};
80 -> {81} [style=dotted];
81 -> {82} [style=dotted];
82 -> {83} [style=dotted];
83 -> {84};
83 -> {84} [style=dotted];
84 -> {85};
85 -> {60} [color=green style=dashed];
85 -> {86};
86 -> {87};
87 -> {88};
87 -> {60} [color=green style=dashed];
88 -> {89};
89 -> {92};
89 -> {90} [style=dotted];
90 -> {91} [style=dotted];
89 -> {90};
90 -> {91};
91 -> {94};
91 -> {92} [style=dotted];
92 -> {93} [style=dotted];
93 -> {94} [style=dotted];
}
@@ -27,10 +27,13 @@ FILE: complex.kt
lval <iterator>: R|kotlin/collections/Iterator<kotlin/Any?>| = this@R|/firstIsInstanceOrNull|.R|SubstitutionOverride<kotlin/collections/List.iterator: R|kotlin/collections/Iterator<CapturedType(*)>|>|()
while(R|<local>/<iterator>|.R|SubstitutionOverride<kotlin/collections/Iterator.hasNext: R|kotlin/Boolean|>|()) {
lval element: R|kotlin/Any?| = R|<local>/<iterator>|.R|SubstitutionOverride<kotlin/collections/Iterator.next: R|kotlin/Any?|>|()
when () {
(R|<local>/element| is R|T|) -> {
^firstIsInstanceOrNull R|<local>/element|
{
when () {
(R|<local>/element| is R|T|) -> {
^firstIsInstanceOrNull R|<local>/element|
}
}
}
}
+258 -251
View File
@@ -145,22 +145,27 @@ digraph loops_kt {
51 [label="Access variable R|<local>/<iterator>|"];
52 [label="Function call: R|<local>/<iterator>|.R|kotlin/collections/IntIterator.next|()" style="filled" fillcolor=yellow];
53 [label="Variable declaration: lval i: R|kotlin/Int|"];
54 [label="Access variable R|<local>/x|"];
55 [label="Type operator: (R|<local>/x| is R|kotlin/String|)"];
56 [label="Variable declaration: lval y: R|kotlin/Boolean|"];
57 [label="Exit block"];
subgraph cluster_19 {
color=blue
54 [label="Enter block"];
55 [label="Access variable R|<local>/x|"];
56 [label="Type operator: (R|<local>/x| is R|kotlin/String|)"];
57 [label="Variable declaration: lval y: R|kotlin/Boolean|"];
58 [label="Exit block"];
}
59 [label="Exit block"];
}
58 [label="Exit loop block"];
60 [label="Exit loop block"];
}
59 [label="Exit while loop"];
61 [label="Exit while loop"];
}
60 [label="Exit block"];
62 [label="Exit block"];
}
61 [label="Access variable R|<local>/x|"];
62 [label="Type operator: (R|<local>/x| is R|kotlin/String|)"];
63 [label="Exit block"];
63 [label="Access variable R|<local>/x|"];
64 [label="Type operator: (R|<local>/x| is R|kotlin/String|)"];
65 [label="Exit block"];
}
64 [label="Exit function testFor" style="filled" fillcolor=red];
66 [label="Exit function testFor" style="filled" fillcolor=red];
}
36 -> {37};
37 -> {38};
@@ -174,7 +179,7 @@ digraph loops_kt {
45 -> {46};
46 -> {47};
47 -> {48};
48 -> {49 59};
48 -> {49 61};
49 -> {50};
50 -> {51};
51 -> {52};
@@ -184,227 +189,227 @@ digraph loops_kt {
55 -> {56};
56 -> {57};
57 -> {58};
58 -> {45} [color=green style=dashed];
58 -> {59};
59 -> {60};
60 -> {61};
60 -> {45} [color=green style=dashed];
61 -> {62};
62 -> {63};
63 -> {64};
64 -> {65};
65 -> {66};
subgraph cluster_19 {
subgraph cluster_20 {
color=red
65 [label="Enter function testWhileTrue" style="filled" fillcolor=red];
subgraph cluster_20 {
67 [label="Enter function testWhileTrue" style="filled" fillcolor=red];
subgraph cluster_21 {
color=blue
66 [label="Enter block"];
subgraph cluster_21 {
68 [label="Enter block"];
subgraph cluster_22 {
color=blue
67 [label="Enter while loop"];
subgraph cluster_22 {
color=blue
68 [label="Enter loop condition"];
69 [label="Const: Boolean(true)"];
70 [label="Exit loop condition"];
}
69 [label="Enter while loop"];
subgraph cluster_23 {
color=blue
71 [label="Enter loop block"];
subgraph cluster_24 {
color=blue
72 [label="Enter block"];
73 [label="Const: Int(1)"];
74 [label="Exit block"];
}
75 [label="Exit loop block"];
70 [label="Enter loop condition"];
71 [label="Const: Boolean(true)"];
72 [label="Exit loop condition"];
}
76 [label="Exit while loop" style="filled" fillcolor=gray];
subgraph cluster_24 {
color=blue
73 [label="Enter loop block"];
subgraph cluster_25 {
color=blue
74 [label="Enter block"];
75 [label="Const: Int(1)"];
76 [label="Exit block"];
}
77 [label="Exit loop block"];
}
78 [label="Exit while loop" style="filled" fillcolor=gray];
}
77 [label="Const: Int(1)" style="filled" fillcolor=gray];
78 [label="Exit block" style="filled" fillcolor=gray];
79 [label="Const: Int(1)" style="filled" fillcolor=gray];
80 [label="Exit block" style="filled" fillcolor=gray];
}
79 [label="Exit function testWhileTrue" style="filled" fillcolor=gray];
81 [label="Exit function testWhileTrue" style="filled" fillcolor=gray];
}
65 -> {66};
66 -> {67};
67 -> {68};
68 -> {69};
69 -> {70};
70 -> {71};
70 -> {76} [style=dotted];
71 -> {72};
72 -> {73};
72 -> {78} [style=dotted];
73 -> {74};
74 -> {75};
75 -> {68} [color=green style=dashed];
76 -> {77} [style=dotted];
77 -> {78} [style=dotted];
75 -> {76};
76 -> {77};
77 -> {70} [color=green style=dashed];
78 -> {79} [style=dotted];
79 -> {80} [style=dotted];
80 -> {81} [style=dotted];
subgraph cluster_25 {
subgraph cluster_26 {
color=red
80 [label="Enter function testWhileTrueWithBreak" style="filled" fillcolor=red];
subgraph cluster_26 {
82 [label="Enter function testWhileTrueWithBreak" style="filled" fillcolor=red];
subgraph cluster_27 {
color=blue
81 [label="Enter block"];
subgraph cluster_27 {
83 [label="Enter block"];
subgraph cluster_28 {
color=blue
82 [label="Enter while loop"];
subgraph cluster_28 {
color=blue
83 [label="Enter loop condition"];
84 [label="Const: Boolean(true)"];
85 [label="Exit loop condition"];
}
84 [label="Enter while loop"];
subgraph cluster_29 {
color=blue
86 [label="Enter loop block"];
subgraph cluster_30 {
85 [label="Enter loop condition"];
86 [label="Const: Boolean(true)"];
87 [label="Exit loop condition"];
}
subgraph cluster_30 {
color=blue
88 [label="Enter loop block"];
subgraph cluster_31 {
color=blue
87 [label="Enter block"];
subgraph cluster_31 {
89 [label="Enter block"];
subgraph cluster_32 {
color=blue
88 [label="Enter when"];
subgraph cluster_32 {
color=blue
89 [label="Enter when branch condition "];
90 [label="Access variable R|<local>/b|"];
91 [label="Exit when branch condition"];
}
92 [label="Synthetic else branch"];
93 [label="Enter when branch result"];
90 [label="Enter when"];
subgraph cluster_33 {
color=blue
94 [label="Enter block"];
95 [label="Jump: break@@@[Boolean(true)] "];
96 [label="Stub" style="filled" fillcolor=gray];
97 [label="Exit block" style="filled" fillcolor=gray];
91 [label="Enter when branch condition "];
92 [label="Access variable R|<local>/b|"];
93 [label="Exit when branch condition"];
}
98 [label="Exit when branch result" style="filled" fillcolor=gray];
99 [label="Exit when"];
94 [label="Synthetic else branch"];
95 [label="Enter when branch result"];
subgraph cluster_34 {
color=blue
96 [label="Enter block"];
97 [label="Jump: break@@@[Boolean(true)] "];
98 [label="Stub" style="filled" fillcolor=gray];
99 [label="Exit block" style="filled" fillcolor=gray];
}
100 [label="Exit when branch result" style="filled" fillcolor=gray];
101 [label="Exit when"];
}
100 [label="Exit block"];
102 [label="Exit block"];
}
101 [label="Exit loop block"];
103 [label="Exit loop block"];
}
102 [label="Exit while loop"];
104 [label="Exit while loop"];
}
103 [label="Const: Int(1)"];
104 [label="Exit block"];
105 [label="Const: Int(1)"];
106 [label="Exit block"];
}
105 [label="Exit function testWhileTrueWithBreak" style="filled" fillcolor=red];
107 [label="Exit function testWhileTrueWithBreak" style="filled" fillcolor=red];
}
80 -> {81};
81 -> {82};
82 -> {83};
83 -> {84};
84 -> {85};
85 -> {86};
85 -> {102} [style=dotted];
86 -> {87};
87 -> {88};
87 -> {104} [style=dotted];
88 -> {89};
89 -> {90};
90 -> {91};
91 -> {92 93};
92 -> {99};
93 -> {94};
94 -> {95};
95 -> {102};
95 -> {96} [style=dotted];
96 -> {97} [style=dotted];
91 -> {92};
92 -> {93};
93 -> {94 95};
94 -> {101};
95 -> {96};
96 -> {97};
97 -> {104};
97 -> {98} [style=dotted];
98 -> {99} [style=dotted];
99 -> {100};
100 -> {101};
101 -> {83} [color=green style=dashed];
99 -> {100} [style=dotted];
100 -> {101} [style=dotted];
101 -> {102};
102 -> {103};
103 -> {104};
103 -> {85} [color=green style=dashed];
104 -> {105};
105 -> {106};
106 -> {107};
subgraph cluster_34 {
subgraph cluster_35 {
color=red
106 [label="Enter function testWhileFalse" style="filled" fillcolor=red];
subgraph cluster_35 {
108 [label="Enter function testWhileFalse" style="filled" fillcolor=red];
subgraph cluster_36 {
color=blue
107 [label="Enter block"];
subgraph cluster_36 {
109 [label="Enter block"];
subgraph cluster_37 {
color=blue
108 [label="Enter while loop"];
subgraph cluster_37 {
color=blue
109 [label="Enter loop condition"];
110 [label="Const: Boolean(false)"];
111 [label="Exit loop condition"];
}
110 [label="Enter while loop"];
subgraph cluster_38 {
color=blue
112 [label="Enter loop block" style="filled" fillcolor=gray];
subgraph cluster_39 {
color=blue
113 [label="Enter block" style="filled" fillcolor=gray];
114 [label="Const: Int(1)" style="filled" fillcolor=gray];
115 [label="Exit block" style="filled" fillcolor=gray];
}
116 [label="Exit loop block" style="filled" fillcolor=gray];
111 [label="Enter loop condition"];
112 [label="Const: Boolean(false)"];
113 [label="Exit loop condition"];
}
117 [label="Exit while loop"];
subgraph cluster_39 {
color=blue
114 [label="Enter loop block" style="filled" fillcolor=gray];
subgraph cluster_40 {
color=blue
115 [label="Enter block" style="filled" fillcolor=gray];
116 [label="Const: Int(1)" style="filled" fillcolor=gray];
117 [label="Exit block" style="filled" fillcolor=gray];
}
118 [label="Exit loop block" style="filled" fillcolor=gray];
}
119 [label="Exit while loop"];
}
118 [label="Const: Int(1)"];
119 [label="Exit block"];
120 [label="Const: Int(1)"];
121 [label="Exit block"];
}
120 [label="Exit function testWhileFalse" style="filled" fillcolor=red];
122 [label="Exit function testWhileFalse" style="filled" fillcolor=red];
}
106 -> {107};
107 -> {108};
108 -> {109};
109 -> {110};
110 -> {111};
111 -> {117};
111 -> {112} [style=dotted];
112 -> {113} [style=dotted];
111 -> {112};
112 -> {113};
113 -> {119};
113 -> {114} [style=dotted];
114 -> {115} [style=dotted];
115 -> {116} [style=dotted];
116 -> {109} [color=green style=dotted];
117 -> {118};
118 -> {119};
116 -> {117} [style=dotted];
117 -> {118} [style=dotted];
118 -> {111} [color=green style=dotted];
119 -> {120};
subgraph cluster_40 {
color=red
121 [label="Enter function testDoWhileTrue" style="filled" fillcolor=red];
subgraph cluster_41 {
color=blue
122 [label="Enter block"];
subgraph cluster_42 {
color=blue
123 [label="Enter do-while loop"];
subgraph cluster_43 {
color=blue
124 [label="Enter loop block"];
subgraph cluster_44 {
color=blue
125 [label="Enter block"];
126 [label="Const: Int(1)"];
127 [label="Exit block"];
}
128 [label="Exit loop block"];
}
subgraph cluster_45 {
color=blue
129 [label="Enter loop condition"];
130 [label="Const: Boolean(true)"];
131 [label="Exit loop condition"];
}
132 [label="Exit do-while loop" style="filled" fillcolor=gray];
}
133 [label="Const: Int(1)" style="filled" fillcolor=gray];
134 [label="Exit block" style="filled" fillcolor=gray];
}
135 [label="Exit function testDoWhileTrue" style="filled" fillcolor=gray];
}
120 -> {121};
121 -> {122};
122 -> {123};
subgraph cluster_41 {
color=red
123 [label="Enter function testDoWhileTrue" style="filled" fillcolor=red];
subgraph cluster_42 {
color=blue
124 [label="Enter block"];
subgraph cluster_43 {
color=blue
125 [label="Enter do-while loop"];
subgraph cluster_44 {
color=blue
126 [label="Enter loop block"];
subgraph cluster_45 {
color=blue
127 [label="Enter block"];
128 [label="Const: Int(1)"];
129 [label="Exit block"];
}
130 [label="Exit loop block"];
}
subgraph cluster_46 {
color=blue
131 [label="Enter loop condition"];
132 [label="Const: Boolean(true)"];
133 [label="Exit loop condition"];
}
134 [label="Exit do-while loop" style="filled" fillcolor=gray];
}
135 [label="Const: Int(1)" style="filled" fillcolor=gray];
136 [label="Exit block" style="filled" fillcolor=gray];
}
137 [label="Exit function testDoWhileTrue" style="filled" fillcolor=gray];
}
123 -> {124};
124 -> {125};
125 -> {126};
@@ -413,128 +418,128 @@ digraph loops_kt {
128 -> {129};
129 -> {130};
130 -> {131};
131 -> {124} [color=green style=dashed];
131 -> {132} [style=dotted];
132 -> {133} [style=dotted];
131 -> {132};
132 -> {133};
133 -> {126} [color=green style=dashed];
133 -> {134} [style=dotted];
134 -> {135} [style=dotted];
135 -> {136} [style=dotted];
136 -> {137} [style=dotted];
subgraph cluster_46 {
subgraph cluster_47 {
color=red
136 [label="Enter function testDoWhileTrueWithBreak" style="filled" fillcolor=red];
subgraph cluster_47 {
138 [label="Enter function testDoWhileTrueWithBreak" style="filled" fillcolor=red];
subgraph cluster_48 {
color=blue
137 [label="Enter block"];
subgraph cluster_48 {
139 [label="Enter block"];
subgraph cluster_49 {
color=blue
138 [label="Enter do-while loop"];
subgraph cluster_49 {
140 [label="Enter do-while loop"];
subgraph cluster_50 {
color=blue
139 [label="Enter loop block"];
subgraph cluster_50 {
141 [label="Enter loop block"];
subgraph cluster_51 {
color=blue
140 [label="Enter block"];
subgraph cluster_51 {
142 [label="Enter block"];
subgraph cluster_52 {
color=blue
141 [label="Enter when"];
subgraph cluster_52 {
color=blue
142 [label="Enter when branch condition "];
143 [label="Access variable R|<local>/b|"];
144 [label="Exit when branch condition"];
}
145 [label="Synthetic else branch"];
146 [label="Enter when branch result"];
143 [label="Enter when"];
subgraph cluster_53 {
color=blue
147 [label="Enter block"];
148 [label="Jump: break@@@[Boolean(true)] "];
149 [label="Stub" style="filled" fillcolor=gray];
150 [label="Exit block" style="filled" fillcolor=gray];
144 [label="Enter when branch condition "];
145 [label="Access variable R|<local>/b|"];
146 [label="Exit when branch condition"];
}
151 [label="Exit when branch result" style="filled" fillcolor=gray];
152 [label="Exit when"];
147 [label="Synthetic else branch"];
148 [label="Enter when branch result"];
subgraph cluster_54 {
color=blue
149 [label="Enter block"];
150 [label="Jump: break@@@[Boolean(true)] "];
151 [label="Stub" style="filled" fillcolor=gray];
152 [label="Exit block" style="filled" fillcolor=gray];
}
153 [label="Exit when branch result" style="filled" fillcolor=gray];
154 [label="Exit when"];
}
153 [label="Exit block"];
155 [label="Exit block"];
}
154 [label="Exit loop block"];
156 [label="Exit loop block"];
}
subgraph cluster_54 {
subgraph cluster_55 {
color=blue
155 [label="Enter loop condition"];
156 [label="Const: Boolean(true)"];
157 [label="Exit loop condition"];
157 [label="Enter loop condition"];
158 [label="Const: Boolean(true)"];
159 [label="Exit loop condition"];
}
158 [label="Exit do-while loop"];
160 [label="Exit do-while loop"];
}
159 [label="Const: Int(1)"];
160 [label="Exit block"];
161 [label="Const: Int(1)"];
162 [label="Exit block"];
}
161 [label="Exit function testDoWhileTrueWithBreak" style="filled" fillcolor=red];
163 [label="Exit function testDoWhileTrueWithBreak" style="filled" fillcolor=red];
}
136 -> {137};
137 -> {138};
138 -> {139};
139 -> {140};
140 -> {141};
141 -> {142};
142 -> {143};
143 -> {144};
144 -> {145 146};
145 -> {152};
146 -> {147};
147 -> {148};
148 -> {158};
148 -> {149} [style=dotted];
149 -> {150} [style=dotted];
144 -> {145};
145 -> {146};
146 -> {147 148};
147 -> {154};
148 -> {149};
149 -> {150};
150 -> {160};
150 -> {151} [style=dotted];
151 -> {152} [style=dotted];
152 -> {153};
153 -> {154};
152 -> {153} [style=dotted];
153 -> {154} [style=dotted];
154 -> {155};
155 -> {156};
156 -> {157};
157 -> {139} [color=green style=dashed];
157 -> {158} [style=dotted];
157 -> {158};
158 -> {159};
159 -> {160};
159 -> {141} [color=green style=dashed];
159 -> {160} [style=dotted];
160 -> {161};
subgraph cluster_55 {
color=red
162 [label="Enter function testDoWhileFalse" style="filled" fillcolor=red];
subgraph cluster_56 {
color=blue
163 [label="Enter block"];
subgraph cluster_57 {
color=blue
164 [label="Enter do-while loop"];
subgraph cluster_58 {
color=blue
165 [label="Enter loop block"];
subgraph cluster_59 {
color=blue
166 [label="Enter block"];
167 [label="Const: Int(1)"];
168 [label="Exit block"];
}
169 [label="Exit loop block"];
}
subgraph cluster_60 {
color=blue
170 [label="Enter loop condition"];
171 [label="Const: Boolean(false)"];
172 [label="Exit loop condition"];
}
173 [label="Exit do-while loop"];
}
174 [label="Const: Int(1)"];
175 [label="Exit block"];
}
176 [label="Exit function testDoWhileFalse" style="filled" fillcolor=red];
}
161 -> {162};
162 -> {163};
163 -> {164};
subgraph cluster_56 {
color=red
164 [label="Enter function testDoWhileFalse" style="filled" fillcolor=red];
subgraph cluster_57 {
color=blue
165 [label="Enter block"];
subgraph cluster_58 {
color=blue
166 [label="Enter do-while loop"];
subgraph cluster_59 {
color=blue
167 [label="Enter loop block"];
subgraph cluster_60 {
color=blue
168 [label="Enter block"];
169 [label="Const: Int(1)"];
170 [label="Exit block"];
}
171 [label="Exit loop block"];
}
subgraph cluster_61 {
color=blue
172 [label="Enter loop condition"];
173 [label="Const: Boolean(false)"];
174 [label="Exit loop condition"];
}
175 [label="Exit do-while loop"];
}
176 [label="Const: Int(1)"];
177 [label="Exit block"];
}
178 [label="Exit function testDoWhileFalse" style="filled" fillcolor=red];
}
164 -> {165};
165 -> {166};
166 -> {167};
@@ -544,9 +549,11 @@ digraph loops_kt {
170 -> {171};
171 -> {172};
172 -> {173};
172 -> {165} [color=green style=dotted];
173 -> {174};
174 -> {175};
174 -> {167} [color=green style=dotted];
175 -> {176};
176 -> {177};
177 -> {178};
}
@@ -18,7 +18,10 @@ FILE: loops.kt
lval <iterator>: R|kotlin/collections/IntIterator| = Int(0).R|kotlin/Int.rangeTo|(Int(5)).R|kotlin/ranges/IntProgression.iterator|()
while(R|<local>/<iterator>|.R|SubstitutionOverride<kotlin/collections/IntIterator.hasNext: R|kotlin/Boolean|>|()) {
lval i: R|kotlin/Int| = R|<local>/<iterator>|.R|kotlin/collections/IntIterator.next|()
lval y: R|kotlin/Boolean| = (R|<local>/x| is R|kotlin/String|)
{
lval y: R|kotlin/Boolean| = (R|<local>/x| is R|kotlin/String|)
}
}
}
@@ -27,7 +27,10 @@ FILE: enumValues.kt
lval <iterator>: R|kotlin/collections/Iterator<MyEnum>| = R|<local>/values|.R|SubstitutionOverride<kotlin/Array.iterator: R|kotlin/collections/Iterator<MyEnum>|>|()
while(R|<local>/<iterator>|.R|SubstitutionOverride<kotlin/collections/Iterator.hasNext: R|kotlin/Boolean|>|()) {
lval value: R|MyEnum| = R|<local>/<iterator>|.R|SubstitutionOverride<kotlin/collections/Iterator.next: R|MyEnum|>|()
R|<local>/value|.R|/MyEnum.bar|()
{
R|<local>/value|.R|/MyEnum.bar|()
}
}
}
@@ -70,7 +70,10 @@ FILE: CanBeValChecker.kt
lval <iterator>: R|kotlin/collections/IntIterator| = Int(1).R|kotlin/Int.rangeTo|(Int(10)).R|kotlin/ranges/IntProgression.iterator|()
while(R|<local>/<iterator>|.R|SubstitutionOverride<kotlin/collections/IntIterator.hasNext: R|kotlin/Boolean|>|()) {
lval i: R|kotlin/Int| = R|<local>/<iterator>|.R|kotlin/collections/IntIterator.next|()
R|kotlin/io/print|(R|<local>/i|)
{
R|kotlin/io/print|(R|<local>/i|)
}
}
}
@@ -4,6 +4,9 @@ FILE: NoWarning.kt
lval <iterator>: R|kotlin/collections/IntIterator| = Int(1).R|kotlin/Int.rangeTo|(Int(2)).R|kotlin/ranges/IntProgression.iterator|()
while(R|<local>/<iterator>|.R|SubstitutionOverride<kotlin/collections/IntIterator.hasNext: R|kotlin/Boolean|>|()) {
lval i: R|kotlin/Int| = R|<local>/<iterator>|.R|kotlin/collections/IntIterator.next|()
{
}
}
}
@@ -21,6 +24,9 @@ FILE: NoWarning.kt
lval <iterator>: R|kotlin/collections/IntIterator| = Int(2).R|kotlin/ranges/downTo|(Int(1)).R|kotlin/ranges/IntProgression.iterator|()
while(R|<local>/<iterator>|.R|SubstitutionOverride<kotlin/collections/IntIterator.hasNext: R|kotlin/Boolean|>|()) {
lval i: R|kotlin/Int| = R|<local>/<iterator>|.R|kotlin/collections/IntIterator.next|()
{
}
}
}
@@ -38,6 +44,9 @@ FILE: NoWarning.kt
lval <iterator>: R|kotlin/collections/IntIterator| = Int(1).R|kotlin/ranges/until|(Int(2)).R|kotlin/ranges/IntProgression.iterator|()
while(R|<local>/<iterator>|.R|SubstitutionOverride<kotlin/collections/IntIterator.hasNext: R|kotlin/Boolean|>|()) {
lval i: R|kotlin/Int| = R|<local>/<iterator>|.R|kotlin/collections/IntIterator.next|()
{
}
}
}
@@ -4,6 +4,9 @@ FILE: Warning.kt
lval <iterator>: R|kotlin/collections/IntIterator| = Int(2).R|kotlin/Int.rangeTo|(Int(1)).R|kotlin/ranges/IntProgression.iterator|()
while(R|<local>/<iterator>|.R|SubstitutionOverride<kotlin/collections/IntIterator.hasNext: R|kotlin/Boolean|>|()) {
lval i: R|kotlin/Int| = R|<local>/<iterator>|.R|kotlin/collections/IntIterator.next|()
{
}
}
}
@@ -21,6 +24,9 @@ FILE: Warning.kt
lval <iterator>: R|kotlin/collections/IntIterator| = Int(1).R|kotlin/ranges/downTo|(Int(2)).R|kotlin/ranges/IntProgression.iterator|()
while(R|<local>/<iterator>|.R|SubstitutionOverride<kotlin/collections/IntIterator.hasNext: R|kotlin/Boolean|>|()) {
lval i: R|kotlin/Int| = R|<local>/<iterator>|.R|kotlin/collections/IntIterator.next|()
{
}
}
}
@@ -38,6 +44,9 @@ FILE: Warning.kt
lval <iterator>: R|kotlin/collections/IntIterator| = Int(1).R|kotlin/ranges/until|(Int(1)).R|kotlin/ranges/IntProgression.iterator|()
while(R|<local>/<iterator>|.R|SubstitutionOverride<kotlin/collections/IntIterator.hasNext: R|kotlin/Boolean|>|()) {
lval i: R|kotlin/Int| = R|<local>/<iterator>|.R|kotlin/collections/IntIterator.next|()
{
}
}
}
@@ -7,15 +7,18 @@ FILE: manyLocalVariables.kt
lval <iterator>: R|kotlin/collections/IntIterator| = Int(0).R|kotlin/Int.rangeTo|(Int(5)).R|kotlin/ranges/IntProgression.iterator|()
while(R|<local>/<iterator>|.R|SubstitutionOverride<kotlin/collections/IntIterator.hasNext: R|kotlin/Boolean|>|()) {
lval i: R|kotlin/Int| = R|<local>/<iterator>|.R|kotlin/collections/IntIterator.next|()
when () {
==(R|<local>/a|, Int(2)) -> {
R|<local>/b| = R|<local>/c|
R|<local>/c| = R|<local>/a|
}
else -> {
R|<local>/b| = R|<local>/a|
R|<local>/c| = R|<local>/b|
{
when () {
==(R|<local>/a|, Int(2)) -> {
R|<local>/b| = R|<local>/c|
R|<local>/c| = R|<local>/a|
}
else -> {
R|<local>/b| = R|<local>/a|
R|<local>/c| = R|<local>/b|
}
}
}
}
+6 -3
View File
@@ -12,9 +12,12 @@ FILE: fib.kt
lval <iterator>: R|kotlin/collections/IntIterator| = Int(2).R|kotlin/Int.rangeTo|(R|<local>/n|).R|kotlin/ranges/IntProgression.iterator|()
while(R|<local>/<iterator>|.R|SubstitutionOverride<kotlin/collections/IntIterator.hasNext: R|kotlin/Boolean|>|()) {
lval i: R|kotlin/Int| = R|<local>/<iterator>|.R|kotlin/collections/IntIterator.next|()
lval temp: R|kotlin/Int| = R|<local>/current|
R|<local>/current| = R|<local>/current|.R|kotlin/Int.plus|(R|<local>/prev|)
R|<local>/prev| = R|<local>/temp|
{
lval temp: R|kotlin/Int| = R|<local>/current|
R|<local>/current| = R|<local>/current|.R|kotlin/Int.plus|(R|<local>/prev|)
R|<local>/prev| = R|<local>/temp|
}
}
}
@@ -9,7 +9,10 @@ FILE: nestedExtensionFunctionType.kt
lval <iterator>: R|kotlin/collections/Iterator<@ExtensionFunctionType kotlin/Function1<A, kotlin/Unit>>| = R|<local>/ys|.R|SubstitutionOverride<kotlin/collections/List.iterator: R|kotlin/collections/Iterator<@ExtensionFunctionType kotlin/Function1<A, kotlin/Unit>>|>|()
while(R|<local>/<iterator>|.R|SubstitutionOverride<kotlin/collections/Iterator.hasNext: R|kotlin/Boolean|>|()) {
lval y: R|A.() -> kotlin/Unit| = R|<local>/<iterator>|.R|SubstitutionOverride<kotlin/collections/Iterator.next: R|A.() -> kotlin/Unit|>|()
R|<local>/y|.R|SubstitutionOverride<kotlin/Function1.invoke: R|kotlin/Unit|>|(R|<local>/a|)
{
R|<local>/y|.R|SubstitutionOverride<kotlin/Function1.invoke: R|kotlin/Unit|>|(R|<local>/a|)
}
}
}
@@ -20,7 +23,10 @@ FILE: nestedExtensionFunctionType.kt
lval <iterator>: R|kotlin/collections/Iterator<@ExtensionFunctionType kotlin/Function1<A, kotlin/Unit>>| = R|<local>/zs|.R|SubstitutionOverride<kotlin/Array.iterator: R|kotlin/collections/Iterator<CapturedType(out @ExtensionFunctionType kotlin/Function1<A, kotlin/Unit>)>|>|()
while(R|<local>/<iterator>|.R|SubstitutionOverride<kotlin/collections/Iterator.hasNext: R|kotlin/Boolean|>|()) {
lval z: R|A.() -> kotlin/Unit| = R|<local>/<iterator>|.R|SubstitutionOverride<kotlin/collections/Iterator.next: R|A.() -> kotlin/Unit|>|()
R|<local>/z|.R|SubstitutionOverride<kotlin/Function1.invoke: R|kotlin/Unit|>|(R|<local>/a|)
{
R|<local>/z|.R|SubstitutionOverride<kotlin/Function1.invoke: R|kotlin/Unit|>|(R|<local>/a|)
}
}
}
@@ -14,14 +14,17 @@ FILE: boundSmartcastsInBranches.kt
lval <iterator>: R|kotlin/collections/Iterator<A>| = R|<local>/list|.R|SubstitutionOverride<kotlin/collections/List.iterator: R|kotlin/collections/Iterator<A>|>|()
while(R|<local>/<iterator>|.R|SubstitutionOverride<kotlin/collections/Iterator.hasNext: R|kotlin/Boolean|>|()) {
lval a: R|A| = R|<local>/<iterator>|.R|SubstitutionOverride<kotlin/collections/Iterator.next: R|A|>|()
when () {
==(R|<local>/goodA|, Null(null)) -> {
R|<local>/goodA| = R|<local>/a|
continue@@@[R|<local>/<iterator>|.R|SubstitutionOverride<kotlin/collections/Iterator.hasNext: R|kotlin/Boolean|>|()]
{
when () {
==(R|<local>/goodA|, Null(null)) -> {
R|<local>/goodA| = R|<local>/a|
continue@@@[R|<local>/<iterator>|.R|SubstitutionOverride<kotlin/collections/Iterator.hasNext: R|kotlin/Boolean|>|()]
}
}
R|<local>/goodA|.R|/A.s|
}
R|<local>/goodA|.R|/A.s|
}
}
@@ -184,61 +184,66 @@ digraph smartcastToNothing_kt {
66 [label="Function call: R|<local>/<iterator>|.R|SubstitutionOverride<kotlin/collections/Iterator.next: R|kotlin/Nothing|>|()" style="filled" fillcolor=yellow];
67 [label="Stub" style="filled" fillcolor=gray];
68 [label="Variable declaration: lval result: R|kotlin/Nothing|" style="filled" fillcolor=gray];
69 [label="Access variable R|<local>/result|" style="filled" fillcolor=gray];
70 [label="Stub" style="filled" fillcolor=gray];
71 [label="Assignment: R|<local>/s|" style="filled" fillcolor=gray];
subgraph cluster_21 {
color=blue
72 [label="Enter when" style="filled" fillcolor=gray];
69 [label="Enter block" 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];
subgraph cluster_22 {
color=blue
73 [label="Enter when branch condition " style="filled" fillcolor=gray];
74 [label="Access variable R|<local>/result|" style="filled" fillcolor=gray];
75 [label="Stub" style="filled" fillcolor=gray];
76 [label="Access variable <Unresolved name: b>#" style="filled" fillcolor=gray];
77 [label="Exit when branch condition" style="filled" fillcolor=gray];
73 [label="Enter when" style="filled" fillcolor=gray];
subgraph cluster_23 {
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];
}
79 [label="Synthetic else branch" style="filled" fillcolor=gray];
80 [label="Enter when branch result" style="filled" fillcolor=gray];
subgraph cluster_24 {
color=blue
81 [label="Enter block" style="filled" fillcolor=gray];
82 [label="Jump: break@@@[R|<local>/<iterator>|.R|SubstitutionOverride<kotlin/collections/Iterator.hasNext: R|kotlin/Boolean|>|()] " style="filled" fillcolor=gray];
83 [label="Stub" style="filled" fillcolor=gray];
84 [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];
}
78 [label="Synthetic else branch" style="filled" fillcolor=gray];
79 [label="Enter when branch result" style="filled" fillcolor=gray];
subgraph cluster_23 {
color=blue
80 [label="Enter block" style="filled" fillcolor=gray];
81 [label="Jump: break@@@[R|<local>/<iterator>|.R|SubstitutionOverride<kotlin/collections/Iterator.hasNext: R|kotlin/Boolean|>|()] " style="filled" fillcolor=gray];
82 [label="Stub" style="filled" fillcolor=gray];
83 [label="Exit block" style="filled" fillcolor=gray];
}
84 [label="Exit when branch result" style="filled" fillcolor=gray];
85 [label="Exit when" style="filled" fillcolor=gray];
87 [label="Exit block" style="filled" fillcolor=gray];
}
86 [label="Exit block" style="filled" fillcolor=gray];
88 [label="Exit block" style="filled" fillcolor=gray];
}
87 [label="Exit loop block" style="filled" fillcolor=gray];
89 [label="Exit loop block" style="filled" fillcolor=gray];
}
88 [label="Exit while loop"];
90 [label="Exit while loop"];
}
89 [label="Exit block"];
91 [label="Exit block"];
}
90 [label="Access variable R|<local>/s|"];
91 [label="Enter safe call"];
92 [label="Postponed enter to lambda"];
subgraph cluster_24 {
92 [label="Access variable R|<local>/s|"];
93 [label="Enter safe call"];
94 [label="Postponed enter to lambda"];
subgraph cluster_25 {
color=blue
93 [label="Enter function <anonymous>" style="filled" fillcolor=red];
subgraph cluster_25 {
95 [label="Enter function <anonymous>" style="filled" fillcolor=red];
subgraph cluster_26 {
color=blue
94 [label="Enter block"];
95 [label="Access variable R|<local>/it|"];
96 [label="Access variable R|/A.a|"];
97 [label="Exit block"];
96 [label="Enter block"];
97 [label="Access variable R|<local>/it|"];
98 [label="Access variable R|/A.a|"];
99 [label="Exit block"];
}
98 [label="Exit function <anonymous>" style="filled" fillcolor=red];
100 [label="Exit function <anonymous>" style="filled" fillcolor=red];
}
99 [label="Postponed exit from lambda"];
100 [label="Function call: $subj$.R|kotlin/let|<R|A|, R|kotlin/Int|>(...)" style="filled" fillcolor=yellow];
101 [label="Exit safe call"];
102 [label="Exit block"];
101 [label="Postponed exit from lambda"];
102 [label="Function call: $subj$.R|kotlin/let|<R|A|, R|kotlin/Int|>(...)" style="filled" fillcolor=yellow];
103 [label="Exit safe call"];
104 [label="Exit block"];
}
103 [label="Exit function test_0" style="filled" fillcolor=red];
105 [label="Exit function test_0" style="filled" fillcolor=red];
}
50 -> {51};
51 -> {52};
@@ -252,7 +257,7 @@ digraph smartcastToNothing_kt {
59 -> {60};
60 -> {61};
61 -> {62};
62 -> {63 88};
62 -> {63 90};
63 -> {64};
64 -> {65};
65 -> {66};
@@ -267,26 +272,26 @@ digraph smartcastToNothing_kt {
74 -> {75} [style=dotted];
75 -> {76} [style=dotted];
76 -> {77} [style=dotted];
77 -> {78 79} [style=dotted];
78 -> {85} [style=dotted];
79 -> {80} [style=dotted];
77 -> {78} [style=dotted];
78 -> {79 80} [style=dotted];
79 -> {86} [style=dotted];
80 -> {81} [style=dotted];
81 -> {82 88} [style=dotted];
82 -> {83} [style=dotted];
81 -> {82} [style=dotted];
82 -> {83 90} [style=dotted];
83 -> {84} [style=dotted];
84 -> {85} [style=dotted];
85 -> {86} [style=dotted];
86 -> {87} [style=dotted];
87 -> {59} [color=green style=dotted];
88 -> {89};
89 -> {90};
90 -> {91 101};
87 -> {88} [style=dotted];
88 -> {89} [style=dotted];
89 -> {59} [color=green style=dotted];
90 -> {91};
91 -> {92};
92 -> {93 100};
92 -> {99} [style=dotted];
92 -> {93} [style=dashed];
92 -> {93 103};
93 -> {94};
94 -> {95};
94 -> {95 102};
94 -> {101} [style=dotted];
94 -> {95} [style=dashed];
95 -> {96};
96 -> {97};
97 -> {98};
@@ -295,82 +300,82 @@ digraph smartcastToNothing_kt {
100 -> {101};
101 -> {102};
102 -> {103};
103 -> {104};
104 -> {105};
subgraph cluster_26 {
subgraph cluster_27 {
color=red
104 [label="Enter function test_1" style="filled" fillcolor=red];
subgraph cluster_27 {
106 [label="Enter function test_1" style="filled" fillcolor=red];
subgraph cluster_28 {
color=blue
105 [label="Enter block"];
subgraph cluster_28 {
107 [label="Enter block"];
subgraph cluster_29 {
color=blue
106 [label="Enter when"];
subgraph cluster_29 {
color=blue
107 [label="Enter when branch condition "];
108 [label="Access variable R|<local>/a|"];
109 [label="Type operator: (R|<local>/a| is R|kotlin/Nothing?|)"];
110 [label="Exit when branch condition"];
}
111 [label="Synthetic else branch"];
112 [label="Enter when branch result"];
108 [label="Enter when"];
subgraph cluster_30 {
color=blue
113 [label="Enter block"];
114 [label="Access variable R|<local>/a|"];
115 [label="Smart cast: R|<local>/a|"];
116 [label="Enter safe call"];
117 [label="Access variable R|kotlin/String.length|"];
118 [label="Exit safe call"];
119 [label="Variable declaration: lval b: R|kotlin/Int?|"];
120 [label="Exit block"];
109 [label="Enter when branch condition "];
110 [label="Access variable R|<local>/a|"];
111 [label="Type operator: (R|<local>/a| is R|kotlin/Nothing?|)"];
112 [label="Exit when branch condition"];
}
121 [label="Exit when branch result"];
122 [label="Exit when"];
}
subgraph cluster_31 {
color=blue
123 [label="Enter when"];
subgraph cluster_32 {
113 [label="Synthetic else branch"];
114 [label="Enter when branch result"];
subgraph cluster_31 {
color=blue
124 [label="Enter when branch condition "];
125 [label="Access variable R|<local>/a|"];
126 [label="Type operator: (R|<local>/a| is R|kotlin/Nothing|)"];
127 [label="Exit when branch condition"];
115 [label="Enter block"];
116 [label="Access variable R|<local>/a|"];
117 [label="Smart cast: R|<local>/a|"];
118 [label="Enter safe call"];
119 [label="Access variable R|kotlin/String.length|"];
120 [label="Exit safe call"];
121 [label="Variable declaration: lval b: R|kotlin/Int?|"];
122 [label="Exit block"];
}
128 [label="Synthetic else branch"];
129 [label="Enter when branch result"];
123 [label="Exit when branch result"];
124 [label="Exit when"];
}
subgraph cluster_32 {
color=blue
125 [label="Enter when"];
subgraph cluster_33 {
color=blue
130 [label="Enter block"];
131 [label="Access variable R|<local>/a|"];
132 [label="Smart cast: R|<local>/a|"];
133 [label="Stub" style="filled" fillcolor=gray];
134 [label="Access variable R|kotlin/String.length|" style="filled" fillcolor=gray];
135 [label="Variable declaration: lval b: R|kotlin/Int|" style="filled" fillcolor=gray];
136 [label="Exit block" style="filled" fillcolor=gray];
126 [label="Enter when branch condition "];
127 [label="Access variable R|<local>/a|"];
128 [label="Type operator: (R|<local>/a| is R|kotlin/Nothing|)"];
129 [label="Exit when branch condition"];
}
137 [label="Exit when branch result" style="filled" fillcolor=gray];
138 [label="Exit when"];
130 [label="Synthetic else branch"];
131 [label="Enter when branch result"];
subgraph cluster_34 {
color=blue
132 [label="Enter block"];
133 [label="Access variable R|<local>/a|"];
134 [label="Smart cast: R|<local>/a|"];
135 [label="Stub" style="filled" fillcolor=gray];
136 [label="Access variable R|kotlin/String.length|" style="filled" fillcolor=gray];
137 [label="Variable declaration: lval b: R|kotlin/Int|" style="filled" fillcolor=gray];
138 [label="Exit block" style="filled" fillcolor=gray];
}
139 [label="Exit when branch result" style="filled" fillcolor=gray];
140 [label="Exit when"];
}
139 [label="Exit block"];
141 [label="Exit block"];
}
140 [label="Exit function test_1" style="filled" fillcolor=red];
142 [label="Exit function test_1" style="filled" fillcolor=red];
}
104 -> {105};
105 -> {106};
106 -> {107};
107 -> {108};
108 -> {109};
109 -> {110};
110 -> {111 112};
111 -> {122};
112 -> {113};
113 -> {114};
110 -> {111};
111 -> {112};
112 -> {113 114};
113 -> {124};
114 -> {115};
115 -> {116 118};
115 -> {116};
116 -> {117};
117 -> {118};
117 -> {118 120};
118 -> {119};
119 -> {120};
120 -> {121};
@@ -380,18 +385,20 @@ digraph smartcastToNothing_kt {
124 -> {125};
125 -> {126};
126 -> {127};
127 -> {128 129};
128 -> {138};
129 -> {130};
130 -> {131};
127 -> {128};
128 -> {129};
129 -> {130 131};
130 -> {140};
131 -> {132};
132 -> {133} [style=dotted];
133 -> {134} [style=dotted];
132 -> {133};
133 -> {134};
134 -> {135} [style=dotted];
135 -> {136} [style=dotted];
136 -> {137} [style=dotted];
137 -> {138} [style=dotted];
138 -> {139};
139 -> {140};
138 -> {139} [style=dotted];
139 -> {140} [style=dotted];
140 -> {141};
141 -> {142};
}
@@ -34,11 +34,14 @@ FILE: smartcastToNothing.kt
lval <iterator>: R|kotlin/collections/Iterator<kotlin/Nothing>| = R|<local>/results|.R|SubstitutionOverride<kotlin/collections/List.iterator: R|kotlin/collections/Iterator<kotlin/Nothing>|>|()
while(R|<local>/<iterator>|.R|SubstitutionOverride<kotlin/collections/Iterator.hasNext: R|kotlin/Boolean|>|()) {
lval result: R|kotlin/Nothing| = R|<local>/<iterator>|.R|SubstitutionOverride<kotlin/collections/Iterator.next: R|kotlin/Nothing|>|()
R|<local>/s| = R|<local>/result|
when () {
R|<local>/result|.<Unresolved name: b># -> {
break@@@[R|<local>/<iterator>|.R|SubstitutionOverride<kotlin/collections/Iterator.hasNext: R|kotlin/Boolean|>|()]
{
R|<local>/s| = R|<local>/result|
when () {
R|<local>/result|.<Unresolved name: b># -> {
break@@@[R|<local>/<iterator>|.R|SubstitutionOverride<kotlin/collections/Iterator.hasNext: R|kotlin/Boolean|>|()]
}
}
}
}
@@ -13,7 +13,10 @@ FILE: varargInPrimaryConstructor.kt
lval <iterator>: R|kotlin/collections/Iterator<kotlin/String>| = R|<local>/foo|.R|/Foo.strings|.R|SubstitutionOverride<kotlin/Array.iterator: R|kotlin/collections/Iterator<CapturedType(out kotlin/String)>|>|()
while(R|<local>/<iterator>|.R|SubstitutionOverride<kotlin/collections/Iterator.hasNext: R|kotlin/Boolean|>|()) {
lval s: R|kotlin/String| = R|<local>/<iterator>|.R|SubstitutionOverride<kotlin/collections/Iterator.next: R|kotlin/String|>|()
R|<local>/s|.R|kotlin/String.length|
{
R|<local>/s|.R|kotlin/String.length|
}
}
}
@@ -24,7 +27,10 @@ FILE: varargInPrimaryConstructor.kt
lval <iterator>: R|kotlin/collections/Iterator<kotlin/String>| = R|<local>/strings|.R|SubstitutionOverride<kotlin/Array.iterator: R|kotlin/collections/Iterator<CapturedType(out kotlin/String)>|>|()
while(R|<local>/<iterator>|.R|SubstitutionOverride<kotlin/collections/Iterator.hasNext: R|kotlin/Boolean|>|()) {
lval s: R|kotlin/String| = R|<local>/<iterator>|.R|SubstitutionOverride<kotlin/collections/Iterator.next: R|kotlin/String|>|()
R|<local>/s|.R|kotlin/String.length|
{
R|<local>/s|.R|kotlin/String.length|
}
}
}
@@ -24,6 +24,9 @@ FILE: components.kt
lval <destruct>: R|D| = R|<local>/<iterator>|.R|SubstitutionOverride<kotlin/collections/Iterator.next: R|D|>|()
lval x: R|kotlin/Int| = R|<local>/<destruct>|.R|/D.component1|()
lval y: R|kotlin/String| = R|<local>/<destruct>|.R|/D.component2|()
{
}
}
}
@@ -167,49 +167,54 @@ digraph flow_kt {
74 [label="Access variable R|<local>/<iterator>|"];
75 [label="Function call: R|<local>/<iterator>|.R|kotlin/collections/IntIterator.next|()" style="filled" fillcolor=yellow];
76 [label="Variable declaration: lval i: R|kotlin/Int|"];
77 [label="Access variable R|<local>/x|"];
78 [label="Function call: R|<local>/x|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()" style="filled" fillcolor=yellow];
79 [label="Exit block"];
subgraph cluster_24 {
color=blue
77 [label="Enter block"];
78 [label="Access variable R|<local>/x|"];
79 [label="Function call: R|<local>/x|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()" style="filled" fillcolor=yellow];
80 [label="Exit block"];
}
81 [label="Exit block"];
}
80 [label="Exit loop block"];
82 [label="Exit loop block"];
}
81 [label="Exit while loop"];
83 [label="Exit while loop"];
}
82 [label="Exit block"];
84 [label="Exit block"];
}
83 [label="Access variable R|<local>/y|"];
84 [label="Function call: R|<local>/y|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()" style="filled" fillcolor=yellow];
85 [label="Exit block"];
85 [label="Access variable R|<local>/y|"];
86 [label="Function call: R|<local>/y|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()" style="filled" fillcolor=yellow];
87 [label="Exit block"];
}
86 [label="Exit when branch result"];
87 [label="Exit when"];
88 [label="Exit when branch result"];
89 [label="Exit when"];
}
subgraph cluster_24 {
subgraph cluster_25 {
color=blue
88 [label="Enter do-while loop"];
subgraph cluster_25 {
90 [label="Enter do-while loop"];
subgraph cluster_26 {
color=blue
89 [label="Enter loop block"];
subgraph cluster_26 {
91 [label="Enter loop block"];
subgraph cluster_27 {
color=blue
90 [label="Enter block"];
91 [label="Access variable R|<local>/z|"];
92 [label="Function call: R|/bar|(...)" style="filled" fillcolor=yellow];
93 [label="Exit block"];
92 [label="Enter block"];
93 [label="Access variable R|<local>/z|"];
94 [label="Function call: R|/bar|(...)" style="filled" fillcolor=yellow];
95 [label="Exit block"];
}
94 [label="Exit loop block"];
96 [label="Exit loop block"];
}
subgraph cluster_27 {
subgraph cluster_28 {
color=blue
95 [label="Enter loop condition"];
96 [label="Const: Boolean(true)"];
97 [label="Exit loop condition"];
97 [label="Enter loop condition"];
98 [label="Const: Boolean(true)"];
99 [label="Exit loop condition"];
}
98 [label="Exit do-while loop" style="filled" fillcolor=gray];
100 [label="Exit do-while loop" style="filled" fillcolor=gray];
}
99 [label="Exit block" style="filled" fillcolor=gray];
101 [label="Exit block" style="filled" fillcolor=gray];
}
100 [label="Exit function foo" style="filled" fillcolor=red];
102 [label="Exit function foo" style="filled" fillcolor=red];
}
22 -> {23};
23 -> {24};
@@ -235,7 +240,7 @@ digraph flow_kt {
43 -> {44};
44 -> {45};
45 -> {46};
46 -> {100};
46 -> {102};
46 -> {47} [style=dotted];
47 -> {48} [style=dotted];
48 -> {49} [style=dotted];
@@ -248,7 +253,7 @@ digraph flow_kt {
55 -> {56};
56 -> {57};
57 -> {58};
58 -> {87};
58 -> {89};
59 -> {60};
60 -> {61};
61 -> {62};
@@ -261,7 +266,7 @@ digraph flow_kt {
68 -> {69};
69 -> {70};
70 -> {71};
71 -> {72 81};
71 -> {72 83};
72 -> {73};
73 -> {74};
74 -> {75};
@@ -270,9 +275,9 @@ digraph flow_kt {
77 -> {78};
78 -> {79};
79 -> {80};
80 -> {68} [color=green style=dashed];
80 -> {81};
81 -> {82};
82 -> {83};
82 -> {68} [color=green style=dashed];
83 -> {84};
84 -> {85};
85 -> {86};
@@ -287,9 +292,11 @@ digraph flow_kt {
94 -> {95};
95 -> {96};
96 -> {97};
97 -> {89} [color=green style=dashed];
97 -> {98} [style=dotted];
98 -> {99} [style=dotted];
97 -> {98};
98 -> {99};
99 -> {91} [color=green style=dashed];
99 -> {100} [style=dotted];
100 -> {101} [style=dotted];
101 -> {102} [style=dotted];
}
@@ -44,7 +44,10 @@ FILE: flow.kt
lval <iterator>: R|kotlin/collections/IntIterator| = Int(0).R|kotlin/Int.rangeTo|(Int(0)).R|kotlin/ranges/IntProgression.iterator|()
while(R|<local>/<iterator>|.R|SubstitutionOverride<kotlin/collections/IntIterator.hasNext: R|kotlin/Boolean|>|()) {
lval i: R|kotlin/Int| = R|<local>/<iterator>|.R|kotlin/collections/IntIterator.next|()
R|<local>/x|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()
{
R|<local>/x|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()
}
}
}
@@ -175,6 +175,9 @@ FILE: forLoopChecker.kt
lval <iterator>: <ERROR TYPE REF: Unresolved name: iterator> = R|<local>/notRange1|.<Unresolved name: iterator>#()
while(R|<local>/<iterator>|.<Unresolved name: hasNext>#()) {
lval i: <ERROR TYPE REF: Unresolved name: next> = R|<local>/<iterator>|.<Unresolved name: next>#()
{
}
}
}
@@ -183,6 +186,9 @@ FILE: forLoopChecker.kt
lval <iterator>: R|kotlin/Unit| = R|<local>/notRange2|.R|/NotRange2.iterator|()
while(R|<local>/<iterator>|.<Unresolved name: hasNext>#()) {
lval i: <ERROR TYPE REF: Unresolved name: next> = R|<local>/<iterator>|.<Unresolved name: next>#()
{
}
}
}
@@ -191,6 +197,9 @@ FILE: forLoopChecker.kt
lval <iterator>: R|ImproperIterator1| = R|<local>/notRange3|.R|/NotRange3.iterator|()
while(R|<local>/<iterator>|.R|/ImproperIterator1.hasNext|()) {
lval i: <ERROR TYPE REF: Unresolved name: next> = R|<local>/<iterator>|.<Unresolved name: next>#()
{
}
}
}
@@ -199,6 +208,9 @@ FILE: forLoopChecker.kt
lval <iterator>: R|ImproperIterator2| = R|<local>/notRange4|.R|/NotRange4.iterator|()
while(R|<local>/<iterator>|.<Unresolved name: hasNext>#()) {
lval i: R|kotlin/Boolean| = R|<local>/<iterator>|.R|/ImproperIterator2.next|()
{
}
}
}
@@ -207,6 +219,9 @@ FILE: forLoopChecker.kt
lval <iterator>: R|ImproperIterator3| = R|<local>/notRange5|.R|/NotRange5.iterator|()
while(R|<local>/<iterator>|.R|/ImproperIterator3.hasNext|()) {
lval i: R|kotlin/Int| = R|<local>/<iterator>|.R|/ImproperIterator3.next|()
{
}
}
}
@@ -215,6 +230,9 @@ FILE: forLoopChecker.kt
lval <iterator>: R|AmbiguousHasNextIterator| = R|<local>/notRange6|.R|/NotRange6.iterator|()
while(R|<local>/<iterator>|.R|/AmbiguousHasNextIterator.hasNext|()) {
lval i: R|kotlin/Int| = R|<local>/<iterator>|.R|/AmbiguousHasNextIterator.next|()
{
}
}
}
@@ -223,6 +241,9 @@ FILE: forLoopChecker.kt
lval <iterator>: R|ImproperIterator3| = R|<local>/notRange7|.R|/NotRange7.iterator|()
while(R|<local>/<iterator>|.R|/ImproperIterator3.hasNext|()) {
lval i: R|kotlin/Int| = R|<local>/<iterator>|.R|/ImproperIterator3.next|()
{
}
}
}
@@ -231,6 +252,9 @@ FILE: forLoopChecker.kt
lval <iterator>: R|ImproperIterator5| = R|<local>/notRange8|.R|/NotRange8.iterator|()
while(R|<local>/<iterator>|.<Unresolved name: hasNext>#()) {
lval i: R|kotlin/Int| = R|<local>/<iterator>|.R|/ImproperIterator5.next|()
{
}
}
}
@@ -239,6 +263,9 @@ FILE: forLoopChecker.kt
lval <iterator>: R|ImproperIterator6| = R|<local>/notRange9|.R|/NotRange9.iterator|()
while(R|<local>/<iterator>|.R|/ImproperIterator6.hasNext|()) {
lval i: R|kotlin/Int| = R|<local>/<iterator>|.R|/ImproperIterator6.next|()
{
}
}
}
@@ -247,6 +274,9 @@ FILE: forLoopChecker.kt
lval <iterator>: R|GoodIterator| = R|<local>/range0|.R|/Range0.iterator|()
while(R|<local>/<iterator>|.R|/GoodIterator.hasNext|()) {
lval i: R|kotlin/Int| = R|<local>/<iterator>|.R|/GoodIterator.next|()
{
}
}
}
@@ -255,6 +285,9 @@ FILE: forLoopChecker.kt
lval <iterator>: R|kotlin/collections/Iterator<kotlin/Int>| = R|<local>/range1|.R|/Range1.iterator|()
while(R|<local>/<iterator>|.R|SubstitutionOverride<kotlin/collections/Iterator.hasNext: R|kotlin/Boolean|>|()) {
lval i: R|kotlin/Int| = R|<local>/<iterator>|.R|SubstitutionOverride<kotlin/collections/Iterator.next: R|kotlin/Int|>|()
{
}
}
}
@@ -48,10 +48,13 @@ FILE: DeepCopyIrTree.kt
lval <destruct>: R|kotlin/Pair<IrTypeParameter, IrTypeParameter>| = R|<local>/<iterator>|.R|SubstitutionOverride<kotlin/collections/Iterator.next: R|kotlin/Pair<IrTypeParameter, IrTypeParameter>|>|()
lval thisTypeParameter: R|IrTypeParameter| = R|<local>/<destruct>|.R|SubstitutionOverride<kotlin/Pair.component1: R|IrTypeParameter|>|()
lval otherTypeParameter: R|IrTypeParameter| = R|<local>/<destruct>|.R|SubstitutionOverride<kotlin/Pair.component2: R|IrTypeParameter|>|()
R|<local>/otherTypeParameter|.R|/IrTypeParameter.superTypes|.R|kotlin/collections/mapTo|<R|IrType|, R|IrType|, R|kotlin/collections/MutableList<IrType>|>(R|<local>/thisTypeParameter|.R|/IrTypeParameter.superTypes|, <L> = mapTo@fun <anonymous>(it: R|IrType|): R|IrType| <inline=Inline, kind=UNKNOWN> {
^ this@R|/DeepCopyIrTreeWithSymbols|.R|/DeepCopyIrTreeWithSymbols.typeRemapper|.R|/TypeRemapper.remapType|(R|<local>/it|)
{
R|<local>/otherTypeParameter|.R|/IrTypeParameter.superTypes|.R|kotlin/collections/mapTo|<R|IrType|, R|IrType|, R|kotlin/collections/MutableList<IrType>|>(R|<local>/thisTypeParameter|.R|/IrTypeParameter.superTypes|, <L> = mapTo@fun <anonymous>(it: R|IrType|): R|IrType| <inline=Inline, kind=UNKNOWN> {
^ this@R|/DeepCopyIrTreeWithSymbols|.R|/DeepCopyIrTreeWithSymbols.typeRemapper|.R|/TypeRemapper.remapType|(R|<local>/it|)
}
)
}
)
}
}
@@ -51,10 +51,13 @@ FILE: valueOfOrNull.kt
lval <iterator>: R|kotlin/collections/Iterator<E>| = R|kotlin/enumValues|<R|E|>().R|SubstitutionOverride<kotlin/Array.iterator: R|kotlin/collections/Iterator<E>|>|()
while(R|<local>/<iterator>|.R|SubstitutionOverride<kotlin/collections/Iterator.hasNext: R|kotlin/Boolean|>|()) {
lval enumValue: R|E| = R|<local>/<iterator>|.R|SubstitutionOverride<kotlin/collections/Iterator.next: R|E|>|()
when () {
==(R|<local>/enumValue|.R|SubstitutionOverride<kotlin/Enum.name: R|kotlin/String|>|, R|<local>/value|) -> {
^valueOfOrNull R|<local>/enumValue|
{
when () {
==(R|<local>/enumValue|.R|SubstitutionOverride<kotlin/Enum.name: R|kotlin/String|>|, R|<local>/value|) -> {
^valueOfOrNull R|<local>/enumValue|
}
}
}
}
@@ -1132,10 +1132,8 @@ class ExpressionsConverter(
// So, prepare the loop target after building the condition.
target = prepareTarget(forLoop)
}.configure(target) {
// NB: just body.toFirBlock() isn't acceptable here because we need to add some statements
buildBlock block@{
source = blockNode?.toFirSourceElement()
statements += convertLoopBody(blockNode).statements
val valueParameter = parameter ?: return@block
val multiDeclaration = valueParameter.destructuringDeclaration
val firLoopParameter = generateTemporaryVariable(
@@ -1159,10 +1157,11 @@ class ExpressionsConverter(
firLoopParameter,
tmpVariable = true
)
statements.addAll(0, destructuringBlock.statements)
statements.addAll(destructuringBlock.statements)
} else {
statements.add(0, firLoopParameter)
statements.add(firLoopParameter)
}
statements += convertLoopBody(blockNode)
}
}
}
@@ -2326,14 +2326,8 @@ open class RawFirBuilder(
// So, prepare the loop target after building the condition.
target = prepareTarget(expression)
}.configure(target) {
// NB: just body.toFirBlock() isn't acceptable here because we need to add some statements
val blockBuilder = when (val body = expression.body) {
is KtBlockExpression -> configureBlockWithoutBuilding(body)
null -> FirBlockBuilder()
else -> FirBlockBuilder().apply {
source = body.toFirSourceElement(KtFakeSourceElementKind.DesugaredForLoop)
statements += body.toFirStatement()
}
val blockBuilder = FirBlockBuilder().apply {
source = expression.toFirSourceElement(KtFakeSourceElementKind.DesugaredForLoop)
}
if (ktParameter != null) {
val multiDeclaration = ktParameter.destructuringDeclaration
@@ -2358,11 +2352,12 @@ open class RawFirBuilder(
tmpVariable = true,
extractAnnotationsTo = { extractAnnotationsTo(it) },
) { toFirOrImplicitType() }
blockBuilder.statements.addAll(0, destructuringBlock.statements)
blockBuilder.statements.addAll(destructuringBlock.statements)
} else {
blockBuilder.statements.add(0, firLoopParameter)
blockBuilder.statements.add(firLoopParameter)
}
}
blockBuilder.statements.add(expression.body.toFirBlock())
blockBuilder.build()
}
}
@@ -4,7 +4,10 @@ FILE: for.kt
lval <iterator>: <implicit> = IntegerLiteral(1).rangeTo#(IntegerLiteral(10)).iterator#()
while(R|<local>/<iterator>|.hasNext#()) {
lval i: <implicit> = R|<local>/<iterator>|.next#()
println#(i#)
{
println#(i#)
}
}
}
@@ -16,13 +19,16 @@ FILE: for.kt
lval <iterator>: <implicit> = IntegerLiteral(1).rangeTo#(IntegerLiteral(10)).iterator#()
label@while(R|<local>/<iterator>|.hasNext#()) {
lval i: <implicit> = R|<local>/<iterator>|.next#()
when () {
==(i#, IntegerLiteral(5)) -> {
continue@@@[R|<local>/<iterator>|.hasNext#()]
{
when () {
==(i#, IntegerLiteral(5)) -> {
continue@@@[R|<local>/<iterator>|.hasNext#()]
}
}
println#(i#)
}
println#(i#)
}
}
@@ -34,7 +40,10 @@ FILE: for.kt
lval <iterator>: <implicit> = list#.subList#(IntegerLiteral(0), IntegerLiteral(10)).iterator#()
while(R|<local>/<iterator>|.hasNext#()) {
lval element: <implicit> = R|<local>/<iterator>|.next#()
println#(element#)
{
println#(element#)
}
}
}
@@ -43,7 +52,10 @@ FILE: for.kt
lval <iterator>: <implicit> = list#.subList#(IntegerLiteral(10), IntegerLiteral(20)).iterator#()
while(R|<local>/<iterator>|.hasNext#()) {
lval element: <implicit> = R|<local>/<iterator>|.next#()
println#(element#)
{
println#(element#)
}
}
}
@@ -74,7 +86,10 @@ FILE: for.kt
lval <destruct>: <implicit> = R|<local>/<iterator>|.next#()
lval x: <implicit> = R|<local>/<destruct>|.component1#()
lval y: <implicit> = R|<local>/<destruct>|.component2#()
println#(<strcat>(String(x = ), x#, String( y = ), y#))
{
println#(<strcat>(String(x = ), x#, String( y = ), y#))
}
}
}
@@ -85,7 +100,10 @@ FILE: for.kt
lval <iterator>: <implicit> = list#.iterator#()
while(R|<local>/<iterator>|.hasNext#()) {
lval s: Some = R|<local>/<iterator>|.next#()
println#(s#)
{
println#(s#)
}
}
}
@@ -1,3 +1,4 @@
// FIR_DUMP
// ISSUE: KT-54405
class A {
@@ -5,7 +6,7 @@ class A {
operator fun component2() = ""
}
fun test(b: Boolean) {
fun testRedeclaration(b: Boolean) {
val <!REDECLARATION!>y<!> = 1
val <!REDECLARATION!>y<!> = 2
val <!REDECLARATION!>`_`<!> = 3
@@ -14,15 +15,16 @@ fun test(b: Boolean) {
var <!REDECLARATION!>a<!> = 10
var <!REDECLARATION!>a<!> = 11
}
}
fun testNoRedeclaration(list: List<Int>, b: Boolean) {
for (el in list) {
val el = 42
}
if (b) {
val z = 3
val <!REDECLARATION!>x<!> = 5
val <!REDECLARATION!>x<!> = 6
} else {
val z = 4
}
}
fun test2() {
val (`_`, _) = A()
}
@@ -0,0 +1,51 @@
FILE: RedeclaredValsAndVars.fir.kt
public final class A : R|kotlin/Any| {
public constructor(): R|A| {
super<R|kotlin/Any|>()
}
public final operator fun component1(): R|kotlin/Int| {
^component1 Int(1)
}
public final operator fun component2(): R|kotlin/String| {
^component2 String()
}
}
public final fun testRedeclaration(b: R|kotlin/Boolean|): R|kotlin/Unit| {
lval y: R|kotlin/Int| = Int(1)
lval y: R|kotlin/Int| = Int(2)
lval _: R|kotlin/Int| = Int(3)
lval _: R|kotlin/Int| = Int(4)
fun <anonymous>(): R|kotlin/Unit| <inline=Unknown> {
lvar a: R|kotlin/Int| = Int(10)
lvar a: R|kotlin/Int| = Int(11)
}
}
public final fun testNoRedeclaration(list: R|kotlin/collections/List<kotlin/Int>|, b: R|kotlin/Boolean|): R|kotlin/Unit| {
{
lval <iterator>: R|kotlin/collections/Iterator<kotlin/Int>| = R|<local>/list|.R|SubstitutionOverride<kotlin/collections/List.iterator: R|kotlin/collections/Iterator<kotlin/Int>|>|()
while(R|<local>/<iterator>|.R|SubstitutionOverride<kotlin/collections/Iterator.hasNext: R|kotlin/Boolean|>|()) {
lval el: R|kotlin/Int| = R|<local>/<iterator>|.R|SubstitutionOverride<kotlin/collections/Iterator.next: R|kotlin/Int|>|()
{
lval el: R|kotlin/Int| = Int(42)
}
}
}
when () {
R|<local>/b| -> {
lval z: R|kotlin/Int| = Int(3)
}
else -> {
lval z: R|kotlin/Int| = Int(4)
}
}
lval <destruct>: R|A| = R|/A.A|()
lval _: R|kotlin/Int| = R|<local>/<destruct>|.R|/A.component1|()
}
@@ -1,3 +1,4 @@
// FIR_DUMP
// ISSUE: KT-54405
class A {
@@ -5,7 +6,7 @@ class A {
operator fun component2() = ""
}
fun test(b: Boolean) {
fun testRedeclaration(b: Boolean) {
val <!REDECLARATION!>y<!> = 1
val <!NAME_SHADOWING, REDECLARATION!>y<!> = 2
val <!REDECLARATION!>`_`<!> = 3
@@ -14,15 +15,16 @@ fun test(b: Boolean) {
var <!REDECLARATION!>a<!> = 10
var <!NAME_SHADOWING, REDECLARATION!>a<!> = 11
}
}
fun testNoRedeclaration(list: List<Int>, b: Boolean) {
for (el in list) {
val <!NAME_SHADOWING!>el<!> = 42
}
if (b) {
val z = 3
val <!REDECLARATION!>x<!> = 5
val <!NAME_SHADOWING, REDECLARATION!>x<!> = 6
} else {
val z = 4
}
}
fun test2() {
val (`_`, _) = A()
}
@@ -1,7 +1,7 @@
package
public fun test(/*0*/ b: kotlin.Boolean): kotlin.Unit
public fun test2(): kotlin.Unit
public fun testNoRedeclaration(/*0*/ list: kotlin.collections.List<kotlin.Int>, /*1*/ b: kotlin.Boolean): kotlin.Unit
public fun testRedeclaration(/*0*/ b: kotlin.Boolean): kotlin.Unit
public final class A {
public constructor A()