FIR: don't flatten for loop blocks in raw FIR builder

This commit is contained in:
Mikhail Glukhikh
2021-04-16 15:47:44 +03:00
parent a736d62edd
commit 43a2ad0467
27 changed files with 1255 additions and 1105 deletions
+61 -54
View File
@@ -191,63 +191,68 @@ digraph complex_kt {
subgraph cluster_19 { subgraph cluster_19 {
color=blue color=blue
56 [label="Enter block"]; 56 [label="Enter block"];
57 [label="Access variable this@R|/firstIsInstanceOrNull|"];
58 [label="Function call: this@R|/firstIsInstanceOrNull|.R|SubstitutionOverride<kotlin/collections/List.iterator: R|kotlin/collections/Iterator<CapturedType(*)>|>|()"];
59 [label="Variable declaration: lval <iterator>: R|kotlin/collections/Iterator<kotlin/Any?>|"];
subgraph cluster_20 { subgraph cluster_20 {
color=blue color=blue
60 [label="Enter while loop"]; 57 [label="Enter block"];
58 [label="Access variable this@R|/firstIsInstanceOrNull|"];
59 [label="Function call: this@R|/firstIsInstanceOrNull|.R|SubstitutionOverride<kotlin/collections/List.iterator: R|kotlin/collections/Iterator<CapturedType(*)>|>|()"];
60 [label="Variable declaration: lval <iterator>: R|kotlin/collections/Iterator<kotlin/Any?>|"];
subgraph cluster_21 { subgraph cluster_21 {
color=blue color=blue
61 [label="Enter loop condition"]; 61 [label="Enter while loop"];
62 [label="Access variable R|<local>/<iterator>|"]; subgraph cluster_22 {
63 [label="Function call: R|<local>/<iterator>|.R|kotlin/collections/Iterator.hasNext|()"]; color=blue
64 [label="Exit loop condition"]; 62 [label="Enter loop condition"];
} 63 [label="Access variable R|<local>/<iterator>|"];
subgraph cluster_22 { 64 [label="Function call: R|<local>/<iterator>|.R|kotlin/collections/Iterator.hasNext|()"];
color=blue 65 [label="Exit loop condition"];
65 [label="Enter loop block"]; }
subgraph cluster_23 { subgraph cluster_23 {
color=blue color=blue
66 [label="Enter block"]; 66 [label="Enter loop block"];
67 [label="Access variable R|<local>/<iterator>|"];
68 [label="Function call: R|<local>/<iterator>|.R|SubstitutionOverride<kotlin/collections/Iterator.next: R|kotlin/Any?|>|()"];
69 [label="Variable declaration: lval element: R|kotlin/Any?|"];
subgraph cluster_24 { subgraph cluster_24 {
color=blue color=blue
70 [label="Enter when"]; 67 [label="Enter block"];
68 [label="Access variable R|<local>/<iterator>|"];
69 [label="Function call: R|<local>/<iterator>|.R|SubstitutionOverride<kotlin/collections/Iterator.next: R|kotlin/Any?|>|()"];
70 [label="Variable declaration: lval element: R|kotlin/Any?|"];
subgraph cluster_25 { subgraph cluster_25 {
color=blue color=blue
71 [label="Enter when branch condition "]; 71 [label="Enter when"];
72 [label="Access variable R|<local>/element|"]; subgraph cluster_26 {
73 [label="Type operator: (R|<local>/element| is R|T|)"]; color=blue
74 [label="Exit when branch condition"]; 72 [label="Enter when branch condition "];
73 [label="Access variable R|<local>/element|"];
74 [label="Type operator: (R|<local>/element| is R|T|)"];
75 [label="Exit when branch condition"];
}
76 [label="Synthetic else branch"];
77 [label="Enter when branch result"];
subgraph cluster_27 {
color=blue
78 [label="Enter block"];
79 [label="Access variable 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"];
} }
75 [label="Synthetic else branch"]; 85 [label="Exit block"];
76 [label="Enter when branch result"];
subgraph cluster_26 {
color=blue
77 [label="Enter block"];
78 [label="Access variable 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 loop block"];
} }
85 [label="Exit loop block"]; 87 [label="Exit whileloop"];
} }
86 [label="Exit whileloop"]; 88 [label="Exit block"];
} }
87 [label="Const: Null(null)"]; 89 [label="Const: Null(null)"];
88 [label="Jump: ^firstIsInstanceOrNull Null(null)"]; 90 [label="Jump: ^firstIsInstanceOrNull Null(null)"];
89 [label="Stub" style="filled" fillcolor=gray]; 91 [label="Stub" style="filled" fillcolor=gray];
90 [label="Exit block" style="filled" fillcolor=gray]; 92 [label="Exit block" style="filled" fillcolor=gray];
} }
91 [label="Exit function firstIsInstanceOrNull" style="filled" fillcolor=red]; 93 [label="Exit function firstIsInstanceOrNull" style="filled" fillcolor=red];
} }
55 -> {56}; 55 -> {56};
56 -> {57}; 56 -> {57};
@@ -258,8 +263,8 @@ digraph complex_kt {
61 -> {62}; 61 -> {62};
62 -> {63}; 62 -> {63};
63 -> {64}; 63 -> {64};
64 -> {86 65}; 64 -> {65};
65 -> {66}; 65 -> {87 66};
66 -> {67}; 66 -> {67};
67 -> {68}; 67 -> {68};
68 -> {69}; 68 -> {69};
@@ -268,24 +273,26 @@ digraph complex_kt {
71 -> {72}; 71 -> {72};
72 -> {73}; 72 -> {73};
73 -> {74}; 73 -> {74};
74 -> {76 75}; 74 -> {75};
75 -> {83}; 75 -> {77 76};
76 -> {77}; 76 -> {84};
77 -> {78}; 77 -> {78};
78 -> {79}; 78 -> {79};
79 -> {91}; 79 -> {80};
79 -> {80} [style=dotted]; 80 -> {93};
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 -> {61} [color=green style=dashed]; 85 -> {86};
86 -> {87}; 86 -> {62} [color=green style=dashed];
87 -> {88}; 87 -> {88};
88 -> {91}; 88 -> {89};
88 -> {89} [style=dotted]; 89 -> {90};
89 -> {90} [style=dotted]; 90 -> {93};
90 -> {91} [style=dotted]; 90 -> {91} [style=dotted];
91 -> {92} [style=dotted];
92 -> {93} [style=dotted];
} }
@@ -25,13 +25,16 @@ FILE: complex.kt
} }
public final inline fun <reified T : R|kotlin/Any|> R|kotlin/collections/List<*>|.firstIsInstanceOrNull(): R|T?| { public final inline fun <reified T : R|kotlin/Any|> R|kotlin/collections/List<*>|.firstIsInstanceOrNull(): R|T?| {
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|kotlin/collections/Iterator.hasNext|()) { lval <iterator>: R|kotlin/collections/Iterator<kotlin/Any?>| = this@R|/firstIsInstanceOrNull|.R|SubstitutionOverride<kotlin/collections/List.iterator: R|kotlin/collections/Iterator<CapturedType(*)>|>|()
lval element: R|kotlin/Any?| = R|<local>/<iterator>|.R|SubstitutionOverride<kotlin/collections/Iterator.next: R|kotlin/Any?|>|() while(R|<local>/<iterator>|.R|kotlin/collections/Iterator.hasNext|()) {
when () { lval element: R|kotlin/Any?| = R|<local>/<iterator>|.R|SubstitutionOverride<kotlin/collections/Iterator.next: R|kotlin/Any?|>|()
(R|<local>/element| is R|T|) -> { when () {
^firstIsInstanceOrNull R|<local>/element| (R|<local>/element| is R|T|) -> {
^firstIsInstanceOrNull R|<local>/element|
}
} }
} }
} }
+276 -269
View File
@@ -118,44 +118,49 @@ digraph loops_kt {
subgraph cluster_13 { subgraph cluster_13 {
color=blue color=blue
37 [label="Enter block"]; 37 [label="Enter block"];
38 [label="Const: Int(0)"];
39 [label="Const: Int(5)"];
40 [label="Function call: Int(0).R|kotlin/Int.rangeTo|(...)"];
41 [label="Function call: Int(0).R|kotlin/Int.rangeTo|(...).R|kotlin/ranges/IntProgression.iterator|()"];
42 [label="Variable declaration: lval <iterator>: R|kotlin/collections/IntIterator|"];
subgraph cluster_14 { subgraph cluster_14 {
color=blue color=blue
43 [label="Enter while loop"]; 38 [label="Enter block"];
39 [label="Const: Int(0)"];
40 [label="Const: Int(5)"];
41 [label="Function call: Int(0).R|kotlin/Int.rangeTo|(...)"];
42 [label="Function call: Int(0).R|kotlin/Int.rangeTo|(...).R|kotlin/ranges/IntProgression.iterator|()"];
43 [label="Variable declaration: lval <iterator>: R|kotlin/collections/IntIterator|"];
subgraph cluster_15 { subgraph cluster_15 {
color=blue color=blue
44 [label="Enter loop condition"]; 44 [label="Enter while loop"];
45 [label="Access variable R|<local>/<iterator>|"]; subgraph cluster_16 {
46 [label="Function call: R|<local>/<iterator>|.R|kotlin/collections/Iterator.hasNext|()"]; color=blue
47 [label="Exit loop condition"]; 45 [label="Enter loop condition"];
} 46 [label="Access variable R|<local>/<iterator>|"];
subgraph cluster_16 { 47 [label="Function call: R|<local>/<iterator>|.R|kotlin/collections/Iterator.hasNext|()"];
color=blue 48 [label="Exit loop condition"];
48 [label="Enter loop block"]; }
subgraph cluster_17 { subgraph cluster_17 {
color=blue color=blue
49 [label="Enter block"]; 49 [label="Enter loop block"];
50 [label="Access variable R|<local>/<iterator>|"]; subgraph cluster_18 {
51 [label="Function call: R|<local>/<iterator>|.R|kotlin/collections/IntIterator.next|()"]; color=blue
52 [label="Variable declaration: lval i: R|kotlin/Int|"]; 50 [label="Enter block"];
53 [label="Access variable R|<local>/x|"]; 51 [label="Access variable R|<local>/<iterator>|"];
54 [label="Type operator: (R|<local>/x| is R|kotlin/String|)"]; 52 [label="Function call: R|<local>/<iterator>|.R|kotlin/collections/IntIterator.next|()"];
55 [label="Variable declaration: lval y: R|kotlin/Boolean|"]; 53 [label="Variable declaration: lval i: R|kotlin/Int|"];
56 [label="Exit block"]; 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"];
}
58 [label="Exit loop block"];
} }
57 [label="Exit loop block"]; 59 [label="Exit whileloop"];
} }
58 [label="Exit whileloop"]; 60 [label="Exit block"];
} }
59 [label="Access variable R|<local>/x|"]; 61 [label="Access variable R|<local>/x|"];
60 [label="Type operator: (R|<local>/x| is R|kotlin/String|)"]; 62 [label="Type operator: (R|<local>/x| is R|kotlin/String|)"];
61 [label="Exit block"]; 63 [label="Exit block"];
} }
62 [label="Exit function testFor" style="filled" fillcolor=red]; 64 [label="Exit function testFor" style="filled" fillcolor=red];
} }
36 -> {37}; 36 -> {37};
37 -> {38}; 37 -> {38};
@@ -168,8 +173,8 @@ digraph loops_kt {
44 -> {45}; 44 -> {45};
45 -> {46}; 45 -> {46};
46 -> {47}; 46 -> {47};
47 -> {58 48}; 47 -> {48};
48 -> {49}; 48 -> {59 49};
49 -> {50}; 49 -> {50};
50 -> {51}; 50 -> {51};
51 -> {52}; 51 -> {52};
@@ -178,226 +183,226 @@ digraph loops_kt {
54 -> {55}; 54 -> {55};
55 -> {56}; 55 -> {56};
56 -> {57}; 56 -> {57};
57 -> {44} [color=green style=dashed]; 57 -> {58};
58 -> {59}; 58 -> {45} [color=green style=dashed];
59 -> {60}; 59 -> {60};
60 -> {61}; 60 -> {61};
61 -> {62}; 61 -> {62};
62 -> {63};
63 -> {64};
subgraph cluster_18 { subgraph cluster_19 {
color=red color=red
63 [label="Enter function testWhileTrue" style="filled" fillcolor=red]; 65 [label="Enter function testWhileTrue" style="filled" fillcolor=red];
subgraph cluster_19 { subgraph cluster_20 {
color=blue color=blue
64 [label="Enter block"]; 66 [label="Enter block"];
subgraph cluster_20 { subgraph cluster_21 {
color=blue color=blue
65 [label="Enter while loop"]; 67 [label="Enter while loop"];
subgraph cluster_21 {
color=blue
66 [label="Enter loop condition"];
67 [label="Const: Boolean(true)"];
68 [label="Exit loop condition"];
}
subgraph cluster_22 { subgraph cluster_22 {
color=blue color=blue
69 [label="Enter loop block"]; 68 [label="Enter loop condition"];
subgraph cluster_23 { 69 [label="Const: Boolean(true)"];
color=blue 70 [label="Exit loop condition"];
70 [label="Enter block"];
71 [label="Const: Int(1)"];
72 [label="Exit block"];
}
73 [label="Exit loop block"];
} }
74 [label="Exit whileloop" style="filled" fillcolor=gray]; 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"];
}
76 [label="Exit whileloop" style="filled" fillcolor=gray];
} }
75 [label="Const: Int(1)" style="filled" fillcolor=gray]; 77 [label="Const: Int(1)" style="filled" fillcolor=gray];
76 [label="Exit block" style="filled" fillcolor=gray]; 78 [label="Exit block" style="filled" fillcolor=gray];
} }
77 [label="Exit function testWhileTrue" style="filled" fillcolor=red style="filled" fillcolor=gray]; 79 [label="Exit function testWhileTrue" style="filled" fillcolor=red style="filled" fillcolor=gray];
} }
63 -> {64};
64 -> {65};
65 -> {66}; 65 -> {66};
66 -> {67}; 66 -> {67};
67 -> {68}; 67 -> {68};
68 -> {69}; 68 -> {69};
68 -> {74} [style=dotted];
69 -> {70}; 69 -> {70};
70 -> {71}; 70 -> {71};
70 -> {76} [style=dotted];
71 -> {72}; 71 -> {72};
72 -> {73}; 72 -> {73};
73 -> {66} [color=green style=dashed]; 73 -> {74};
74 -> {75} [style=dotted]; 74 -> {75};
75 -> {76} [style=dotted]; 75 -> {68} [color=green style=dashed];
76 -> {77} [style=dotted]; 76 -> {77} [style=dotted];
77 -> {78} [style=dotted];
78 -> {79} [style=dotted];
subgraph cluster_24 { subgraph cluster_25 {
color=red color=red
78 [label="Enter function testWhileTrueWithBreak" style="filled" fillcolor=red]; 80 [label="Enter function testWhileTrueWithBreak" style="filled" fillcolor=red];
subgraph cluster_25 { subgraph cluster_26 {
color=blue color=blue
79 [label="Enter block"]; 81 [label="Enter block"];
subgraph cluster_26 { subgraph cluster_27 {
color=blue color=blue
80 [label="Enter while loop"]; 82 [label="Enter while loop"];
subgraph cluster_27 {
color=blue
81 [label="Enter loop condition"];
82 [label="Const: Boolean(true)"];
83 [label="Exit loop condition"];
}
subgraph cluster_28 { subgraph cluster_28 {
color=blue color=blue
84 [label="Enter loop block"]; 83 [label="Enter loop condition"];
subgraph cluster_29 { 84 [label="Const: Boolean(true)"];
85 [label="Exit loop condition"];
}
subgraph cluster_29 {
color=blue
86 [label="Enter loop block"];
subgraph cluster_30 {
color=blue color=blue
85 [label="Enter block"]; 87 [label="Enter block"];
subgraph cluster_30 { subgraph cluster_31 {
color=blue color=blue
86 [label="Enter when"]; 88 [label="Enter when"];
subgraph cluster_31 {
color=blue
87 [label="Enter when branch condition "];
88 [label="Access variable R|<local>/b|"];
89 [label="Exit when branch condition"];
}
90 [label="Synthetic else branch"];
91 [label="Enter when branch result"];
subgraph cluster_32 { subgraph cluster_32 {
color=blue color=blue
92 [label="Enter block"]; 89 [label="Enter when branch condition "];
93 [label="Jump: break@@@[Boolean(true)] "]; 90 [label="Access variable R|<local>/b|"];
94 [label="Stub" style="filled" fillcolor=gray]; 91 [label="Exit when branch condition"];
95 [label="Exit block" style="filled" fillcolor=gray];
} }
96 [label="Exit when branch result" style="filled" fillcolor=gray]; 92 [label="Synthetic else branch"];
97 [label="Exit when"]; 93 [label="Enter when branch result"];
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];
}
98 [label="Exit when branch result" style="filled" fillcolor=gray];
99 [label="Exit when"];
} }
98 [label="Exit block"]; 100 [label="Exit block"];
} }
99 [label="Exit loop block"]; 101 [label="Exit loop block"];
} }
100 [label="Exit whileloop"]; 102 [label="Exit whileloop"];
} }
101 [label="Const: Int(1)"]; 103 [label="Const: Int(1)"];
102 [label="Exit block"]; 104 [label="Exit block"];
} }
103 [label="Exit function testWhileTrueWithBreak" style="filled" fillcolor=red]; 105 [label="Exit function testWhileTrueWithBreak" style="filled" fillcolor=red];
} }
78 -> {79};
79 -> {80};
80 -> {81}; 80 -> {81};
81 -> {82}; 81 -> {82};
82 -> {83}; 82 -> {83};
83 -> {84}; 83 -> {84};
83 -> {100} [style=dotted];
84 -> {85}; 84 -> {85};
85 -> {86}; 85 -> {86};
85 -> {102} [style=dotted];
86 -> {87}; 86 -> {87};
87 -> {88}; 87 -> {88};
88 -> {89}; 88 -> {89};
89 -> {91 90}; 89 -> {90};
90 -> {97}; 90 -> {91};
91 -> {92}; 91 -> {93 92};
92 -> {93}; 92 -> {99};
93 -> {100}; 93 -> {94};
93 -> {94} [style=dotted]; 94 -> {95};
94 -> {95} [style=dotted]; 95 -> {102};
95 -> {96} [style=dotted]; 95 -> {96} [style=dotted];
96 -> {97} [style=dotted]; 96 -> {97} [style=dotted];
97 -> {98}; 97 -> {98} [style=dotted];
98 -> {99}; 98 -> {99} [style=dotted];
99 -> {81} [color=green style=dashed]; 99 -> {100};
100 -> {101}; 100 -> {101};
101 -> {102}; 101 -> {83} [color=green style=dashed];
102 -> {103}; 102 -> {103};
103 -> {104};
104 -> {105};
subgraph cluster_33 { subgraph cluster_34 {
color=red color=red
104 [label="Enter function testWhileFalse" style="filled" fillcolor=red]; 106 [label="Enter function testWhileFalse" style="filled" fillcolor=red];
subgraph cluster_34 { subgraph cluster_35 {
color=blue color=blue
105 [label="Enter block"]; 107 [label="Enter block"];
subgraph cluster_35 { subgraph cluster_36 {
color=blue color=blue
106 [label="Enter while loop"]; 108 [label="Enter while loop"];
subgraph cluster_36 {
color=blue
107 [label="Enter loop condition"];
108 [label="Const: Boolean(false)"];
109 [label="Exit loop condition"];
}
subgraph cluster_37 { subgraph cluster_37 {
color=blue color=blue
110 [label="Enter loop block" style="filled" fillcolor=gray]; 109 [label="Enter loop condition"];
subgraph cluster_38 { 110 [label="Const: Boolean(false)"];
color=blue 111 [label="Exit loop condition"];
111 [label="Enter block" style="filled" fillcolor=gray];
112 [label="Const: Int(1)" style="filled" fillcolor=gray];
113 [label="Exit block" style="filled" fillcolor=gray];
}
114 [label="Exit loop block" style="filled" fillcolor=gray];
} }
115 [label="Exit whileloop"]; 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];
}
117 [label="Exit whileloop"];
} }
116 [label="Const: Int(1)"]; 118 [label="Const: Int(1)"];
117 [label="Exit block"]; 119 [label="Exit block"];
} }
118 [label="Exit function testWhileFalse" style="filled" fillcolor=red]; 120 [label="Exit function testWhileFalse" style="filled" fillcolor=red];
} }
104 -> {105};
105 -> {106};
106 -> {107}; 106 -> {107};
107 -> {108}; 107 -> {108};
108 -> {109}; 108 -> {109};
109 -> {115}; 109 -> {110};
109 -> {110} [style=dotted]; 110 -> {111};
110 -> {111} [style=dotted]; 111 -> {117};
111 -> {112} [style=dotted]; 111 -> {112} [style=dotted];
112 -> {113} [style=dotted]; 112 -> {113} [style=dotted];
113 -> {114} [style=dotted]; 113 -> {114} [style=dotted];
114 -> {107} [color=green style=dotted]; 114 -> {115} [style=dotted];
115 -> {116}; 115 -> {116} [style=dotted];
116 -> {117}; 116 -> {109} [color=green style=dotted];
117 -> {118}; 117 -> {118};
118 -> {119};
subgraph cluster_39 {
color=red
119 [label="Enter function testDoWhileTrue" style="filled" fillcolor=red];
subgraph cluster_40 {
color=blue
120 [label="Enter block"];
subgraph cluster_41 {
color=blue
121 [label="Enter do-while loop"];
subgraph cluster_42 {
color=blue
122 [label="Enter loop block"];
subgraph cluster_43 {
color=blue
123 [label="Enter block"];
124 [label="Const: Int(1)"];
125 [label="Exit block"];
}
126 [label="Exit loop block"];
}
subgraph cluster_44 {
color=blue
127 [label="Enter loop condition"];
128 [label="Const: Boolean(true)"];
129 [label="Exit loop condition"];
}
130 [label="Exit do-whileloop" style="filled" fillcolor=gray];
}
131 [label="Const: Int(1)" style="filled" fillcolor=gray];
132 [label="Exit block" style="filled" fillcolor=gray];
}
133 [label="Exit function testDoWhileTrue" style="filled" fillcolor=red style="filled" fillcolor=gray];
}
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-whileloop" 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=red style="filled" fillcolor=gray];
}
121 -> {122}; 121 -> {122};
122 -> {123}; 122 -> {123};
123 -> {124}; 123 -> {124};
@@ -406,128 +411,128 @@ digraph loops_kt {
126 -> {127}; 126 -> {127};
127 -> {128}; 127 -> {128};
128 -> {129}; 128 -> {129};
129 -> {130} [style=dotted]; 129 -> {130};
129 -> {122} [color=green style=dashed]; 130 -> {131};
130 -> {131} [style=dotted];
131 -> {132} [style=dotted]; 131 -> {132} [style=dotted];
131 -> {124} [color=green style=dashed];
132 -> {133} [style=dotted]; 132 -> {133} [style=dotted];
133 -> {134} [style=dotted];
134 -> {135} [style=dotted];
subgraph cluster_45 { subgraph cluster_46 {
color=red color=red
134 [label="Enter function testDoWhileTrueWithBreak" style="filled" fillcolor=red]; 136 [label="Enter function testDoWhileTrueWithBreak" style="filled" fillcolor=red];
subgraph cluster_46 { subgraph cluster_47 {
color=blue color=blue
135 [label="Enter block"]; 137 [label="Enter block"];
subgraph cluster_47 { subgraph cluster_48 {
color=blue color=blue
136 [label="Enter do-while loop"]; 138 [label="Enter do-while loop"];
subgraph cluster_48 { subgraph cluster_49 {
color=blue color=blue
137 [label="Enter loop block"]; 139 [label="Enter loop block"];
subgraph cluster_49 { subgraph cluster_50 {
color=blue color=blue
138 [label="Enter block"]; 140 [label="Enter block"];
subgraph cluster_50 { subgraph cluster_51 {
color=blue color=blue
139 [label="Enter when"]; 141 [label="Enter when"];
subgraph cluster_51 {
color=blue
140 [label="Enter when branch condition "];
141 [label="Access variable R|<local>/b|"];
142 [label="Exit when branch condition"];
}
143 [label="Synthetic else branch"];
144 [label="Enter when branch result"];
subgraph cluster_52 { subgraph cluster_52 {
color=blue color=blue
145 [label="Enter block"]; 142 [label="Enter when branch condition "];
146 [label="Jump: break@@@[Boolean(true)] "]; 143 [label="Access variable R|<local>/b|"];
147 [label="Stub" style="filled" fillcolor=gray]; 144 [label="Exit when branch condition"];
148 [label="Exit block" style="filled" fillcolor=gray];
} }
149 [label="Exit when branch result" style="filled" fillcolor=gray]; 145 [label="Synthetic else branch"];
150 [label="Exit when"]; 146 [label="Enter when branch result"];
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];
}
151 [label="Exit when branch result" style="filled" fillcolor=gray];
152 [label="Exit when"];
} }
151 [label="Exit block"]; 153 [label="Exit block"];
} }
152 [label="Exit loop block"]; 154 [label="Exit loop block"];
} }
subgraph cluster_53 { subgraph cluster_54 {
color=blue color=blue
153 [label="Enter loop condition"]; 155 [label="Enter loop condition"];
154 [label="Const: Boolean(true)"]; 156 [label="Const: Boolean(true)"];
155 [label="Exit loop condition"]; 157 [label="Exit loop condition"];
} }
156 [label="Exit do-whileloop"]; 158 [label="Exit do-whileloop"];
} }
157 [label="Const: Int(1)"]; 159 [label="Const: Int(1)"];
158 [label="Exit block"]; 160 [label="Exit block"];
} }
159 [label="Exit function testDoWhileTrueWithBreak" style="filled" fillcolor=red]; 161 [label="Exit function testDoWhileTrueWithBreak" style="filled" fillcolor=red];
} }
134 -> {135};
135 -> {136};
136 -> {137}; 136 -> {137};
137 -> {138}; 137 -> {138};
138 -> {139}; 138 -> {139};
139 -> {140}; 139 -> {140};
140 -> {141}; 140 -> {141};
141 -> {142}; 141 -> {142};
142 -> {144 143}; 142 -> {143};
143 -> {150}; 143 -> {144};
144 -> {145}; 144 -> {146 145};
145 -> {146}; 145 -> {152};
146 -> {156}; 146 -> {147};
146 -> {147} [style=dotted]; 147 -> {148};
147 -> {148} [style=dotted]; 148 -> {158};
148 -> {149} [style=dotted]; 148 -> {149} [style=dotted];
149 -> {150} [style=dotted]; 149 -> {150} [style=dotted];
150 -> {151}; 150 -> {151} [style=dotted];
151 -> {152}; 151 -> {152} [style=dotted];
152 -> {153}; 152 -> {153};
153 -> {154}; 153 -> {154};
154 -> {155}; 154 -> {155};
155 -> {156} [style=dotted]; 155 -> {156};
155 -> {137} [color=green style=dashed];
156 -> {157}; 156 -> {157};
157 -> {158}; 157 -> {158} [style=dotted];
157 -> {139} [color=green style=dashed];
158 -> {159}; 158 -> {159};
159 -> {160};
subgraph cluster_54 {
color=red
160 [label="Enter function testDoWhileFalse" style="filled" fillcolor=red];
subgraph cluster_55 {
color=blue
161 [label="Enter block"];
subgraph cluster_56 {
color=blue
162 [label="Enter do-while loop"];
subgraph cluster_57 {
color=blue
163 [label="Enter loop block"];
subgraph cluster_58 {
color=blue
164 [label="Enter block"];
165 [label="Const: Int(1)"];
166 [label="Exit block"];
}
167 [label="Exit loop block"];
}
subgraph cluster_59 {
color=blue
168 [label="Enter loop condition"];
169 [label="Const: Boolean(false)"];
170 [label="Exit loop condition"];
}
171 [label="Exit do-whileloop"];
}
172 [label="Const: Int(1)"];
173 [label="Exit block"];
}
174 [label="Exit function testDoWhileFalse" style="filled" fillcolor=red];
}
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-whileloop"];
}
174 [label="Const: Int(1)"];
175 [label="Exit block"];
}
176 [label="Exit function testDoWhileFalse" style="filled" fillcolor=red];
}
162 -> {163}; 162 -> {163};
163 -> {164}; 163 -> {164};
164 -> {165}; 164 -> {165};
@@ -537,9 +542,11 @@ digraph loops_kt {
168 -> {169}; 168 -> {169};
169 -> {170}; 169 -> {170};
170 -> {171}; 170 -> {171};
170 -> {163} [color=green style=dotted];
171 -> {172}; 171 -> {172};
172 -> {173}; 172 -> {173};
172 -> {165} [color=green style=dotted];
173 -> {174}; 173 -> {174};
174 -> {175};
175 -> {176};
} }
@@ -14,10 +14,13 @@ FILE: loops.kt
(R|<local>/x| is R|kotlin/String|) (R|<local>/x| is R|kotlin/String|)
} }
public final fun testFor(x: R|kotlin/Any?|): R|kotlin/Unit| { public final fun testFor(x: R|kotlin/Any?|): R|kotlin/Unit| {
lval <iterator>: R|kotlin/collections/IntIterator| = Int(0).R|kotlin/Int.rangeTo|(Int(5)).R|kotlin/ranges/IntProgression.iterator|() {
while(R|<local>/<iterator>|.R|kotlin/collections/Iterator.hasNext|()) { lval <iterator>: R|kotlin/collections/IntIterator| = Int(0).R|kotlin/Int.rangeTo|(Int(5)).R|kotlin/ranges/IntProgression.iterator|()
lval i: R|kotlin/Int| = R|<local>/<iterator>|.R|kotlin/collections/IntIterator.next|() while(R|<local>/<iterator>|.R|kotlin/collections/Iterator.hasNext|()) {
lval y: R|kotlin/Boolean| = (R|<local>/x| is R|kotlin/String|) 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|)
}
} }
(R|<local>/x| is R|kotlin/String|) (R|<local>/x| is R|kotlin/String|)
@@ -20,10 +20,13 @@ FILE: enumValues.kt
} }
public final fun foo(): R|kotlin/Unit| { public final fun foo(): R|kotlin/Unit| {
lval values: R|kotlin/Array<MyEnum>| = Q|MyEnum|.R|/MyEnum.values|() lval values: R|kotlin/Array<MyEnum>| = Q|MyEnum|.R|/MyEnum.values|()
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|kotlin/collections/Iterator.hasNext|()) { lval <iterator>: R|kotlin/collections/Iterator<MyEnum>| = R|<local>/values|.R|SubstitutionOverride<kotlin/Array.iterator: R|kotlin/collections/Iterator<MyEnum>|>|()
lval value: R|MyEnum| = R|<local>/<iterator>|.R|SubstitutionOverride<kotlin/collections/Iterator.next: R|MyEnum|>|() while(R|<local>/<iterator>|.R|kotlin/collections/Iterator.hasNext|()) {
R|<local>/value|.R|/MyEnum.bar|() lval value: R|MyEnum| = R|<local>/<iterator>|.R|SubstitutionOverride<kotlin/collections/Iterator.next: R|MyEnum|>|()
R|<local>/value|.R|/MyEnum.bar|()
}
} }
lval first: R|MyEnum| = Q|MyEnum|.R|/MyEnum.valueOf|(String(FIRST)) lval first: R|MyEnum| = Q|MyEnum|.R|/MyEnum.valueOf|(String(FIRST))
@@ -66,10 +66,13 @@ FILE: CanBeValChecker.kt
public final fun stackOverflowBug(): R|kotlin/Unit| { public final fun stackOverflowBug(): R|kotlin/Unit| {
lvar a: R|kotlin/Int| lvar a: R|kotlin/Int|
R|<local>/a| = Int(1) R|<local>/a| = Int(1)
lval <iterator>: R|kotlin/collections/IntIterator| = Int(1).R|kotlin/Int.rangeTo|(Int(10)).R|kotlin/ranges/IntProgression.iterator|() {
while(R|<local>/<iterator>|.R|kotlin/collections/Iterator.hasNext|()) { lval <iterator>: R|kotlin/collections/IntIterator| = Int(1).R|kotlin/Int.rangeTo|(Int(10)).R|kotlin/ranges/IntProgression.iterator|()
lval i: R|kotlin/Int| = R|<local>/<iterator>|.R|kotlin/collections/IntIterator.next|() while(R|<local>/<iterator>|.R|kotlin/collections/Iterator.hasNext|()) {
R|kotlin/io/print|(R|<local>/i|) lval i: R|kotlin/Int| = R|<local>/<iterator>|.R|kotlin/collections/IntIterator.next|()
R|kotlin/io/print|(R|<local>/i|)
}
} }
} }
@@ -1,8 +1,11 @@
FILE: NoWarning.kt FILE: NoWarning.kt
public final fun foo(): R|kotlin/Unit| { public final fun foo(): R|kotlin/Unit| {
lval <iterator>: R|kotlin/collections/IntIterator| = Int(1).R|kotlin/Int.rangeTo|(Int(2)).R|kotlin/ranges/IntProgression.iterator|() {
while(R|<local>/<iterator>|.R|kotlin/collections/Iterator.hasNext|()) { lval <iterator>: R|kotlin/collections/IntIterator| = Int(1).R|kotlin/Int.rangeTo|(Int(2)).R|kotlin/ranges/IntProgression.iterator|()
lval i: R|kotlin/Int| = R|<local>/<iterator>|.R|kotlin/collections/IntIterator.next|() while(R|<local>/<iterator>|.R|kotlin/collections/Iterator.hasNext|()) {
lval i: R|kotlin/Int| = R|<local>/<iterator>|.R|kotlin/collections/IntIterator.next|()
}
} }
lval a: R|kotlin/ranges/IntRange| = Int(3).R|kotlin/Int.rangeTo|(Int(4)) lval a: R|kotlin/ranges/IntRange| = Int(3).R|kotlin/Int.rangeTo|(Int(4))
@@ -14,9 +17,12 @@ FILE: NoWarning.kt
} }
public final fun backward(): R|kotlin/Unit| { public final fun backward(): R|kotlin/Unit| {
lval <iterator>: R|kotlin/collections/IntIterator| = Int(2).R|kotlin/ranges/downTo|(Int(1)).R|kotlin/ranges/IntProgression.iterator|() {
while(R|<local>/<iterator>|.R|kotlin/collections/Iterator.hasNext|()) { lval <iterator>: R|kotlin/collections/IntIterator| = Int(2).R|kotlin/ranges/downTo|(Int(1)).R|kotlin/ranges/IntProgression.iterator|()
lval i: R|kotlin/Int| = R|<local>/<iterator>|.R|kotlin/collections/IntIterator.next|() while(R|<local>/<iterator>|.R|kotlin/collections/Iterator.hasNext|()) {
lval i: R|kotlin/Int| = R|<local>/<iterator>|.R|kotlin/collections/IntIterator.next|()
}
} }
lval a: R|kotlin/ranges/IntProgression| = Int(4).R|kotlin/ranges/downTo|(Int(3)) lval a: R|kotlin/ranges/IntProgression| = Int(4).R|kotlin/ranges/downTo|(Int(3))
@@ -28,9 +34,12 @@ FILE: NoWarning.kt
} }
public final fun until(): R|kotlin/Unit| { public final fun until(): R|kotlin/Unit| {
lval <iterator>: R|kotlin/collections/IntIterator| = Int(1).R|kotlin/ranges/until|(Int(2)).R|kotlin/ranges/IntProgression.iterator|() {
while(R|<local>/<iterator>|.R|kotlin/collections/Iterator.hasNext|()) { lval <iterator>: R|kotlin/collections/IntIterator| = Int(1).R|kotlin/ranges/until|(Int(2)).R|kotlin/ranges/IntProgression.iterator|()
lval i: R|kotlin/Int| = R|<local>/<iterator>|.R|kotlin/collections/IntIterator.next|() while(R|<local>/<iterator>|.R|kotlin/collections/Iterator.hasNext|()) {
lval i: R|kotlin/Int| = R|<local>/<iterator>|.R|kotlin/collections/IntIterator.next|()
}
} }
lval a: R|kotlin/ranges/IntRange| = Int(3).R|kotlin/ranges/until|(Int(4)) lval a: R|kotlin/ranges/IntRange| = Int(3).R|kotlin/ranges/until|(Int(4))
@@ -1,8 +1,11 @@
FILE: Warning.kt FILE: Warning.kt
public final fun foo(): R|kotlin/Unit| { public final fun foo(): R|kotlin/Unit| {
lval <iterator>: R|kotlin/collections/IntIterator| = Int(2).R|kotlin/Int.rangeTo|(Int(1)).R|kotlin/ranges/IntProgression.iterator|() {
while(R|<local>/<iterator>|.R|kotlin/collections/Iterator.hasNext|()) { lval <iterator>: R|kotlin/collections/IntIterator| = Int(2).R|kotlin/Int.rangeTo|(Int(1)).R|kotlin/ranges/IntProgression.iterator|()
lval i: R|kotlin/Int| = R|<local>/<iterator>|.R|kotlin/collections/IntIterator.next|() while(R|<local>/<iterator>|.R|kotlin/collections/Iterator.hasNext|()) {
lval i: R|kotlin/Int| = R|<local>/<iterator>|.R|kotlin/collections/IntIterator.next|()
}
} }
lval a: R|kotlin/ranges/IntRange| = Int(10).R|kotlin/Int.rangeTo|(Int(0)) lval a: R|kotlin/ranges/IntRange| = Int(10).R|kotlin/Int.rangeTo|(Int(0))
@@ -14,9 +17,12 @@ FILE: Warning.kt
} }
public final fun backward(): R|kotlin/Unit| { public final fun backward(): R|kotlin/Unit| {
lval <iterator>: R|kotlin/collections/IntIterator| = Int(1).R|kotlin/ranges/downTo|(Int(2)).R|kotlin/ranges/IntProgression.iterator|() {
while(R|<local>/<iterator>|.R|kotlin/collections/Iterator.hasNext|()) { lval <iterator>: R|kotlin/collections/IntIterator| = Int(1).R|kotlin/ranges/downTo|(Int(2)).R|kotlin/ranges/IntProgression.iterator|()
lval i: R|kotlin/Int| = R|<local>/<iterator>|.R|kotlin/collections/IntIterator.next|() while(R|<local>/<iterator>|.R|kotlin/collections/Iterator.hasNext|()) {
lval i: R|kotlin/Int| = R|<local>/<iterator>|.R|kotlin/collections/IntIterator.next|()
}
} }
lval a: R|kotlin/ranges/IntProgression| = Int(-3).R|kotlin/ranges/downTo|(Int(4)) lval a: R|kotlin/ranges/IntProgression| = Int(-3).R|kotlin/ranges/downTo|(Int(4))
@@ -28,9 +34,12 @@ FILE: Warning.kt
} }
public final fun until(): R|kotlin/Unit| { public final fun until(): R|kotlin/Unit| {
lval <iterator>: R|kotlin/collections/IntIterator| = Int(1).R|kotlin/ranges/until|(Int(1)).R|kotlin/ranges/IntProgression.iterator|() {
while(R|<local>/<iterator>|.R|kotlin/collections/Iterator.hasNext|()) { lval <iterator>: R|kotlin/collections/IntIterator| = Int(1).R|kotlin/ranges/until|(Int(1)).R|kotlin/ranges/IntProgression.iterator|()
lval i: R|kotlin/Int| = R|<local>/<iterator>|.R|kotlin/collections/IntIterator.next|() while(R|<local>/<iterator>|.R|kotlin/collections/Iterator.hasNext|()) {
lval i: R|kotlin/Int| = R|<local>/<iterator>|.R|kotlin/collections/IntIterator.next|()
}
} }
lval a: R|kotlin/ranges/IntRange| = Int(4).R|kotlin/ranges/until|(Int(3)) lval a: R|kotlin/ranges/IntRange| = Int(4).R|kotlin/ranges/until|(Int(3))
@@ -3,18 +3,21 @@ FILE: manyLocalVariables.kt
lvar a: R|kotlin/Int| = Int(1) lvar a: R|kotlin/Int| = Int(1)
lvar b: R|kotlin/Int| = Int(2) lvar b: R|kotlin/Int| = Int(2)
lvar c: R|kotlin/Int| = Int(3) lvar c: R|kotlin/Int| = Int(3)
lval <iterator>: R|kotlin/collections/IntIterator| = Int(0).R|kotlin/Int.rangeTo|(Int(5)).R|kotlin/ranges/IntProgression.iterator|() {
while(R|<local>/<iterator>|.R|kotlin/collections/Iterator.hasNext|()) { lval <iterator>: R|kotlin/collections/IntIterator| = Int(0).R|kotlin/Int.rangeTo|(Int(5)).R|kotlin/ranges/IntProgression.iterator|()
lval i: R|kotlin/Int| = R|<local>/<iterator>|.R|kotlin/collections/IntIterator.next|() while(R|<local>/<iterator>|.R|kotlin/collections/Iterator.hasNext|()) {
when () { lval i: R|kotlin/Int| = R|<local>/<iterator>|.R|kotlin/collections/IntIterator.next|()
==(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|
}
} }
} }
} }
+9 -6
View File
@@ -8,12 +8,15 @@ FILE: fib.kt
lvar current: R|kotlin/Int| = Int(1) lvar current: R|kotlin/Int| = Int(1)
lvar prev: R|kotlin/Int| = Int(1) lvar prev: R|kotlin/Int| = Int(1)
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|kotlin/collections/Iterator.hasNext|()) { lval <iterator>: R|kotlin/collections/IntIterator| = Int(2).R|kotlin/Int.rangeTo|(R|<local>/n|).R|kotlin/ranges/IntProgression.iterator|()
lval i: R|kotlin/Int| = R|<local>/<iterator>|.R|kotlin/collections/IntIterator.next|() while(R|<local>/<iterator>|.R|kotlin/collections/Iterator.hasNext|()) {
lval temp: R|kotlin/Int| = R|<local>/current| lval i: R|kotlin/Int| = R|<local>/<iterator>|.R|kotlin/collections/IntIterator.next|()
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|
}
} }
^fibIterative R|<local>/current| ^fibIterative R|<local>/current|
@@ -5,18 +5,24 @@ FILE: nestedExtensionFunctionType.kt
R|<local>/f|.R|SubstitutionOverride<kotlin/Function1.invoke: R|kotlin/Unit|>|(R|<local>/a|) R|<local>/f|.R|SubstitutionOverride<kotlin/Function1.invoke: R|kotlin/Unit|>|(R|<local>/a|)
} }
public final fun test_1(a: R|A|, ys: R|kotlin/collections/List<@ExtensionFunctionType kotlin/Function1<A, kotlin/Unit>>|): R|kotlin/Unit| { public final fun test_1(a: R|A|, ys: R|kotlin/collections/List<@ExtensionFunctionType kotlin/Function1<A, kotlin/Unit>>|): R|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|kotlin/collections/Iterator.hasNext|()) { 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 y: R|(A) -> kotlin/Unit| = R|<local>/<iterator>|.R|SubstitutionOverride<kotlin/collections/Iterator.next: R|(A) -> kotlin/Unit|>|() while(R|<local>/<iterator>|.R|kotlin/collections/Iterator.hasNext|()) {
R|<local>/y|.R|SubstitutionOverride<kotlin/Function1.invoke: R|kotlin/Unit|>|(R|<local>/a|) 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|)
}
} }
} }
public final fun test_2(a: R|A|, vararg zs: @R|kotlin/ExtensionFunctionType|() R|kotlin/Array<out @ExtensionFunctionType kotlin/Function1<A, kotlin/Unit>>|): R|kotlin/Unit| { public final fun test_2(a: R|A|, vararg zs: @R|kotlin/ExtensionFunctionType|() R|kotlin/Array<out @ExtensionFunctionType kotlin/Function1<A, kotlin/Unit>>|): R|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|kotlin/collections/Iterator.hasNext|()) { 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 z: R|(A) -> kotlin/Unit| = R|<local>/<iterator>|.R|SubstitutionOverride<kotlin/collections/Iterator.next: R|(A) -> kotlin/Unit|>|() while(R|<local>/<iterator>|.R|kotlin/collections/Iterator.hasNext|()) {
R|<local>/z|.R|SubstitutionOverride<kotlin/Function1.invoke: R|kotlin/Unit|>|(R|<local>/a|) 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|)
}
} }
} }
@@ -10,17 +10,20 @@ FILE: boundSmartcastsInBranches.kt
} }
public final fun test_0(list: R|kotlin/collections/List<A>|): R|kotlin/Unit| { public final fun test_0(list: R|kotlin/collections/List<A>|): R|kotlin/Unit| {
lvar goodA: R|A?| = Null(null) lvar goodA: R|A?| = Null(null)
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|kotlin/collections/Iterator.hasNext|()) { lval <iterator>: R|kotlin/collections/Iterator<A>| = R|<local>/list|.R|SubstitutionOverride<kotlin/collections/List.iterator: R|kotlin/collections/Iterator<A>|>|()
lval a: R|A| = R|<local>/<iterator>|.R|SubstitutionOverride<kotlin/collections/Iterator.next: R|A|>|() while(R|<local>/<iterator>|.R|kotlin/collections/Iterator.hasNext|()) {
when () { lval a: R|A| = R|<local>/<iterator>|.R|SubstitutionOverride<kotlin/collections/Iterator.next: R|A|>|()
==(R|<local>/goodA|, Null(null)) -> { when () {
R|<local>/goodA| = R|<local>/a| ==(R|<local>/goodA|, Null(null)) -> {
continue@@@[R|<local>/<iterator>|.R|kotlin/collections/Iterator.hasNext|()] R|<local>/goodA| = R|<local>/a|
continue@@@[R|<local>/<iterator>|.R|kotlin/collections/Iterator.hasNext|()]
}
} }
R|<local>/goodA|.R|/A.s|
} }
R|<local>/goodA|.R|/A.s|
} }
} }
@@ -166,83 +166,88 @@ digraph smartcastToNothing_kt {
52 [label="Enter block"]; 52 [label="Enter block"];
53 [label="Const: Null(null)"]; 53 [label="Const: Null(null)"];
54 [label="Variable declaration: lvar s: R|A?|"]; 54 [label="Variable declaration: lvar s: R|A?|"];
55 [label="Access variable R|<local>/results|"];
56 [label="Function call: R|<local>/results|.R|SubstitutionOverride<kotlin/collections/List.iterator: R|kotlin/collections/Iterator<kotlin/Nothing>|>|()"];
57 [label="Variable declaration: lval <iterator>: R|kotlin/collections/Iterator<kotlin/Nothing>|"];
subgraph cluster_16 { subgraph cluster_16 {
color=blue color=blue
58 [label="Enter while loop"]; 55 [label="Enter block"];
56 [label="Access variable R|<local>/results|"];
57 [label="Function call: R|<local>/results|.R|SubstitutionOverride<kotlin/collections/List.iterator: R|kotlin/collections/Iterator<kotlin/Nothing>|>|()"];
58 [label="Variable declaration: lval <iterator>: R|kotlin/collections/Iterator<kotlin/Nothing>|"];
subgraph cluster_17 { subgraph cluster_17 {
color=blue color=blue
59 [label="Enter loop condition"]; 59 [label="Enter while loop"];
60 [label="Access variable R|<local>/<iterator>|"]; subgraph cluster_18 {
61 [label="Function call: R|<local>/<iterator>|.R|kotlin/collections/Iterator.hasNext|()"]; color=blue
62 [label="Exit loop condition"]; 60 [label="Enter loop condition"];
} 61 [label="Access variable R|<local>/<iterator>|"];
subgraph cluster_18 { 62 [label="Function call: R|<local>/<iterator>|.R|kotlin/collections/Iterator.hasNext|()"];
color=blue 63 [label="Exit loop condition"];
63 [label="Enter loop block"]; }
subgraph cluster_19 { subgraph cluster_19 {
color=blue color=blue
64 [label="Enter block"]; 64 [label="Enter loop block"];
65 [label="Access variable R|<local>/<iterator>|"];
66 [label="Function call: R|<local>/<iterator>|.R|SubstitutionOverride<kotlin/collections/Iterator.next: R|kotlin/Nothing|>|()"];
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_20 { subgraph cluster_20 {
color=blue color=blue
72 [label="Enter when" style="filled" fillcolor=gray]; 65 [label="Enter block"];
66 [label="Access variable R|<local>/<iterator>|"];
67 [label="Function call: R|<local>/<iterator>|.R|SubstitutionOverride<kotlin/collections/Iterator.next: R|kotlin/Nothing|>|()"];
68 [label="Stub" style="filled" fillcolor=gray];
69 [label="Variable declaration: lval result: R|kotlin/Nothing|" style="filled" fillcolor=gray];
70 [label="Access variable R|<local>/result|" style="filled" fillcolor=gray];
71 [label="Stub" style="filled" fillcolor=gray];
72 [label="Assignment: R|<local>/s|" style="filled" fillcolor=gray];
subgraph cluster_21 { subgraph cluster_21 {
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_22 {
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_23 {
color=blue
81 [label="Enter block" style="filled" fillcolor=gray];
82 [label="Jump: break@@@[R|<local>/<iterator>|.R|kotlin/collections/Iterator.hasNext|()] " style="filled" fillcolor=gray];
83 [label="Stub" style="filled" fillcolor=gray];
84 [label="Exit block" style="filled" fillcolor=gray];
}
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_22 {
color=blue
80 [label="Enter block" style="filled" fillcolor=gray];
81 [label="Jump: break@@@[R|<local>/<iterator>|.R|kotlin/collections/Iterator.hasNext|()] " 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 loop block" style="filled" fillcolor=gray];
} }
87 [label="Exit loop block" style="filled" fillcolor=gray]; 89 [label="Exit whileloop"];
} }
88 [label="Exit whileloop"]; 90 [label="Exit block"];
} }
89 [label="Access variable R|<local>/s|"]; 91 [label="Access variable R|<local>/s|"];
90 [label="Enter safe call"]; 92 [label="Enter safe call"];
91 [label="Postponed enter to lambda"]; 93 [label="Postponed enter to lambda"];
subgraph cluster_23 { subgraph cluster_24 {
color=blue color=blue
98 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; 100 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
subgraph cluster_24 { subgraph cluster_25 {
color=blue color=blue
99 [label="Enter block"]; 101 [label="Enter block"];
100 [label="Access variable R|<local>/it|"]; 102 [label="Access variable R|<local>/it|"];
101 [label="Access variable R|/A.a|"]; 103 [label="Access variable R|/A.a|"];
102 [label="Exit block"]; 104 [label="Exit block"];
} }
103 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; 105 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
} }
92 [label="Call arguments union" style="filled" fillcolor=yellow]; 94 [label="Call arguments union" style="filled" fillcolor=yellow];
93 [label="Postponed exit from lambda"]; 95 [label="Postponed exit from lambda"];
94 [label="Function call: $subj$.R|kotlin/let|<R|A|, R|kotlin/Int|>(...)"]; 96 [label="Function call: $subj$.R|kotlin/let|<R|A|, R|kotlin/Int|>(...)"];
95 [label="Exit safe call"]; 97 [label="Exit safe call"];
96 [label="Exit block"]; 98 [label="Exit block"];
} }
97 [label="Exit function test_0" style="filled" fillcolor=red]; 99 [label="Exit function test_0" style="filled" fillcolor=red];
} }
51 -> {52}; 51 -> {52};
52 -> {53}; 52 -> {53};
@@ -255,52 +260,54 @@ digraph smartcastToNothing_kt {
59 -> {60}; 59 -> {60};
60 -> {61}; 60 -> {61};
61 -> {62}; 61 -> {62};
62 -> {88 63}; 62 -> {63};
63 -> {64}; 63 -> {89 64};
64 -> {65}; 64 -> {65};
65 -> {66}; 65 -> {66};
66 -> {97} [label=onUncaughtException]; 66 -> {67};
66 -> {67} [style=dotted]; 67 -> {99} [label=onUncaughtException];
67 -> {68} [style=dotted]; 67 -> {68} [style=dotted];
68 -> {69} [style=dotted]; 68 -> {69} [style=dotted];
69 -> {70} [style=dotted]; 69 -> {70} [style=dotted];
69 -> {97} [style=dotted] [label=onUncaughtException];
70 -> {71} [style=dotted]; 70 -> {71} [style=dotted];
70 -> {99} [style=dotted] [label=onUncaughtException];
71 -> {72} [style=dotted]; 71 -> {72} [style=dotted];
72 -> {73} [style=dotted]; 72 -> {73} [style=dotted];
73 -> {74} [style=dotted]; 73 -> {74} [style=dotted];
74 -> {75} [style=dotted]; 74 -> {75} [style=dotted];
74 -> {97} [style=dotted] [label=onUncaughtException];
75 -> {76} [style=dotted]; 75 -> {76} [style=dotted];
75 -> {99} [style=dotted] [label=onUncaughtException];
76 -> {77} [style=dotted]; 76 -> {77} [style=dotted];
77 -> {79 78} [style=dotted]; 77 -> {78} [style=dotted];
78 -> {85} [style=dotted]; 78 -> {80 79} [style=dotted];
79 -> {80} [style=dotted]; 79 -> {86} [style=dotted];
80 -> {81} [style=dotted]; 80 -> {81} [style=dotted];
81 -> {88 82} [style=dotted]; 81 -> {82} [style=dotted];
82 -> {83} [style=dotted]; 82 -> {89 83} [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 -> {60} [color=green style=dotted];
89 -> {90 95}; 89 -> {90};
90 -> {91}; 90 -> {91};
91 -> {98}; 91 -> {92 97};
91 -> {93} [color=red]; 92 -> {93};
91 -> {98} [style=dashed]; 93 -> {100};
92 -> {94} [color=red]; 93 -> {95} [color=red];
93 -> {94} [color=green]; 93 -> {100} [style=dashed];
94 -> {95}; 94 -> {96} [color=red];
95 -> {96}; 95 -> {96} [color=green];
96 -> {97}; 96 -> {97};
97 -> {98};
98 -> {99}; 98 -> {99};
99 -> {100};
100 -> {101}; 100 -> {101};
101 -> {102}; 101 -> {102};
102 -> {103}; 102 -> {103};
103 -> {92} [color=red]; 103 -> {104};
103 -> {93} [color=green]; 104 -> {105};
105 -> {94} [color=red];
105 -> {95} [color=green];
} }
@@ -30,14 +30,17 @@ FILE: smartcastToNothing.kt
} }
public final fun test_0(results: R|kotlin/collections/List<kotlin/Nothing>|): R|kotlin/Unit| { public final fun test_0(results: R|kotlin/collections/List<kotlin/Nothing>|): R|kotlin/Unit| {
lvar s: R|A?| = Null(null) lvar s: R|A?| = Null(null)
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|kotlin/collections/Iterator.hasNext|()) { lval <iterator>: R|kotlin/collections/Iterator<kotlin/Nothing>| = R|<local>/results|.R|SubstitutionOverride<kotlin/collections/List.iterator: R|kotlin/collections/Iterator<kotlin/Nothing>|>|()
lval result: R|kotlin/Nothing| = R|<local>/<iterator>|.R|SubstitutionOverride<kotlin/collections/Iterator.next: R|kotlin/Nothing|>|() while(R|<local>/<iterator>|.R|kotlin/collections/Iterator.hasNext|()) {
R|<local>/s| = R|<local>/result| lval result: R|kotlin/Nothing| = R|<local>/<iterator>|.R|SubstitutionOverride<kotlin/collections/Iterator.next: R|kotlin/Nothing|>|()
when () { R|<local>/s| = R|<local>/result|
R|<local>/result|.<Unresolved name: b># -> { when () {
break@@@[R|<local>/<iterator>|.R|kotlin/collections/Iterator.hasNext|()] R|<local>/result|.<Unresolved name: b># -> {
break@@@[R|<local>/<iterator>|.R|kotlin/collections/Iterator.hasNext|()]
}
} }
} }
} }
@@ -9,18 +9,24 @@ FILE: varargInPrimaryConstructor.kt
} }
public final fun test_1(foo: R|Foo|): R|kotlin/Unit| { public final fun test_1(foo: R|Foo|): R|kotlin/Unit| {
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|kotlin/collections/Iterator.hasNext|()) { 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 s: R|kotlin/String| = R|<local>/<iterator>|.R|SubstitutionOverride<kotlin/collections/Iterator.next: R|kotlin/String|>|() while(R|<local>/<iterator>|.R|kotlin/collections/Iterator.hasNext|()) {
R|<local>/s|.R|kotlin/String.length| lval s: R|kotlin/String| = R|<local>/<iterator>|.R|SubstitutionOverride<kotlin/collections/Iterator.next: R|kotlin/String|>|()
R|<local>/s|.R|kotlin/String.length|
}
} }
} }
public final fun test_2(vararg strings: R|kotlin/Array<out kotlin/String>|): R|kotlin/Unit| { public final fun test_2(vararg strings: R|kotlin/Array<out kotlin/String>|): R|kotlin/Unit| {
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|kotlin/collections/Iterator.hasNext|()) { 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 s: R|kotlin/String| = R|<local>/<iterator>|.R|SubstitutionOverride<kotlin/collections/Iterator.next: R|kotlin/String|>|() while(R|<local>/<iterator>|.R|kotlin/collections/Iterator.hasNext|()) {
R|<local>/s|.R|kotlin/String.length| lval s: R|kotlin/String| = R|<local>/<iterator>|.R|SubstitutionOverride<kotlin/collections/Iterator.next: R|kotlin/String|>|()
R|<local>/s|.R|kotlin/String.length|
}
} }
} }
@@ -18,11 +18,14 @@ FILE: components.kt
} }
public final fun foo(list: R|kotlin/collections/List<D>|): R|kotlin/Unit| { public final fun foo(list: R|kotlin/collections/List<D>|): R|kotlin/Unit| {
lval <iterator>: R|kotlin/collections/Iterator<D>| = R|<local>/list|.R|SubstitutionOverride<kotlin/collections/List.iterator: R|kotlin/collections/Iterator<D>|>|() {
while(R|<local>/<iterator>|.R|kotlin/collections/Iterator.hasNext|()) { lval <iterator>: R|kotlin/collections/Iterator<D>| = R|<local>/list|.R|SubstitutionOverride<kotlin/collections/List.iterator: R|kotlin/collections/Iterator<D>|>|()
lval <destruct>: R|D| = R|<local>/<iterator>|.R|SubstitutionOverride<kotlin/collections/Iterator.next: R|D|>|() while(R|<local>/<iterator>|.R|kotlin/collections/Iterator.hasNext|()) {
lval x: R|kotlin/Int| = R|<local>/<destruct>|.R|/D.component1|() lval <destruct>: R|D| = R|<local>/<iterator>|.R|SubstitutionOverride<kotlin/collections/Iterator.next: R|D|>|()
lval y: R|kotlin/String| = R|<local>/<destruct>|.R|/D.component2|() lval x: R|kotlin/Int| = R|<local>/<destruct>|.R|/D.component1|()
lval y: R|kotlin/String| = R|<local>/<destruct>|.R|/D.component2|()
}
} }
lval <destruct>: R|D| = R|<local>/list|.R|kotlin/collections/first|<R|D|>() lval <destruct>: R|D| = R|<local>/list|.R|kotlin/collections/first|<R|D|>()
@@ -128,71 +128,76 @@ digraph flow_kt {
subgraph cluster_16 { subgraph cluster_16 {
color=blue color=blue
56 [label="Enter block"]; 56 [label="Enter block"];
57 [label="Const: Int(0)"];
58 [label="Const: Int(0)"];
59 [label="Function call: Int(0).R|kotlin/Int.rangeTo|(...)"];
60 [label="Function call: Int(0).R|kotlin/Int.rangeTo|(...).R|kotlin/ranges/IntProgression.iterator|()"];
61 [label="Variable declaration: lval <iterator>: R|kotlin/collections/IntIterator|"];
subgraph cluster_17 { subgraph cluster_17 {
color=blue color=blue
62 [label="Enter while loop"]; 57 [label="Enter block"];
58 [label="Const: Int(0)"];
59 [label="Const: Int(0)"];
60 [label="Function call: Int(0).R|kotlin/Int.rangeTo|(...)"];
61 [label="Function call: Int(0).R|kotlin/Int.rangeTo|(...).R|kotlin/ranges/IntProgression.iterator|()"];
62 [label="Variable declaration: lval <iterator>: R|kotlin/collections/IntIterator|"];
subgraph cluster_18 { subgraph cluster_18 {
color=blue color=blue
63 [label="Enter loop condition"]; 63 [label="Enter while loop"];
64 [label="Access variable R|<local>/<iterator>|"]; subgraph cluster_19 {
65 [label="Function call: R|<local>/<iterator>|.R|kotlin/collections/Iterator.hasNext|()"]; color=blue
66 [label="Exit loop condition"]; 64 [label="Enter loop condition"];
} 65 [label="Access variable R|<local>/<iterator>|"];
subgraph cluster_19 { 66 [label="Function call: R|<local>/<iterator>|.R|kotlin/collections/Iterator.hasNext|()"];
color=blue 67 [label="Exit loop condition"];
67 [label="Enter loop block"]; }
subgraph cluster_20 { subgraph cluster_20 {
color=blue color=blue
68 [label="Enter block"]; 68 [label="Enter loop block"];
69 [label="Access variable R|<local>/<iterator>|"]; subgraph cluster_21 {
70 [label="Function call: R|<local>/<iterator>|.R|kotlin/collections/IntIterator.next|()"]; color=blue
71 [label="Variable declaration: lval i: R|kotlin/Int|"]; 69 [label="Enter block"];
72 [label="Access variable R|<local>/x|"]; 70 [label="Access variable R|<local>/<iterator>|"];
73 [label="Function call: R|<local>/x|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()"]; 71 [label="Function call: R|<local>/<iterator>|.R|kotlin/collections/IntIterator.next|()"];
74 [label="Exit block"]; 72 [label="Variable declaration: lval i: R|kotlin/Int|"];
73 [label="Access variable R|<local>/x|"];
74 [label="Function call: R|<local>/x|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()"];
75 [label="Exit block"];
}
76 [label="Exit loop block"];
} }
75 [label="Exit loop block"]; 77 [label="Exit whileloop"];
} }
76 [label="Exit whileloop"]; 78 [label="Exit block"];
} }
77 [label="Access variable R|<local>/y|"]; 79 [label="Access variable R|<local>/y|"];
78 [label="Function call: R|<local>/y|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()"]; 80 [label="Function call: R|<local>/y|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()"];
79 [label="Exit block"]; 81 [label="Exit block"];
} }
80 [label="Exit when branch result"]; 82 [label="Exit when branch result"];
81 [label="Exit when"]; 83 [label="Exit when"];
} }
subgraph cluster_21 { subgraph cluster_22 {
color=blue color=blue
82 [label="Enter do-while loop"]; 84 [label="Enter do-while loop"];
subgraph cluster_22 { subgraph cluster_23 {
color=blue color=blue
83 [label="Enter loop block"]; 85 [label="Enter loop block"];
subgraph cluster_23 { subgraph cluster_24 {
color=blue color=blue
84 [label="Enter block"]; 86 [label="Enter block"];
85 [label="Access variable R|<local>/z|"]; 87 [label="Access variable R|<local>/z|"];
86 [label="Function call: R|/bar|(...)"]; 88 [label="Function call: R|/bar|(...)"];
87 [label="Exit block"]; 89 [label="Exit block"];
} }
88 [label="Exit loop block"]; 90 [label="Exit loop block"];
} }
subgraph cluster_24 { subgraph cluster_25 {
color=blue color=blue
89 [label="Enter loop condition"]; 91 [label="Enter loop condition"];
90 [label="Const: Boolean(true)"]; 92 [label="Const: Boolean(true)"];
91 [label="Exit loop condition"]; 93 [label="Exit loop condition"];
} }
92 [label="Exit do-whileloop" style="filled" fillcolor=gray]; 94 [label="Exit do-whileloop" style="filled" fillcolor=gray];
} }
93 [label="Exit block" style="filled" fillcolor=gray]; 95 [label="Exit block" style="filled" fillcolor=gray];
} }
94 [label="Exit function foo" style="filled" fillcolor=red]; 96 [label="Exit function foo" style="filled" fillcolor=red];
} }
20 -> {21}; 20 -> {21};
21 -> {22}; 21 -> {22};
@@ -216,7 +221,7 @@ digraph flow_kt {
39 -> {40}; 39 -> {40};
40 -> {41}; 40 -> {41};
41 -> {42}; 41 -> {42};
42 -> {94}; 42 -> {96};
42 -> {43} [style=dotted]; 42 -> {43} [style=dotted];
43 -> {44} [style=dotted]; 43 -> {44} [style=dotted];
44 -> {45} [style=dotted]; 44 -> {45} [style=dotted];
@@ -229,7 +234,7 @@ digraph flow_kt {
51 -> {52}; 51 -> {52};
52 -> {53}; 52 -> {53};
53 -> {54}; 53 -> {54};
54 -> {81}; 54 -> {83};
55 -> {56}; 55 -> {56};
56 -> {57}; 56 -> {57};
57 -> {58}; 57 -> {58};
@@ -241,8 +246,8 @@ digraph flow_kt {
63 -> {64}; 63 -> {64};
64 -> {65}; 64 -> {65};
65 -> {66}; 65 -> {66};
66 -> {76 67}; 66 -> {67};
67 -> {68}; 67 -> {77 68};
68 -> {69}; 68 -> {69};
69 -> {70}; 69 -> {70};
70 -> {71}; 70 -> {71};
@@ -250,8 +255,8 @@ digraph flow_kt {
72 -> {73}; 72 -> {73};
73 -> {74}; 73 -> {74};
74 -> {75}; 74 -> {75};
75 -> {63} [color=green style=dashed]; 75 -> {76};
76 -> {77}; 76 -> {64} [color=green style=dashed];
77 -> {78}; 77 -> {78};
78 -> {79}; 78 -> {79};
79 -> {80}; 79 -> {80};
@@ -266,9 +271,11 @@ digraph flow_kt {
88 -> {89}; 88 -> {89};
89 -> {90}; 89 -> {90};
90 -> {91}; 90 -> {91};
91 -> {92} [style=dotted]; 91 -> {92};
91 -> {83} [color=green style=dashed]; 92 -> {93};
92 -> {93} [style=dotted];
93 -> {94} [style=dotted]; 93 -> {94} [style=dotted];
93 -> {85} [color=green style=dashed];
94 -> {95} [style=dotted];
95 -> {96} [style=dotted];
} }
@@ -26,10 +26,13 @@ FILE: flow.kt
[StubStatement] [StubStatement]
when () { when () {
Boolean(true) -> { Boolean(true) -> {
lval <iterator>: R|kotlin/collections/IntIterator| = Int(0).R|kotlin/Int.rangeTo|(Int(0)).R|kotlin/ranges/IntProgression.iterator|() {
while(R|<local>/<iterator>|.R|kotlin/collections/Iterator.hasNext|()) { lval <iterator>: R|kotlin/collections/IntIterator| = Int(0).R|kotlin/Int.rangeTo|(Int(0)).R|kotlin/ranges/IntProgression.iterator|()
lval i: R|kotlin/Int| = R|<local>/<iterator>|.R|kotlin/collections/IntIterator.next|() while(R|<local>/<iterator>|.R|kotlin/collections/Iterator.hasNext|()) {
R|<local>/x|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|() 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>/y|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|() R|<local>/y|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()
@@ -171,59 +171,92 @@ FILE: forLoopChecker.kt
} }
public final fun test(notRange1: R|NotRange1|, notRange2: R|NotRange2|, notRange3: R|NotRange3|, notRange4: R|NotRange4|, notRange5: R|NotRange5|, notRange6: R|NotRange6|, notRange7: R|NotRange7|, notRange8: R|NotRange8|, notRange9: R|NotRange9|, range0: R|Range0|, range1: R|Range1|): R|kotlin/Unit| { public final fun test(notRange1: R|NotRange1|, notRange2: R|NotRange2|, notRange3: R|NotRange3|, notRange4: R|NotRange4|, notRange5: R|NotRange5|, notRange6: R|NotRange6|, notRange7: R|NotRange7|, notRange8: R|NotRange8|, notRange9: R|NotRange9|, range0: R|Range0|, range1: R|Range1|): R|kotlin/Unit| {
lval <iterator>: R|ERROR CLASS: Unresolved name: iterator| = R|<local>/notRange1|.<Unresolved name: iterator>#() {
while(R|<local>/<iterator>|.<Unresolved name: hasNext>#()) { lval <iterator>: R|ERROR CLASS: Unresolved name: iterator| = R|<local>/notRange1|.<Unresolved name: iterator>#()
lval i: R|ERROR CLASS: Unresolved name: next| = R|<local>/<iterator>|.<Unresolved name: next>#() while(R|<local>/<iterator>|.<Unresolved name: hasNext>#()) {
lval i: R|ERROR CLASS: Unresolved name: next| = R|<local>/<iterator>|.<Unresolved name: next>#()
}
} }
lval <iterator>: R|kotlin/Unit| = R|<local>/notRange2|.R|/NotRange2.iterator|() {
while(R|<local>/<iterator>|.<Unresolved name: hasNext>#()) { lval <iterator>: R|kotlin/Unit| = R|<local>/notRange2|.R|/NotRange2.iterator|()
lval i: R|ERROR CLASS: Unresolved name: next| = R|<local>/<iterator>|.<Unresolved name: next>#() while(R|<local>/<iterator>|.<Unresolved name: hasNext>#()) {
lval i: R|ERROR CLASS: Unresolved name: next| = R|<local>/<iterator>|.<Unresolved name: next>#()
}
} }
lval <iterator>: R|ImproperIterator1| = R|<local>/notRange3|.R|/NotRange3.iterator|() {
while(R|<local>/<iterator>|.R|/ImproperIterator1.hasNext|()) { lval <iterator>: R|ImproperIterator1| = R|<local>/notRange3|.R|/NotRange3.iterator|()
lval i: R|ERROR CLASS: Unresolved name: next| = R|<local>/<iterator>|.<Unresolved name: next>#() while(R|<local>/<iterator>|.R|/ImproperIterator1.hasNext|()) {
lval i: R|ERROR CLASS: Unresolved name: next| = R|<local>/<iterator>|.<Unresolved name: next>#()
}
} }
lval <iterator>: R|ImproperIterator2| = R|<local>/notRange4|.R|/NotRange4.iterator|() {
while(R|<local>/<iterator>|.<Unresolved name: hasNext>#()) { lval <iterator>: R|ImproperIterator2| = R|<local>/notRange4|.R|/NotRange4.iterator|()
lval i: R|kotlin/Boolean| = R|<local>/<iterator>|.R|/ImproperIterator2.next|() while(R|<local>/<iterator>|.<Unresolved name: hasNext>#()) {
lval i: R|kotlin/Boolean| = R|<local>/<iterator>|.R|/ImproperIterator2.next|()
}
} }
lval <iterator>: R|ImproperIterator3| = R|<local>/notRange5|.R|/NotRange5.iterator|() {
while(R|<local>/<iterator>|.R|/ImproperIterator3.hasNext|()) { lval <iterator>: R|ImproperIterator3| = R|<local>/notRange5|.R|/NotRange5.iterator|()
lval i: R|kotlin/Int| = R|<local>/<iterator>|.R|/ImproperIterator3.next|() while(R|<local>/<iterator>|.R|/ImproperIterator3.hasNext|()) {
lval i: R|kotlin/Int| = R|<local>/<iterator>|.R|/ImproperIterator3.next|()
}
} }
lval <iterator>: R|AmbiguousHasNextIterator| = R|<local>/notRange6|.R|/NotRange6.iterator|() {
while(R|<local>/<iterator>|.R|/AmbiguousHasNextIterator.hasNext|()) { lval <iterator>: R|AmbiguousHasNextIterator| = R|<local>/notRange6|.R|/NotRange6.iterator|()
lval i: R|kotlin/Int| = R|<local>/<iterator>|.R|/AmbiguousHasNextIterator.next|() while(R|<local>/<iterator>|.R|/AmbiguousHasNextIterator.hasNext|()) {
lval i: R|kotlin/Int| = R|<local>/<iterator>|.R|/AmbiguousHasNextIterator.next|()
}
} }
lval <iterator>: R|ImproperIterator3| = R|<local>/notRange7|.R|/NotRange7.iterator|() {
while(R|<local>/<iterator>|.R|/ImproperIterator3.hasNext|()) { lval <iterator>: R|ImproperIterator3| = R|<local>/notRange7|.R|/NotRange7.iterator|()
lval i: R|kotlin/Int| = R|<local>/<iterator>|.R|/ImproperIterator3.next|() while(R|<local>/<iterator>|.R|/ImproperIterator3.hasNext|()) {
lval i: R|kotlin/Int| = R|<local>/<iterator>|.R|/ImproperIterator3.next|()
}
} }
lval <iterator>: R|ImproperIterator5| = R|<local>/notRange8|.R|/NotRange8.iterator|() {
while(R|<local>/<iterator>|.<Unresolved name: hasNext>#()) { lval <iterator>: R|ImproperIterator5| = R|<local>/notRange8|.R|/NotRange8.iterator|()
lval i: R|kotlin/Int| = R|<local>/<iterator>|.R|/ImproperIterator5.next|() while(R|<local>/<iterator>|.<Unresolved name: hasNext>#()) {
lval i: R|kotlin/Int| = R|<local>/<iterator>|.R|/ImproperIterator5.next|()
}
} }
lval <iterator>: R|ImproperIterator6| = R|<local>/notRange9|.R|/NotRange9.iterator|() {
while(R|<local>/<iterator>|.R|/ImproperIterator6.hasNext|()) { lval <iterator>: R|ImproperIterator6| = R|<local>/notRange9|.R|/NotRange9.iterator|()
lval i: R|kotlin/Int| = R|<local>/<iterator>|.R|/ImproperIterator6.next|() while(R|<local>/<iterator>|.R|/ImproperIterator6.hasNext|()) {
lval i: R|kotlin/Int| = R|<local>/<iterator>|.R|/ImproperIterator6.next|()
}
} }
lval <iterator>: R|GoodIterator| = R|<local>/range0|.R|/Range0.iterator|() {
while(R|<local>/<iterator>|.R|/GoodIterator.hasNext|()) { lval <iterator>: R|GoodIterator| = R|<local>/range0|.R|/Range0.iterator|()
lval i: R|kotlin/Int| = R|<local>/<iterator>|.R|/GoodIterator.next|() while(R|<local>/<iterator>|.R|/GoodIterator.hasNext|()) {
lval i: R|kotlin/Int| = R|<local>/<iterator>|.R|/GoodIterator.next|()
}
} }
lval <iterator>: R|kotlin/collections/Iterator<kotlin/Int>| = R|<local>/range1|.R|/Range1.iterator|() {
while(R|<local>/<iterator>|.R|kotlin/collections/Iterator.hasNext|()) { lval <iterator>: R|kotlin/collections/Iterator<kotlin/Int>| = R|<local>/range1|.R|/Range1.iterator|()
lval i: R|kotlin/Int| = R|<local>/<iterator>|.R|SubstitutionOverride<kotlin/collections/Iterator.next: R|kotlin/Int|>|() while(R|<local>/<iterator>|.R|kotlin/collections/Iterator.hasNext|()) {
lval i: R|kotlin/Int| = R|<local>/<iterator>|.R|SubstitutionOverride<kotlin/collections/Iterator.next: R|kotlin/Int|>|()
}
} }
} }
@@ -42,15 +42,18 @@ FILE: DeepCopyIrTree.kt
} }
) )
this@R|/DeepCopyIrTreeWithSymbols|.R|/DeepCopyIrTreeWithSymbols.typeRemapper|.R|/withinScope|<R|kotlin/Unit|>(this@R|/DeepCopyIrTreeWithSymbols.copyTypeParametersFrom|, <L> = withinScope@fun <anonymous>(): R|kotlin/Unit| <inline=Inline, kind=UNKNOWN> { this@R|/DeepCopyIrTreeWithSymbols|.R|/DeepCopyIrTreeWithSymbols.typeRemapper|.R|/withinScope|<R|kotlin/Unit|>(this@R|/DeepCopyIrTreeWithSymbols.copyTypeParametersFrom|, <L> = withinScope@fun <anonymous>(): R|kotlin/Unit| <inline=Inline, kind=UNKNOWN> {
lval <iterator>: R|kotlin/collections/Iterator<kotlin/Pair<IrTypeParameter, IrTypeParameter>>| = this@R|/DeepCopyIrTreeWithSymbols.copyTypeParametersFrom|.R|/IrTypeParametersContainer.typeParameters|.R|kotlin/collections/zip|<R|IrTypeParameter|, R|IrTypeParameter|>(R|<local>/other|.R|/IrTypeParametersContainer.typeParameters|).R|SubstitutionOverride<kotlin/collections/List.iterator: R|kotlin/collections/Iterator<kotlin/Pair<IrTypeParameter, IrTypeParameter>>|>|() {
while(R|<local>/<iterator>|.R|kotlin/collections/Iterator.hasNext|()) { lval <iterator>: R|kotlin/collections/Iterator<kotlin/Pair<IrTypeParameter, IrTypeParameter>>| = this@R|/DeepCopyIrTreeWithSymbols.copyTypeParametersFrom|.R|/IrTypeParametersContainer.typeParameters|.R|kotlin/collections/zip|<R|IrTypeParameter|, R|IrTypeParameter|>(R|<local>/other|.R|/IrTypeParametersContainer.typeParameters|).R|SubstitutionOverride<kotlin/collections/List.iterator: R|kotlin/collections/Iterator<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>|>|() while(R|<local>/<iterator>|.R|kotlin/collections/Iterator.hasNext|()) {
lval thisTypeParameter: R|IrTypeParameter| = R|<local>/<destruct>|.R|SubstitutionOverride<kotlin/Pair.component1: R|IrTypeParameter|>|() lval <destruct>: R|kotlin/Pair<IrTypeParameter, IrTypeParameter>| = R|<local>/<iterator>|.R|SubstitutionOverride<kotlin/collections/Iterator.next: R|kotlin/Pair<IrTypeParameter, IrTypeParameter>|>|()
lval otherTypeParameter: R|IrTypeParameter| = R|<local>/<destruct>|.R|SubstitutionOverride<kotlin/Pair.component2: R|IrTypeParameter|>|() lval thisTypeParameter: R|IrTypeParameter| = R|<local>/<destruct>|.R|SubstitutionOverride<kotlin/Pair.component1: 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> { lval otherTypeParameter: R|IrTypeParameter| = R|<local>/<destruct>|.R|SubstitutionOverride<kotlin/Pair.component2: R|IrTypeParameter|>|()
^ 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|)
}
)
} }
)
} }
} }
@@ -44,13 +44,16 @@ FILE: valueOfOrNull.kt
} }
public final inline fun <reified E : R|kotlin/Enum<E>|> valueOfOrNull(value: R|kotlin/String|): R|E?| { public final inline fun <reified E : R|kotlin/Enum<E>|> valueOfOrNull(value: R|kotlin/String|): R|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|kotlin/collections/Iterator.hasNext|()) { lval <iterator>: R|kotlin/collections/Iterator<E>| = R|kotlin/enumValues|<R|E|>().R|SubstitutionOverride<kotlin/Array.iterator: R|kotlin/collections/Iterator<E>|>|()
lval enumValue: R|E| = R|<local>/<iterator>|.R|SubstitutionOverride<kotlin/collections/Iterator.next: R|E|>|() while(R|<local>/<iterator>|.R|kotlin/collections/Iterator.hasNext|()) {
when () { lval enumValue: R|E| = R|<local>/<iterator>|.R|SubstitutionOverride<kotlin/collections/Iterator.next: R|E|>|()
==(R|<local>/enumValue|.R|kotlin/Enum.name|, R|<local>/value|) -> { when () {
^valueOfOrNull R|<local>/enumValue| ==(R|<local>/enumValue|.R|kotlin/Enum.name|, R|<local>/value|) -> {
^valueOfOrNull R|<local>/enumValue|
}
} }
} }
} }
@@ -38,48 +38,47 @@ import org.jetbrains.kotlin.resolve.calls.tower.isSuccess
object FirForLoopChecker : FirBlockChecker() { object FirForLoopChecker : FirBlockChecker() {
override fun check(expression: FirBlock, context: CheckerContext, reporter: DiagnosticReporter) { override fun check(expression: FirBlock, context: CheckerContext, reporter: DiagnosticReporter) {
if (expression.source?.kind != FirFakeSourceElementKind.DesugaredForLoop) return
val statements = expression.statements val statements = expression.statements
for ((iteratorDeclaration, whileLoop) in statements.windowed(2)) { val iteratorDeclaration = statements[0] as? FirProperty ?: return
if (iteratorDeclaration !is FirProperty) continue val whileLoop = statements[1] as? FirWhileLoop ?: return
if (whileLoop !is FirWhileLoop) continue if (iteratorDeclaration.source?.kind != FirFakeSourceElementKind.DesugaredForLoop) return
if (iteratorDeclaration.source?.kind != FirFakeSourceElementKind.DesugaredForLoop) continue val iteratorCall = iteratorDeclaration.initializer as FirFunctionCall
val iteratorCall = iteratorDeclaration.initializer as FirFunctionCall val source = iteratorCall.explicitReceiver?.source ?: iteratorCall.source
val source = iteratorCall.explicitReceiver?.source ?: iteratorCall.source if (checkSpecialFunctionCall(
if (checkSpecialFunctionCall( iteratorCall,
iteratorCall,
reporter,
source,
context,
ITERATOR_AMBIGUITY,
ITERATOR_MISSING,
unsafeCallFactory = ITERATOR_ON_NULLABLE
)
) {
continue
}
val hasNextCall = whileLoop.condition as FirFunctionCall
checkSpecialFunctionCall(
hasNextCall,
reporter, reporter,
source, source,
context, context,
HAS_NEXT_FUNCTION_AMBIGUITY, ITERATOR_AMBIGUITY,
HAS_NEXT_MISSING, ITERATOR_MISSING,
noneApplicableFactory = HAS_NEXT_FUNCTION_NONE_APPLICABLE unsafeCallFactory = ITERATOR_ON_NULLABLE
)
val elementDeclaration = whileLoop.block.statements.firstOrNull() as? FirProperty ?: continue
if (elementDeclaration.initializer?.source?.kind != FirFakeSourceElementKind.DesugaredForLoop) continue
val nextCall = elementDeclaration.initializer as FirFunctionCall
checkSpecialFunctionCall(
nextCall,
reporter,
source,
context,
NEXT_AMBIGUITY,
NEXT_MISSING,
noneApplicableFactory = NEXT_NONE_APPLICABLE
) )
) {
return
} }
val hasNextCall = whileLoop.condition as FirFunctionCall
checkSpecialFunctionCall(
hasNextCall,
reporter,
source,
context,
HAS_NEXT_FUNCTION_AMBIGUITY,
HAS_NEXT_MISSING,
noneApplicableFactory = HAS_NEXT_FUNCTION_NONE_APPLICABLE
)
val elementDeclaration = whileLoop.block.statements.firstOrNull() as? FirProperty ?: return
if (elementDeclaration.initializer?.source?.kind != FirFakeSourceElementKind.DesugaredForLoop) return
val nextCall = elementDeclaration.initializer as FirFunctionCall
checkSpecialFunctionCall(
nextCall,
reporter,
source,
context,
NEXT_AMBIGUITY,
NEXT_MISSING,
noneApplicableFactory = NEXT_NONE_APPLICABLE
)
} }
private fun checkSpecialFunctionCall( private fun checkSpecialFunctionCall(
@@ -138,7 +138,8 @@ class DeclarationsConverter(
return FirBlockBuilder().apply { return FirBlockBuilder().apply {
source = block.toFirSourceElement() source = block.toFirSourceElement()
firStatements.forEach { firStatement -> firStatements.forEach { firStatement ->
if (firStatement !is FirBlock || firStatement.annotations.isNotEmpty()) { val isForLoopBlock = firStatement is FirBlock && firStatement.source?.kind == FirFakeSourceElementKind.DesugaredForLoop
if (firStatement !is FirBlock || isForLoopBlock || firStatement.annotations.isNotEmpty()) {
statements += firStatement statements += firStatement
} else { } else {
statements += firStatement.statements statements += firStatement.statements
@@ -193,9 +193,6 @@ open class RawFirBuilder(
this?.toFirSourceElement(), ConeSimpleDiagnostic(errorReason, kind), this?.toFirSourceElement(), ConeSimpleDiagnostic(errorReason, kind),
) )
private fun KtExpression.toFirStatement(errorReason: String): FirStatement =
convertSafe() ?: buildErrorExpression(this.toFirSourceElement(), ConeSimpleDiagnostic(errorReason, DiagnosticKind.Syntax))
private inline fun KtExpression.toFirStatement(errorReasonLazy: () -> String): FirStatement = private inline fun KtExpression.toFirStatement(errorReasonLazy: () -> String): FirStatement =
convertSafe() ?: buildErrorExpression(this.toFirSourceElement(), ConeSimpleDiagnostic(errorReasonLazy(), DiagnosticKind.Syntax)) convertSafe() ?: buildErrorExpression(this.toFirSourceElement(), ConeSimpleDiagnostic(errorReasonLazy(), DiagnosticKind.Syntax))
@@ -1510,7 +1507,8 @@ open class RawFirBuilder(
source = expression.toFirSourceElement() source = expression.toFirSourceElement()
for (statement in expression.statements) { for (statement in expression.statements) {
val firStatement = statement.toFirStatement { "Statement expected: ${statement.text}" } val firStatement = statement.toFirStatement { "Statement expected: ${statement.text}" }
if (firStatement !is FirBlock || firStatement.annotations.isNotEmpty()) { val isForLoopBlock = firStatement is FirBlock && firStatement.source?.kind == FirFakeSourceElementKind.DesugaredForLoop
if (firStatement !is FirBlock || isForLoopBlock || firStatement.annotations.isNotEmpty()) {
statements += firStatement statements += firStatement
} else { } else {
statements += firStatement.statements statements += firStatement.statements
@@ -1,39 +1,51 @@
FILE: for.kt FILE: for.kt
public? final? fun foo(): R|kotlin/Unit| { public? final? fun foo(): R|kotlin/Unit| {
lval <iterator>: <implicit> = IntegerLiteral(1).rangeTo#(IntegerLiteral(10)).iterator#() {
while(R|<local>/<iterator>|.hasNext#()) { lval <iterator>: <implicit> = IntegerLiteral(1).rangeTo#(IntegerLiteral(10)).iterator#()
lval i: <implicit> = R|<local>/<iterator>|.next#() while(R|<local>/<iterator>|.hasNext#()) {
println#(i#) lval i: <implicit> = R|<local>/<iterator>|.next#()
println#(i#)
}
} }
} }
public? final? fun fooLabeled(): R|kotlin/Unit| { public? final? fun fooLabeled(): R|kotlin/Unit| {
println#(String(!!!)) println#(String(!!!))
lval <iterator>: <implicit> = IntegerLiteral(1).rangeTo#(IntegerLiteral(10)).iterator#() {
label@while(R|<local>/<iterator>|.hasNext#()) { lval <iterator>: <implicit> = IntegerLiteral(1).rangeTo#(IntegerLiteral(10)).iterator#()
lval i: <implicit> = R|<local>/<iterator>|.next#() label@while(R|<local>/<iterator>|.hasNext#()) {
when () { lval i: <implicit> = R|<local>/<iterator>|.next#()
==(i#, IntegerLiteral(5)) -> { when () {
continue@@@[R|<local>/<iterator>|.hasNext#()] ==(i#, IntegerLiteral(5)) -> {
continue@@@[R|<local>/<iterator>|.hasNext#()]
}
} }
println#(i#)
} }
println#(i#)
} }
println#(String(!!!)) println#(String(!!!))
} }
public? final? fun bar(list: List<String>): R|kotlin/Unit| { public? final? fun bar(list: List<String>): R|kotlin/Unit| {
lval <iterator>: <implicit> = list#.subList#(IntegerLiteral(0), IntegerLiteral(10)).iterator#() {
while(R|<local>/<iterator>|.hasNext#()) { lval <iterator>: <implicit> = list#.subList#(IntegerLiteral(0), IntegerLiteral(10)).iterator#()
lval element: <implicit> = R|<local>/<iterator>|.next#() while(R|<local>/<iterator>|.hasNext#()) {
println#(element#) lval element: <implicit> = R|<local>/<iterator>|.next#()
println#(element#)
}
} }
lval <iterator>: <implicit> = list#.subList#(IntegerLiteral(10), IntegerLiteral(20)).iterator#() {
while(R|<local>/<iterator>|.hasNext#()) { lval <iterator>: <implicit> = list#.subList#(IntegerLiteral(10), IntegerLiteral(20)).iterator#()
lval element: <implicit> = R|<local>/<iterator>|.next#() while(R|<local>/<iterator>|.hasNext#()) {
println#(element#) lval element: <implicit> = R|<local>/<iterator>|.next#()
println#(element#)
}
} }
} }
@@ -56,20 +68,26 @@ FILE: for.kt
} }
public? final? fun baz(set: Set<Some>): R|kotlin/Unit| { public? final? fun baz(set: Set<Some>): R|kotlin/Unit| {
lval <iterator>: <implicit> = set#.iterator#() {
while(R|<local>/<iterator>|.hasNext#()) { lval <iterator>: <implicit> = set#.iterator#()
lval <destruct>: <implicit> = R|<local>/<iterator>|.next#() while(R|<local>/<iterator>|.hasNext#()) {
lval x: <implicit> = R|<local>/<destruct>|.component1#() lval <destruct>: <implicit> = R|<local>/<iterator>|.next#()
lval y: <implicit> = R|<local>/<destruct>|.component2#() lval x: <implicit> = R|<local>/<destruct>|.component1#()
println#(<strcat>(String(x = ), x#.toString#(), String( y = ), y#.toString#())) lval y: <implicit> = R|<local>/<destruct>|.component2#()
println#(<strcat>(String(x = ), x#.toString#(), String( y = ), y#.toString#()))
}
} }
} }
public? final? fun withParameter(list: List<Some>): R|kotlin/Unit| { public? final? fun withParameter(list: List<Some>): R|kotlin/Unit| {
lval <iterator>: <implicit> = list#.iterator#() {
while(R|<local>/<iterator>|.hasNext#()) { lval <iterator>: <implicit> = list#.iterator#()
lval s: Some = R|<local>/<iterator>|.next#() while(R|<local>/<iterator>|.hasNext#()) {
println#(s#) lval s: Some = R|<local>/<iterator>|.next#()
println#(s#)
}
} }
} }
@@ -25,9 +25,9 @@ fun whenInContract(x: Any?, boolean: Boolean) {
fun forInContract(x: Any?) { fun forInContract(x: Any?) {
contract { contract {
<!ERROR_IN_CONTRACT_DESCRIPTION!>for (i in 0..1) { for (i in <!HAS_NEXT_MISSING!>0..1<!>) {
returns() implies (x is String) returns() implies (x is String)
}<!> }
} }
} }