[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: FIR element rendered:
while(R|<local>/<iterator>|.R|SubstitutionOverride<kotlin/collections/IntIterator.hasNext: R|kotlin/Boolean|>|()) { 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|() 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?|"]; 68 [label="Variable declaration: lval element: R|kotlin/Any?|"];
subgraph cluster_23 { subgraph cluster_23 {
color=blue color=blue
69 [label="Enter when"]; 69 [label="Enter block"];
subgraph cluster_24 { subgraph cluster_24 {
color=blue color=blue
70 [label="Enter when branch condition "]; 70 [label="Enter when"];
71 [label="Access variable R|<local>/element|"]; subgraph cluster_25 {
72 [label="Type operator: (R|<local>/element| is R|T|)"]; color=blue
73 [label="Exit when branch condition"]; 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"]; 85 [label="Exit block"];
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"];
} }
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)"]; 90 [label="Const: Null(null)"];
89 [label="Jump: ^firstIsInstanceOrNull Null(null)"]; 91 [label="Jump: ^firstIsInstanceOrNull Null(null)"];
90 [label="Stub" style="filled" fillcolor=gray]; 92 [label="Stub" style="filled" fillcolor=gray];
91 [label="Exit block" 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}; 53 -> {54};
54 -> {55}; 54 -> {55};
@@ -255,7 +260,7 @@ digraph complex_kt {
60 -> {61}; 60 -> {61};
61 -> {62}; 61 -> {62};
62 -> {63}; 62 -> {63};
63 -> {64 86}; 63 -> {64 88};
64 -> {65}; 64 -> {65};
65 -> {66}; 65 -> {66};
66 -> {67}; 66 -> {67};
@@ -265,26 +270,28 @@ digraph complex_kt {
70 -> {71}; 70 -> {71};
71 -> {72}; 71 -> {72};
72 -> {73}; 72 -> {73};
73 -> {74 75}; 73 -> {74};
74 -> {83}; 74 -> {75 76};
75 -> {76}; 75 -> {84};
76 -> {77}; 76 -> {77};
77 -> {78}; 77 -> {78};
78 -> {79}; 78 -> {79};
79 -> {92}; 79 -> {80};
79 -> {80} [style=dotted]; 80 -> {94};
80 -> {81} [style=dotted]; 80 -> {81} [style=dotted];
81 -> {82} [style=dotted]; 81 -> {82} [style=dotted];
82 -> {83} [style=dotted]; 82 -> {83} [style=dotted];
83 -> {84}; 83 -> {84} [style=dotted];
84 -> {85}; 84 -> {85};
85 -> {60} [color=green style=dashed]; 85 -> {86};
86 -> {87}; 86 -> {87};
87 -> {88}; 87 -> {60} [color=green style=dashed];
88 -> {89}; 88 -> {89};
89 -> {92}; 89 -> {90};
89 -> {90} [style=dotted]; 90 -> {91};
90 -> {91} [style=dotted]; 91 -> {94};
91 -> {92} [style=dotted]; 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(*)>|>|() 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|>|()) { 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?|>|() lval element: R|kotlin/Any?| = R|<local>/<iterator>|.R|SubstitutionOverride<kotlin/collections/Iterator.next: R|kotlin/Any?|>|()
when () { {
(R|<local>/element| is R|T|) -> { when () {
^firstIsInstanceOrNull R|<local>/element| (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>|"]; 51 [label="Access variable R|<local>/<iterator>|"];
52 [label="Function call: R|<local>/<iterator>|.R|kotlin/collections/IntIterator.next|()" style="filled" fillcolor=yellow]; 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|"]; 53 [label="Variable declaration: lval i: R|kotlin/Int|"];
54 [label="Access variable R|<local>/x|"]; subgraph cluster_19 {
55 [label="Type operator: (R|<local>/x| is R|kotlin/String|)"]; color=blue
56 [label="Variable declaration: lval y: R|kotlin/Boolean|"]; 54 [label="Enter block"];
57 [label="Exit 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|"]; 63 [label="Access variable R|<local>/x|"];
62 [label="Type operator: (R|<local>/x| is R|kotlin/String|)"]; 64 [label="Type operator: (R|<local>/x| is R|kotlin/String|)"];
63 [label="Exit block"]; 65 [label="Exit block"];
} }
64 [label="Exit function testFor" style="filled" fillcolor=red]; 66 [label="Exit function testFor" style="filled" fillcolor=red];
} }
36 -> {37}; 36 -> {37};
37 -> {38}; 37 -> {38};
@@ -174,7 +179,7 @@ digraph loops_kt {
45 -> {46}; 45 -> {46};
46 -> {47}; 46 -> {47};
47 -> {48}; 47 -> {48};
48 -> {49 59}; 48 -> {49 61};
49 -> {50}; 49 -> {50};
50 -> {51}; 50 -> {51};
51 -> {52}; 51 -> {52};
@@ -184,227 +189,227 @@ digraph loops_kt {
55 -> {56}; 55 -> {56};
56 -> {57}; 56 -> {57};
57 -> {58}; 57 -> {58};
58 -> {45} [color=green style=dashed]; 58 -> {59};
59 -> {60}; 59 -> {60};
60 -> {61}; 60 -> {45} [color=green style=dashed];
61 -> {62}; 61 -> {62};
62 -> {63}; 62 -> {63};
63 -> {64}; 63 -> {64};
64 -> {65};
65 -> {66};
subgraph cluster_19 { subgraph cluster_20 {
color=red color=red
65 [label="Enter function testWhileTrue" style="filled" fillcolor=red]; 67 [label="Enter function testWhileTrue" style="filled" fillcolor=red];
subgraph cluster_20 { subgraph cluster_21 {
color=blue color=blue
66 [label="Enter block"]; 68 [label="Enter block"];
subgraph cluster_21 { subgraph cluster_22 {
color=blue color=blue
67 [label="Enter while loop"]; 69 [label="Enter while loop"];
subgraph cluster_22 {
color=blue
68 [label="Enter loop condition"];
69 [label="Const: Boolean(true)"];
70 [label="Exit loop condition"];
}
subgraph cluster_23 { subgraph cluster_23 {
color=blue color=blue
71 [label="Enter loop block"]; 70 [label="Enter loop condition"];
subgraph cluster_24 { 71 [label="Const: Boolean(true)"];
color=blue 72 [label="Exit loop condition"];
72 [label="Enter block"];
73 [label="Const: Int(1)"];
74 [label="Exit block"];
}
75 [label="Exit loop block"];
} }
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]; 79 [label="Const: Int(1)" style="filled" fillcolor=gray];
78 [label="Exit block" 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}; 67 -> {68};
68 -> {69}; 68 -> {69};
69 -> {70}; 69 -> {70};
70 -> {71}; 70 -> {71};
70 -> {76} [style=dotted];
71 -> {72}; 71 -> {72};
72 -> {73}; 72 -> {73};
72 -> {78} [style=dotted];
73 -> {74}; 73 -> {74};
74 -> {75}; 74 -> {75};
75 -> {68} [color=green style=dashed]; 75 -> {76};
76 -> {77} [style=dotted]; 76 -> {77};
77 -> {78} [style=dotted]; 77 -> {70} [color=green style=dashed];
78 -> {79} [style=dotted]; 78 -> {79} [style=dotted];
79 -> {80} [style=dotted];
80 -> {81} [style=dotted];
subgraph cluster_25 { subgraph cluster_26 {
color=red color=red
80 [label="Enter function testWhileTrueWithBreak" style="filled" fillcolor=red]; 82 [label="Enter function testWhileTrueWithBreak" style="filled" fillcolor=red];
subgraph cluster_26 { subgraph cluster_27 {
color=blue color=blue
81 [label="Enter block"]; 83 [label="Enter block"];
subgraph cluster_27 { subgraph cluster_28 {
color=blue color=blue
82 [label="Enter while loop"]; 84 [label="Enter while loop"];
subgraph cluster_28 {
color=blue
83 [label="Enter loop condition"];
84 [label="Const: Boolean(true)"];
85 [label="Exit loop condition"];
}
subgraph cluster_29 { subgraph cluster_29 {
color=blue color=blue
86 [label="Enter loop block"]; 85 [label="Enter loop condition"];
subgraph cluster_30 { 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 color=blue
87 [label="Enter block"]; 89 [label="Enter block"];
subgraph cluster_31 { subgraph cluster_32 {
color=blue color=blue
88 [label="Enter when"]; 90 [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"];
subgraph cluster_33 { subgraph cluster_33 {
color=blue color=blue
94 [label="Enter block"]; 91 [label="Enter when branch condition "];
95 [label="Jump: break@@@[Boolean(true)] "]; 92 [label="Access variable R|<local>/b|"];
96 [label="Stub" style="filled" fillcolor=gray]; 93 [label="Exit when branch condition"];
97 [label="Exit block" style="filled" fillcolor=gray];
} }
98 [label="Exit when branch result" style="filled" fillcolor=gray]; 94 [label="Synthetic else branch"];
99 [label="Exit when"]; 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)"]; 105 [label="Const: Int(1)"];
104 [label="Exit block"]; 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}; 82 -> {83};
83 -> {84}; 83 -> {84};
84 -> {85}; 84 -> {85};
85 -> {86}; 85 -> {86};
85 -> {102} [style=dotted];
86 -> {87}; 86 -> {87};
87 -> {88}; 87 -> {88};
87 -> {104} [style=dotted];
88 -> {89}; 88 -> {89};
89 -> {90}; 89 -> {90};
90 -> {91}; 90 -> {91};
91 -> {92 93}; 91 -> {92};
92 -> {99}; 92 -> {93};
93 -> {94}; 93 -> {94 95};
94 -> {95}; 94 -> {101};
95 -> {102}; 95 -> {96};
95 -> {96} [style=dotted]; 96 -> {97};
96 -> {97} [style=dotted]; 97 -> {104};
97 -> {98} [style=dotted]; 97 -> {98} [style=dotted];
98 -> {99} [style=dotted]; 98 -> {99} [style=dotted];
99 -> {100}; 99 -> {100} [style=dotted];
100 -> {101}; 100 -> {101} [style=dotted];
101 -> {83} [color=green style=dashed]; 101 -> {102};
102 -> {103}; 102 -> {103};
103 -> {104}; 103 -> {85} [color=green style=dashed];
104 -> {105}; 104 -> {105};
105 -> {106};
106 -> {107};
subgraph cluster_34 { subgraph cluster_35 {
color=red color=red
106 [label="Enter function testWhileFalse" style="filled" fillcolor=red]; 108 [label="Enter function testWhileFalse" style="filled" fillcolor=red];
subgraph cluster_35 { subgraph cluster_36 {
color=blue color=blue
107 [label="Enter block"]; 109 [label="Enter block"];
subgraph cluster_36 { subgraph cluster_37 {
color=blue color=blue
108 [label="Enter while loop"]; 110 [label="Enter while loop"];
subgraph cluster_37 {
color=blue
109 [label="Enter loop condition"];
110 [label="Const: Boolean(false)"];
111 [label="Exit loop condition"];
}
subgraph cluster_38 { subgraph cluster_38 {
color=blue color=blue
112 [label="Enter loop block" style="filled" fillcolor=gray]; 111 [label="Enter loop condition"];
subgraph cluster_39 { 112 [label="Const: Boolean(false)"];
color=blue 113 [label="Exit loop condition"];
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];
} }
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)"]; 120 [label="Const: Int(1)"];
119 [label="Exit block"]; 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}; 108 -> {109};
109 -> {110}; 109 -> {110};
110 -> {111}; 110 -> {111};
111 -> {117}; 111 -> {112};
111 -> {112} [style=dotted]; 112 -> {113};
112 -> {113} [style=dotted]; 113 -> {119};
113 -> {114} [style=dotted]; 113 -> {114} [style=dotted];
114 -> {115} [style=dotted]; 114 -> {115} [style=dotted];
115 -> {116} [style=dotted]; 115 -> {116} [style=dotted];
116 -> {109} [color=green style=dotted]; 116 -> {117} [style=dotted];
117 -> {118}; 117 -> {118} [style=dotted];
118 -> {119}; 118 -> {111} [color=green style=dotted];
119 -> {120}; 119 -> {120};
120 -> {121};
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];
}
121 -> {122}; 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}; 123 -> {124};
124 -> {125}; 124 -> {125};
125 -> {126}; 125 -> {126};
@@ -413,128 +418,128 @@ digraph loops_kt {
128 -> {129}; 128 -> {129};
129 -> {130}; 129 -> {130};
130 -> {131}; 130 -> {131};
131 -> {124} [color=green style=dashed]; 131 -> {132};
131 -> {132} [style=dotted]; 132 -> {133};
132 -> {133} [style=dotted]; 133 -> {126} [color=green style=dashed];
133 -> {134} [style=dotted]; 133 -> {134} [style=dotted];
134 -> {135} [style=dotted]; 134 -> {135} [style=dotted];
135 -> {136} [style=dotted];
136 -> {137} [style=dotted];
subgraph cluster_46 { subgraph cluster_47 {
color=red color=red
136 [label="Enter function testDoWhileTrueWithBreak" style="filled" fillcolor=red]; 138 [label="Enter function testDoWhileTrueWithBreak" style="filled" fillcolor=red];
subgraph cluster_47 { subgraph cluster_48 {
color=blue color=blue
137 [label="Enter block"]; 139 [label="Enter block"];
subgraph cluster_48 { subgraph cluster_49 {
color=blue color=blue
138 [label="Enter do-while loop"]; 140 [label="Enter do-while loop"];
subgraph cluster_49 { subgraph cluster_50 {
color=blue color=blue
139 [label="Enter loop block"]; 141 [label="Enter loop block"];
subgraph cluster_50 { subgraph cluster_51 {
color=blue color=blue
140 [label="Enter block"]; 142 [label="Enter block"];
subgraph cluster_51 { subgraph cluster_52 {
color=blue color=blue
141 [label="Enter when"]; 143 [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"];
subgraph cluster_53 { subgraph cluster_53 {
color=blue color=blue
147 [label="Enter block"]; 144 [label="Enter when branch condition "];
148 [label="Jump: break@@@[Boolean(true)] "]; 145 [label="Access variable R|<local>/b|"];
149 [label="Stub" style="filled" fillcolor=gray]; 146 [label="Exit when branch condition"];
150 [label="Exit block" style="filled" fillcolor=gray];
} }
151 [label="Exit when branch result" style="filled" fillcolor=gray]; 147 [label="Synthetic else branch"];
152 [label="Exit when"]; 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 color=blue
155 [label="Enter loop condition"]; 157 [label="Enter loop condition"];
156 [label="Const: Boolean(true)"]; 158 [label="Const: Boolean(true)"];
157 [label="Exit loop condition"]; 159 [label="Exit loop condition"];
} }
158 [label="Exit do-while loop"]; 160 [label="Exit do-while loop"];
} }
159 [label="Const: Int(1)"]; 161 [label="Const: Int(1)"];
160 [label="Exit block"]; 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}; 138 -> {139};
139 -> {140}; 139 -> {140};
140 -> {141}; 140 -> {141};
141 -> {142}; 141 -> {142};
142 -> {143}; 142 -> {143};
143 -> {144}; 143 -> {144};
144 -> {145 146}; 144 -> {145};
145 -> {152}; 145 -> {146};
146 -> {147}; 146 -> {147 148};
147 -> {148}; 147 -> {154};
148 -> {158}; 148 -> {149};
148 -> {149} [style=dotted]; 149 -> {150};
149 -> {150} [style=dotted]; 150 -> {160};
150 -> {151} [style=dotted]; 150 -> {151} [style=dotted];
151 -> {152} [style=dotted]; 151 -> {152} [style=dotted];
152 -> {153}; 152 -> {153} [style=dotted];
153 -> {154}; 153 -> {154} [style=dotted];
154 -> {155}; 154 -> {155};
155 -> {156}; 155 -> {156};
156 -> {157}; 156 -> {157};
157 -> {139} [color=green style=dashed]; 157 -> {158};
157 -> {158} [style=dotted];
158 -> {159}; 158 -> {159};
159 -> {160}; 159 -> {141} [color=green style=dashed];
159 -> {160} [style=dotted];
160 -> {161}; 160 -> {161};
161 -> {162};
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];
}
162 -> {163}; 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}; 164 -> {165};
165 -> {166}; 165 -> {166};
166 -> {167}; 166 -> {167};
@@ -544,9 +549,11 @@ digraph loops_kt {
170 -> {171}; 170 -> {171};
171 -> {172}; 171 -> {172};
172 -> {173}; 172 -> {173};
172 -> {165} [color=green style=dotted];
173 -> {174}; 173 -> {174};
174 -> {175}; 174 -> {175};
174 -> {167} [color=green style=dotted];
175 -> {176}; 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|() 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|>|()) { 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 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>|>|() 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|>|()) { 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|>|() 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|() 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|>|()) { 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 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|() 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|>|()) { 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 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|() 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|>|()) { 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 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|() 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|>|()) { 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 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|() 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|>|()) { 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 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|() 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|>|()) { 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 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|() 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|>|()) { 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 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|() 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|>|()) { 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 i: R|kotlin/Int| = R|<local>/<iterator>|.R|kotlin/collections/IntIterator.next|()
when () { {
==(R|<local>/a|, Int(2)) -> { when () {
R|<local>/b| = R|<local>/c| ==(R|<local>/a|, Int(2)) -> {
R|<local>/c| = R|<local>/a| R|<local>/b| = R|<local>/c|
} R|<local>/c| = R|<local>/a|
else -> { }
R|<local>/b| = R|<local>/a| else -> {
R|<local>/c| = R|<local>/b| 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|() 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|>|()) { 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 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|) lval temp: R|kotlin/Int| = R|<local>/current|
R|<local>/prev| = R|<local>/temp| 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>>|>|() 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|>|()) { 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|>|() 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>)>|>|() 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|>|()) { 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|>|() 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>|>|() 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|>|()) { 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|>|() lval a: R|A| = R|<local>/<iterator>|.R|SubstitutionOverride<kotlin/collections/Iterator.next: R|A|>|()
when () { {
==(R|<local>/goodA|, Null(null)) -> { when () {
R|<local>/goodA| = R|<local>/a| ==(R|<local>/goodA|, Null(null)) -> {
continue@@@[R|<local>/<iterator>|.R|SubstitutionOverride<kotlin/collections/Iterator.hasNext: R|kotlin/Boolean|>|()] 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]; 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]; 67 [label="Stub" style="filled" fillcolor=gray];
68 [label="Variable declaration: lval result: R|kotlin/Nothing|" 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 { subgraph cluster_21 {
color=blue 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 { subgraph cluster_22 {
color=blue color=blue
73 [label="Enter when branch condition " style="filled" fillcolor=gray]; 73 [label="Enter when" style="filled" fillcolor=gray];
74 [label="Access variable R|<local>/result|" style="filled" fillcolor=gray]; subgraph cluster_23 {
75 [label="Stub" style="filled" fillcolor=gray]; color=blue
76 [label="Access variable <Unresolved name: b>#" style="filled" fillcolor=gray]; 74 [label="Enter when branch condition " style="filled" fillcolor=gray];
77 [label="Exit 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]; 87 [label="Exit block" 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];
} }
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|"]; 92 [label="Access variable R|<local>/s|"];
91 [label="Enter safe call"]; 93 [label="Enter safe call"];
92 [label="Postponed enter to lambda"]; 94 [label="Postponed enter to lambda"];
subgraph cluster_24 { subgraph cluster_25 {
color=blue color=blue
93 [label="Enter function <anonymous>" style="filled" fillcolor=red]; 95 [label="Enter function <anonymous>" style="filled" fillcolor=red];
subgraph cluster_25 { subgraph cluster_26 {
color=blue color=blue
94 [label="Enter block"]; 96 [label="Enter block"];
95 [label="Access variable R|<local>/it|"]; 97 [label="Access variable R|<local>/it|"];
96 [label="Access variable R|/A.a|"]; 98 [label="Access variable R|/A.a|"];
97 [label="Exit block"]; 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"]; 101 [label="Postponed exit from lambda"];
100 [label="Function call: $subj$.R|kotlin/let|<R|A|, R|kotlin/Int|>(...)" style="filled" fillcolor=yellow]; 102 [label="Function call: $subj$.R|kotlin/let|<R|A|, R|kotlin/Int|>(...)" style="filled" fillcolor=yellow];
101 [label="Exit safe call"]; 103 [label="Exit safe call"];
102 [label="Exit block"]; 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}; 50 -> {51};
51 -> {52}; 51 -> {52};
@@ -252,7 +257,7 @@ digraph smartcastToNothing_kt {
59 -> {60}; 59 -> {60};
60 -> {61}; 60 -> {61};
61 -> {62}; 61 -> {62};
62 -> {63 88}; 62 -> {63 90};
63 -> {64}; 63 -> {64};
64 -> {65}; 64 -> {65};
65 -> {66}; 65 -> {66};
@@ -267,26 +272,26 @@ digraph smartcastToNothing_kt {
74 -> {75} [style=dotted]; 74 -> {75} [style=dotted];
75 -> {76} [style=dotted]; 75 -> {76} [style=dotted];
76 -> {77} [style=dotted]; 76 -> {77} [style=dotted];
77 -> {78 79} [style=dotted]; 77 -> {78} [style=dotted];
78 -> {85} [style=dotted]; 78 -> {79 80} [style=dotted];
79 -> {80} [style=dotted]; 79 -> {86} [style=dotted];
80 -> {81} [style=dotted]; 80 -> {81} [style=dotted];
81 -> {82 88} [style=dotted]; 81 -> {82} [style=dotted];
82 -> {83} [style=dotted]; 82 -> {83 90} [style=dotted];
83 -> {84} [style=dotted]; 83 -> {84} [style=dotted];
84 -> {85} [style=dotted]; 84 -> {85} [style=dotted];
85 -> {86} [style=dotted]; 85 -> {86} [style=dotted];
86 -> {87} [style=dotted]; 86 -> {87} [style=dotted];
87 -> {59} [color=green style=dotted]; 87 -> {88} [style=dotted];
88 -> {89}; 88 -> {89} [style=dotted];
89 -> {90}; 89 -> {59} [color=green style=dotted];
90 -> {91 101}; 90 -> {91};
91 -> {92}; 91 -> {92};
92 -> {93 100}; 92 -> {93 103};
92 -> {99} [style=dotted];
92 -> {93} [style=dashed];
93 -> {94}; 93 -> {94};
94 -> {95}; 94 -> {95 102};
94 -> {101} [style=dotted];
94 -> {95} [style=dashed];
95 -> {96}; 95 -> {96};
96 -> {97}; 96 -> {97};
97 -> {98}; 97 -> {98};
@@ -295,82 +300,82 @@ digraph smartcastToNothing_kt {
100 -> {101}; 100 -> {101};
101 -> {102}; 101 -> {102};
102 -> {103}; 102 -> {103};
103 -> {104};
104 -> {105};
subgraph cluster_26 { subgraph cluster_27 {
color=red color=red
104 [label="Enter function test_1" style="filled" fillcolor=red]; 106 [label="Enter function test_1" style="filled" fillcolor=red];
subgraph cluster_27 { subgraph cluster_28 {
color=blue color=blue
105 [label="Enter block"]; 107 [label="Enter block"];
subgraph cluster_28 { subgraph cluster_29 {
color=blue color=blue
106 [label="Enter when"]; 108 [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"];
subgraph cluster_30 { subgraph cluster_30 {
color=blue color=blue
113 [label="Enter block"]; 109 [label="Enter when branch condition "];
114 [label="Access variable R|<local>/a|"]; 110 [label="Access variable R|<local>/a|"];
115 [label="Smart cast: R|<local>/a|"]; 111 [label="Type operator: (R|<local>/a| is R|kotlin/Nothing?|)"];
116 [label="Enter safe call"]; 112 [label="Exit when branch condition"];
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"];
} }
121 [label="Exit when branch result"]; 113 [label="Synthetic else branch"];
122 [label="Exit when"]; 114 [label="Enter when branch result"];
} subgraph cluster_31 {
subgraph cluster_31 {
color=blue
123 [label="Enter when"];
subgraph cluster_32 {
color=blue color=blue
124 [label="Enter when branch condition "]; 115 [label="Enter block"];
125 [label="Access variable R|<local>/a|"]; 116 [label="Access variable R|<local>/a|"];
126 [label="Type operator: (R|<local>/a| is R|kotlin/Nothing|)"]; 117 [label="Smart cast: R|<local>/a|"];
127 [label="Exit when branch condition"]; 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"]; 123 [label="Exit when branch result"];
129 [label="Enter when branch result"]; 124 [label="Exit when"];
}
subgraph cluster_32 {
color=blue
125 [label="Enter when"];
subgraph cluster_33 { subgraph cluster_33 {
color=blue color=blue
130 [label="Enter block"]; 126 [label="Enter when branch condition "];
131 [label="Access variable R|<local>/a|"]; 127 [label="Access variable R|<local>/a|"];
132 [label="Smart cast: R|<local>/a|"]; 128 [label="Type operator: (R|<local>/a| is R|kotlin/Nothing|)"];
133 [label="Stub" style="filled" fillcolor=gray]; 129 [label="Exit when branch condition"];
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];
} }
137 [label="Exit when branch result" style="filled" fillcolor=gray]; 130 [label="Synthetic else branch"];
138 [label="Exit when"]; 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}; 106 -> {107};
107 -> {108}; 107 -> {108};
108 -> {109}; 108 -> {109};
109 -> {110}; 109 -> {110};
110 -> {111 112}; 110 -> {111};
111 -> {122}; 111 -> {112};
112 -> {113}; 112 -> {113 114};
113 -> {114}; 113 -> {124};
114 -> {115}; 114 -> {115};
115 -> {116 118}; 115 -> {116};
116 -> {117}; 116 -> {117};
117 -> {118}; 117 -> {118 120};
118 -> {119}; 118 -> {119};
119 -> {120}; 119 -> {120};
120 -> {121}; 120 -> {121};
@@ -380,18 +385,20 @@ digraph smartcastToNothing_kt {
124 -> {125}; 124 -> {125};
125 -> {126}; 125 -> {126};
126 -> {127}; 126 -> {127};
127 -> {128 129}; 127 -> {128};
128 -> {138}; 128 -> {129};
129 -> {130}; 129 -> {130 131};
130 -> {131}; 130 -> {140};
131 -> {132}; 131 -> {132};
132 -> {133} [style=dotted]; 132 -> {133};
133 -> {134} [style=dotted]; 133 -> {134};
134 -> {135} [style=dotted]; 134 -> {135} [style=dotted];
135 -> {136} [style=dotted]; 135 -> {136} [style=dotted];
136 -> {137} [style=dotted]; 136 -> {137} [style=dotted];
137 -> {138} [style=dotted]; 137 -> {138} [style=dotted];
138 -> {139}; 138 -> {139} [style=dotted];
139 -> {140}; 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>|>|() 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|>|()) { 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|>|() 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>/s| = R|<local>/result|
R|<local>/result|.<Unresolved name: b># -> { when () {
break@@@[R|<local>/<iterator>|.R|SubstitutionOverride<kotlin/collections/Iterator.hasNext: R|kotlin/Boolean|>|()] 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)>|>|() 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|>|()) { 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|>|() 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)>|>|() 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|>|()) { 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|>|() 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 <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 x: R|kotlin/Int| = R|<local>/<destruct>|.R|/D.component1|()
lval y: R|kotlin/String| = R|<local>/<destruct>|.R|/D.component2|() 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>|"]; 74 [label="Access variable R|<local>/<iterator>|"];
75 [label="Function call: R|<local>/<iterator>|.R|kotlin/collections/IntIterator.next|()" style="filled" fillcolor=yellow]; 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|"]; 76 [label="Variable declaration: lval i: R|kotlin/Int|"];
77 [label="Access variable R|<local>/x|"]; subgraph cluster_24 {
78 [label="Function call: R|<local>/x|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()" style="filled" fillcolor=yellow]; color=blue
79 [label="Exit block"]; 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|"]; 85 [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]; 86 [label="Function call: R|<local>/y|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()" style="filled" fillcolor=yellow];
85 [label="Exit block"]; 87 [label="Exit block"];
} }
86 [label="Exit when branch result"]; 88 [label="Exit when branch result"];
87 [label="Exit when"]; 89 [label="Exit when"];
} }
subgraph cluster_24 { subgraph cluster_25 {
color=blue color=blue
88 [label="Enter do-while loop"]; 90 [label="Enter do-while loop"];
subgraph cluster_25 { subgraph cluster_26 {
color=blue color=blue
89 [label="Enter loop block"]; 91 [label="Enter loop block"];
subgraph cluster_26 { subgraph cluster_27 {
color=blue color=blue
90 [label="Enter block"]; 92 [label="Enter block"];
91 [label="Access variable R|<local>/z|"]; 93 [label="Access variable R|<local>/z|"];
92 [label="Function call: R|/bar|(...)" style="filled" fillcolor=yellow]; 94 [label="Function call: R|/bar|(...)" style="filled" fillcolor=yellow];
93 [label="Exit block"]; 95 [label="Exit block"];
} }
94 [label="Exit loop block"]; 96 [label="Exit loop block"];
} }
subgraph cluster_27 { subgraph cluster_28 {
color=blue color=blue
95 [label="Enter loop condition"]; 97 [label="Enter loop condition"];
96 [label="Const: Boolean(true)"]; 98 [label="Const: Boolean(true)"];
97 [label="Exit loop condition"]; 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}; 22 -> {23};
23 -> {24}; 23 -> {24};
@@ -235,7 +240,7 @@ digraph flow_kt {
43 -> {44}; 43 -> {44};
44 -> {45}; 44 -> {45};
45 -> {46}; 45 -> {46};
46 -> {100}; 46 -> {102};
46 -> {47} [style=dotted]; 46 -> {47} [style=dotted];
47 -> {48} [style=dotted]; 47 -> {48} [style=dotted];
48 -> {49} [style=dotted]; 48 -> {49} [style=dotted];
@@ -248,7 +253,7 @@ digraph flow_kt {
55 -> {56}; 55 -> {56};
56 -> {57}; 56 -> {57};
57 -> {58}; 57 -> {58};
58 -> {87}; 58 -> {89};
59 -> {60}; 59 -> {60};
60 -> {61}; 60 -> {61};
61 -> {62}; 61 -> {62};
@@ -261,7 +266,7 @@ digraph flow_kt {
68 -> {69}; 68 -> {69};
69 -> {70}; 69 -> {70};
70 -> {71}; 70 -> {71};
71 -> {72 81}; 71 -> {72 83};
72 -> {73}; 72 -> {73};
73 -> {74}; 73 -> {74};
74 -> {75}; 74 -> {75};
@@ -270,9 +275,9 @@ digraph flow_kt {
77 -> {78}; 77 -> {78};
78 -> {79}; 78 -> {79};
79 -> {80}; 79 -> {80};
80 -> {68} [color=green style=dashed]; 80 -> {81};
81 -> {82}; 81 -> {82};
82 -> {83}; 82 -> {68} [color=green style=dashed];
83 -> {84}; 83 -> {84};
84 -> {85}; 84 -> {85};
85 -> {86}; 85 -> {86};
@@ -287,9 +292,11 @@ digraph flow_kt {
94 -> {95}; 94 -> {95};
95 -> {96}; 95 -> {96};
96 -> {97}; 96 -> {97};
97 -> {89} [color=green style=dashed]; 97 -> {98};
97 -> {98} [style=dotted]; 98 -> {99};
98 -> {99} [style=dotted]; 99 -> {91} [color=green style=dashed];
99 -> {100} [style=dotted]; 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|() 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|>|()) { 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 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>#() lval <iterator>: <ERROR TYPE REF: Unresolved name: iterator> = R|<local>/notRange1|.<Unresolved name: iterator>#()
while(R|<local>/<iterator>|.<Unresolved name: hasNext>#()) { while(R|<local>/<iterator>|.<Unresolved name: hasNext>#()) {
lval i: <ERROR TYPE REF: Unresolved name: next> = R|<local>/<iterator>|.<Unresolved name: next>#() 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|() lval <iterator>: R|kotlin/Unit| = R|<local>/notRange2|.R|/NotRange2.iterator|()
while(R|<local>/<iterator>|.<Unresolved name: hasNext>#()) { while(R|<local>/<iterator>|.<Unresolved name: hasNext>#()) {
lval i: <ERROR TYPE REF: Unresolved name: next> = R|<local>/<iterator>|.<Unresolved name: next>#() 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|() lval <iterator>: R|ImproperIterator1| = R|<local>/notRange3|.R|/NotRange3.iterator|()
while(R|<local>/<iterator>|.R|/ImproperIterator1.hasNext|()) { while(R|<local>/<iterator>|.R|/ImproperIterator1.hasNext|()) {
lval i: <ERROR TYPE REF: Unresolved name: next> = R|<local>/<iterator>|.<Unresolved name: next>#() 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|() lval <iterator>: R|ImproperIterator2| = R|<local>/notRange4|.R|/NotRange4.iterator|()
while(R|<local>/<iterator>|.<Unresolved name: hasNext>#()) { while(R|<local>/<iterator>|.<Unresolved name: hasNext>#()) {
lval i: R|kotlin/Boolean| = R|<local>/<iterator>|.R|/ImproperIterator2.next|() 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|() lval <iterator>: R|ImproperIterator3| = R|<local>/notRange5|.R|/NotRange5.iterator|()
while(R|<local>/<iterator>|.R|/ImproperIterator3.hasNext|()) { while(R|<local>/<iterator>|.R|/ImproperIterator3.hasNext|()) {
lval i: R|kotlin/Int| = R|<local>/<iterator>|.R|/ImproperIterator3.next|() 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|() lval <iterator>: R|AmbiguousHasNextIterator| = R|<local>/notRange6|.R|/NotRange6.iterator|()
while(R|<local>/<iterator>|.R|/AmbiguousHasNextIterator.hasNext|()) { while(R|<local>/<iterator>|.R|/AmbiguousHasNextIterator.hasNext|()) {
lval i: R|kotlin/Int| = R|<local>/<iterator>|.R|/AmbiguousHasNextIterator.next|() 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|() lval <iterator>: R|ImproperIterator3| = R|<local>/notRange7|.R|/NotRange7.iterator|()
while(R|<local>/<iterator>|.R|/ImproperIterator3.hasNext|()) { while(R|<local>/<iterator>|.R|/ImproperIterator3.hasNext|()) {
lval i: R|kotlin/Int| = R|<local>/<iterator>|.R|/ImproperIterator3.next|() 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|() lval <iterator>: R|ImproperIterator5| = R|<local>/notRange8|.R|/NotRange8.iterator|()
while(R|<local>/<iterator>|.<Unresolved name: hasNext>#()) { while(R|<local>/<iterator>|.<Unresolved name: hasNext>#()) {
lval i: R|kotlin/Int| = R|<local>/<iterator>|.R|/ImproperIterator5.next|() 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|() lval <iterator>: R|ImproperIterator6| = R|<local>/notRange9|.R|/NotRange9.iterator|()
while(R|<local>/<iterator>|.R|/ImproperIterator6.hasNext|()) { while(R|<local>/<iterator>|.R|/ImproperIterator6.hasNext|()) {
lval i: R|kotlin/Int| = R|<local>/<iterator>|.R|/ImproperIterator6.next|() 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|() lval <iterator>: R|GoodIterator| = R|<local>/range0|.R|/Range0.iterator|()
while(R|<local>/<iterator>|.R|/GoodIterator.hasNext|()) { while(R|<local>/<iterator>|.R|/GoodIterator.hasNext|()) {
lval i: R|kotlin/Int| = R|<local>/<iterator>|.R|/GoodIterator.next|() 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|() 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|>|()) { 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|>|() 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 <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 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|>|() 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>|>|() 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|>|()) { 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|>|() 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|) -> { when () {
^valueOfOrNull R|<local>/enumValue| ==(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. // So, prepare the loop target after building the condition.
target = prepareTarget(forLoop) target = prepareTarget(forLoop)
}.configure(target) { }.configure(target) {
// NB: just body.toFirBlock() isn't acceptable here because we need to add some statements
buildBlock block@{ buildBlock block@{
source = blockNode?.toFirSourceElement() source = blockNode?.toFirSourceElement()
statements += convertLoopBody(blockNode).statements
val valueParameter = parameter ?: return@block val valueParameter = parameter ?: return@block
val multiDeclaration = valueParameter.destructuringDeclaration val multiDeclaration = valueParameter.destructuringDeclaration
val firLoopParameter = generateTemporaryVariable( val firLoopParameter = generateTemporaryVariable(
@@ -1159,10 +1157,11 @@ class ExpressionsConverter(
firLoopParameter, firLoopParameter,
tmpVariable = true tmpVariable = true
) )
statements.addAll(0, destructuringBlock.statements) statements.addAll(destructuringBlock.statements)
} else { } 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. // So, prepare the loop target after building the condition.
target = prepareTarget(expression) target = prepareTarget(expression)
}.configure(target) { }.configure(target) {
// NB: just body.toFirBlock() isn't acceptable here because we need to add some statements val blockBuilder = FirBlockBuilder().apply {
val blockBuilder = when (val body = expression.body) { source = expression.toFirSourceElement(KtFakeSourceElementKind.DesugaredForLoop)
is KtBlockExpression -> configureBlockWithoutBuilding(body)
null -> FirBlockBuilder()
else -> FirBlockBuilder().apply {
source = body.toFirSourceElement(KtFakeSourceElementKind.DesugaredForLoop)
statements += body.toFirStatement()
}
} }
if (ktParameter != null) { if (ktParameter != null) {
val multiDeclaration = ktParameter.destructuringDeclaration val multiDeclaration = ktParameter.destructuringDeclaration
@@ -2358,11 +2352,12 @@ open class RawFirBuilder(
tmpVariable = true, tmpVariable = true,
extractAnnotationsTo = { extractAnnotationsTo(it) }, extractAnnotationsTo = { extractAnnotationsTo(it) },
) { toFirOrImplicitType() } ) { toFirOrImplicitType() }
blockBuilder.statements.addAll(0, destructuringBlock.statements) blockBuilder.statements.addAll(destructuringBlock.statements)
} else { } else {
blockBuilder.statements.add(0, firLoopParameter) blockBuilder.statements.add(firLoopParameter)
} }
} }
blockBuilder.statements.add(expression.body.toFirBlock())
blockBuilder.build() blockBuilder.build()
} }
} }
@@ -4,7 +4,10 @@ FILE: for.kt
lval <iterator>: <implicit> = IntegerLiteral(1).rangeTo#(IntegerLiteral(10)).iterator#() lval <iterator>: <implicit> = IntegerLiteral(1).rangeTo#(IntegerLiteral(10)).iterator#()
while(R|<local>/<iterator>|.hasNext#()) { while(R|<local>/<iterator>|.hasNext#()) {
lval i: <implicit> = R|<local>/<iterator>|.next#() 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#() lval <iterator>: <implicit> = IntegerLiteral(1).rangeTo#(IntegerLiteral(10)).iterator#()
label@while(R|<local>/<iterator>|.hasNext#()) { label@while(R|<local>/<iterator>|.hasNext#()) {
lval i: <implicit> = R|<local>/<iterator>|.next#() lval i: <implicit> = R|<local>/<iterator>|.next#()
when () { {
==(i#, IntegerLiteral(5)) -> { when () {
continue@@@[R|<local>/<iterator>|.hasNext#()] ==(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#() lval <iterator>: <implicit> = list#.subList#(IntegerLiteral(0), IntegerLiteral(10)).iterator#()
while(R|<local>/<iterator>|.hasNext#()) { while(R|<local>/<iterator>|.hasNext#()) {
lval element: <implicit> = R|<local>/<iterator>|.next#() 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#() lval <iterator>: <implicit> = list#.subList#(IntegerLiteral(10), IntegerLiteral(20)).iterator#()
while(R|<local>/<iterator>|.hasNext#()) { while(R|<local>/<iterator>|.hasNext#()) {
lval element: <implicit> = R|<local>/<iterator>|.next#() 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 <destruct>: <implicit> = R|<local>/<iterator>|.next#()
lval x: <implicit> = R|<local>/<destruct>|.component1#() lval x: <implicit> = R|<local>/<destruct>|.component1#()
lval y: <implicit> = R|<local>/<destruct>|.component2#() 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#() lval <iterator>: <implicit> = list#.iterator#()
while(R|<local>/<iterator>|.hasNext#()) { while(R|<local>/<iterator>|.hasNext#()) {
lval s: Some = R|<local>/<iterator>|.next#() lval s: Some = R|<local>/<iterator>|.next#()
println#(s#) {
println#(s#)
}
} }
} }
@@ -1,3 +1,4 @@
// FIR_DUMP
// ISSUE: KT-54405 // ISSUE: KT-54405
class A { class A {
@@ -5,7 +6,7 @@ class A {
operator fun component2() = "" operator fun component2() = ""
} }
fun test(b: Boolean) { fun testRedeclaration(b: Boolean) {
val <!REDECLARATION!>y<!> = 1 val <!REDECLARATION!>y<!> = 1
val <!REDECLARATION!>y<!> = 2 val <!REDECLARATION!>y<!> = 2
val <!REDECLARATION!>`_`<!> = 3 val <!REDECLARATION!>`_`<!> = 3
@@ -14,15 +15,16 @@ fun test(b: Boolean) {
var <!REDECLARATION!>a<!> = 10 var <!REDECLARATION!>a<!> = 10
var <!REDECLARATION!>a<!> = 11 var <!REDECLARATION!>a<!> = 11
} }
}
fun testNoRedeclaration(list: List<Int>, b: Boolean) {
for (el in list) {
val el = 42
}
if (b) { if (b) {
val z = 3 val z = 3
val <!REDECLARATION!>x<!> = 5
val <!REDECLARATION!>x<!> = 6
} else { } else {
val z = 4 val z = 4
} }
}
fun test2() {
val (`_`, _) = A() 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 // ISSUE: KT-54405
class A { class A {
@@ -5,7 +6,7 @@ class A {
operator fun component2() = "" operator fun component2() = ""
} }
fun test(b: Boolean) { fun testRedeclaration(b: Boolean) {
val <!REDECLARATION!>y<!> = 1 val <!REDECLARATION!>y<!> = 1
val <!NAME_SHADOWING, REDECLARATION!>y<!> = 2 val <!NAME_SHADOWING, REDECLARATION!>y<!> = 2
val <!REDECLARATION!>`_`<!> = 3 val <!REDECLARATION!>`_`<!> = 3
@@ -14,15 +15,16 @@ fun test(b: Boolean) {
var <!REDECLARATION!>a<!> = 10 var <!REDECLARATION!>a<!> = 10
var <!NAME_SHADOWING, REDECLARATION!>a<!> = 11 var <!NAME_SHADOWING, REDECLARATION!>a<!> = 11
} }
}
fun testNoRedeclaration(list: List<Int>, b: Boolean) {
for (el in list) {
val <!NAME_SHADOWING!>el<!> = 42
}
if (b) { if (b) {
val z = 3 val z = 3
val <!REDECLARATION!>x<!> = 5
val <!NAME_SHADOWING, REDECLARATION!>x<!> = 6
} else { } else {
val z = 4 val z = 4
} }
}
fun test2() {
val (`_`, _) = A() val (`_`, _) = A()
} }
@@ -1,7 +1,7 @@
package package
public fun test(/*0*/ b: kotlin.Boolean): kotlin.Unit public fun testNoRedeclaration(/*0*/ list: kotlin.collections.List<kotlin.Int>, /*1*/ b: kotlin.Boolean): kotlin.Unit
public fun test2(): kotlin.Unit public fun testRedeclaration(/*0*/ b: kotlin.Boolean): kotlin.Unit
public final class A { public final class A {
public constructor A() public constructor A()