3
3
using System . Collections . Generic ;
4
4
using System . Linq ;
5
5
6
- public class A
6
+ public class CollectionFlow
7
7
{
8
- public void M1 ( )
8
+ public class A { }
9
+
10
+ public void ArrayInitializerFlow ( )
9
11
{
10
12
var a = new A ( ) ;
11
13
var @as = new [ ] { a } ;
@@ -14,7 +16,7 @@ public void M1()
14
16
Sink ( First ( @as ) ) ; // flow
15
17
}
16
18
17
- public void M2 ( A other )
19
+ public void ArrayInitializerNoFlow ( A other )
18
20
{
19
21
var a = new A ( ) ;
20
22
var @as = new [ ] { other } ;
@@ -23,7 +25,7 @@ public void M2(A other)
23
25
Sink ( First ( @as ) ) ; // no flow
24
26
}
25
27
26
- public void M3 ( )
28
+ public void ArrayAssignmentFlow ( )
27
29
{
28
30
var a = new A ( ) ;
29
31
var @as = new A [ 1 ] ;
@@ -33,7 +35,7 @@ public void M3()
33
35
Sink ( First ( @as ) ) ; // flow
34
36
}
35
37
36
- public void M4 ( A other )
38
+ public void ArrayAssignmentNoFlow ( A other )
37
39
{
38
40
var a = new A ( ) ;
39
41
var @as = new A [ 1 ] ;
@@ -43,7 +45,7 @@ public void M4(A other)
43
45
Sink ( First ( @as ) ) ; // no flow
44
46
}
45
47
46
- public void M5 ( )
48
+ public void ListAssignmentFlow ( )
47
49
{
48
50
var a = new A ( ) ;
49
51
var list = new List < A > ( ) ;
@@ -53,7 +55,7 @@ public void M5()
53
55
Sink ( ListFirst ( list ) ) ; // flow
54
56
}
55
57
56
- public void M6 ( A other )
58
+ public void ListAssignmentNoFlow ( A other )
57
59
{
58
60
var list = new List < A > ( ) ;
59
61
list [ 0 ] = other ;
@@ -62,7 +64,7 @@ public void M6(A other)
62
64
Sink ( ListFirst ( list ) ) ; // no flow
63
65
}
64
66
65
- public void M7 ( )
67
+ public void ListInitializerFlow ( )
66
68
{
67
69
var a = new A ( ) ;
68
70
var list = new List < A > ( ) { a } ;
@@ -71,15 +73,15 @@ public void M7()
71
73
Sink ( ListFirst ( list ) ) ; // flow
72
74
}
73
75
74
- public void M8 ( A other )
76
+ public void ListInitializerNoFlow ( A other )
75
77
{
76
78
var list = new List < A > ( ) { other } ;
77
79
Sink ( list [ 0 ] ) ; // no flow
78
80
SinkListElem ( list ) ; // no flow
79
81
Sink ( ListFirst ( list ) ) ; // no flow
80
82
}
81
83
82
- public void M9 ( )
84
+ public void ListAddFlow ( )
83
85
{
84
86
var a = new A ( ) ;
85
87
var list = new List < A > ( ) ;
@@ -89,7 +91,7 @@ public void M9()
89
91
Sink ( ListFirst ( list ) ) ; // flow
90
92
}
91
93
92
- public void M10 ( A other )
94
+ public void ListAddNoFlow ( A other )
93
95
{
94
96
var list = new List < A > ( ) ;
95
97
list . Add ( other ) ;
@@ -98,85 +100,85 @@ public void M10(A other)
98
100
Sink ( ListFirst ( list ) ) ; // no flow
99
101
}
100
102
101
- public void M11 ( )
103
+ public void DictionaryAssignmentFlow ( )
102
104
{
103
105
var a = new A ( ) ;
104
106
var dict = new Dictionary < int , A > ( ) ;
105
107
dict [ 0 ] = a ;
106
108
Sink ( dict [ 0 ] ) ; // flow
107
109
SinkDictValue ( dict ) ; // flow
108
- Sink ( DictFirstValueA ( dict ) ) ; // flow
109
- Sink ( DictFirstValueB ( dict ) ) ; // flow [MISSING]
110
- Sink ( DictFirstValueC ( dict ) ) ; // flow
110
+ Sink ( DictIndexZero ( dict ) ) ; // flow
111
+ Sink ( DictFirstValue ( dict ) ) ; // flow [MISSING]
112
+ Sink ( DictValuesFirst ( dict ) ) ; // flow
111
113
}
112
114
113
- public void M12 ( A other )
115
+ public void DictionaryAssignmentNoFlow ( A other )
114
116
{
115
117
var dict = new Dictionary < int , A > ( ) ;
116
118
dict [ 0 ] = other ;
117
119
Sink ( dict [ 0 ] ) ; // no flow
118
120
SinkDictValue ( dict ) ; // no flow
119
- Sink ( DictFirstValueA ( dict ) ) ; // no flow
120
- Sink ( DictFirstValueB ( dict ) ) ; // no flow
121
- Sink ( DictFirstValueC ( dict ) ) ; // no flow
121
+ Sink ( DictIndexZero ( dict ) ) ; // no flow
122
+ Sink ( DictFirstValue ( dict ) ) ; // no flow
123
+ Sink ( DictValuesFirst ( dict ) ) ; // no flow
122
124
}
123
125
124
- public void M13 ( )
126
+ public void DictionaryValueInitializerFlow ( )
125
127
{
126
128
var a = new A ( ) ;
127
129
var dict = new Dictionary < int , A > ( ) { { 0 , a } } ;
128
130
Sink ( dict [ 0 ] ) ; // flow
129
131
SinkDictValue ( dict ) ; // flow
130
- Sink ( DictFirstValueA ( dict ) ) ; // flow
131
- Sink ( DictFirstValueB ( dict ) ) ; // flow [MISSING]
132
- Sink ( DictFirstValueC ( dict ) ) ; // flow
132
+ Sink ( DictIndexZero ( dict ) ) ; // flow
133
+ Sink ( DictFirstValue ( dict ) ) ; // flow [MISSING]
134
+ Sink ( DictValuesFirst ( dict ) ) ; // flow
133
135
}
134
136
135
- public void M14 ( A other )
137
+ public void DictionaryValueInitializerNoFlow ( A other )
136
138
{
137
139
var dict = new Dictionary < int , A > ( ) { { 0 , other } } ;
138
140
Sink ( dict [ 0 ] ) ; // no flow
139
141
SinkDictValue ( dict ) ; // no flow
140
- Sink ( DictFirstValueA ( dict ) ) ; // no flow
141
- Sink ( DictFirstValueB ( dict ) ) ; // no flow
142
- Sink ( DictFirstValueC ( dict ) ) ; // no flow
142
+ Sink ( DictIndexZero ( dict ) ) ; // no flow
143
+ Sink ( DictFirstValue ( dict ) ) ; // no flow
144
+ Sink ( DictValuesFirst ( dict ) ) ; // no flow
143
145
}
144
146
145
- public void M15 ( )
147
+ public void DictionaryKeyInitializerFlow ( )
146
148
{
147
149
var a = new A ( ) ;
148
150
var dict = new Dictionary < A , int > ( ) { { a , 0 } } ;
149
151
Sink ( dict . Keys . First ( ) ) ; // flow [MISSING]
150
152
SinkDictKey ( dict ) ; // flow [MISSING]
151
- Sink ( DictFirstKeyA ( dict ) ) ; // flow [MISSING]
152
- Sink ( DictFirstKeyB ( dict ) ) ; // flow [MISSING]
153
+ Sink ( DictKeysFirst ( dict ) ) ; // flow [MISSING]
154
+ Sink ( DictFirstKey ( dict ) ) ; // flow [MISSING]
153
155
}
154
156
155
- public void M16 ( A other )
157
+ public void DictionaryKeyInitializerNoFlow ( A other )
156
158
{
157
159
var dict = new Dictionary < A , int > ( ) { { other , 0 } } ;
158
160
Sink ( dict . Keys . First ( ) ) ; // no flow
159
161
SinkDictKey ( dict ) ; // no flow
160
- Sink ( DictFirstKeyA ( dict ) ) ; // no flow
161
- Sink ( DictFirstKeyB ( dict ) ) ; // no flow
162
+ Sink ( DictKeysFirst ( dict ) ) ; // no flow
163
+ Sink ( DictFirstKey ( dict ) ) ; // no flow
162
164
}
163
165
164
- public void M17 ( )
166
+ public void ForeachFlow ( )
165
167
{
166
168
var a = new A ( ) ;
167
169
var @as = new [ ] { a } ;
168
170
foreach ( var x in @as )
169
171
Sink ( x ) ; // flow
170
172
}
171
173
172
- public void M18 ( A other )
174
+ public void ForeachNoFlow ( A other )
173
175
{
174
176
var @as = new [ ] { other } ;
175
177
foreach ( var x in @as )
176
178
Sink ( x ) ; // no flow
177
179
}
178
180
179
- public void M19 ( )
181
+ public void ArrayGetEnumeratorFlow ( )
180
182
{
181
183
var a = new A ( ) ;
182
184
var @as = new [ ] { a } ;
@@ -185,15 +187,15 @@ public void M19()
185
187
Sink ( enumerator . Current ) ; // flow
186
188
}
187
189
188
- public void M20 ( A other )
190
+ public void ArrayGetEnumeratorNoFlow ( A other )
189
191
{
190
192
var @as = new [ ] { other } ;
191
193
var enumerator = @as . GetEnumerator ( ) ;
192
194
while ( enumerator . MoveNext ( ) )
193
195
Sink ( enumerator . Current ) ; // no flow
194
196
}
195
197
196
- public void M21 ( )
198
+ public void ListGetEnumeratorFlow ( )
197
199
{
198
200
var a = new A ( ) ;
199
201
var list = new List < A > ( ) ;
@@ -217,13 +219,13 @@ public static void Sink<T>(T t) { }
217
219
218
220
public static T ListFirst < T > ( IList < T > list ) => list [ 0 ] ;
219
221
220
- public static T DictFirstValueA < T > ( IDictionary < int , T > dict ) => dict [ 0 ] ;
222
+ public static T DictIndexZero < T > ( IDictionary < int , T > dict ) => dict [ 0 ] ;
221
223
222
- public static T DictFirstValueB < T > ( IDictionary < int , T > dict ) => dict . First ( ) . Value ;
224
+ public static T DictFirstValue < T > ( IDictionary < int , T > dict ) => dict . First ( ) . Value ;
223
225
224
- public static T DictFirstValueC < T > ( IDictionary < int , T > dict ) => dict . Values . First ( ) ;
226
+ public static T DictValuesFirst < T > ( IDictionary < int , T > dict ) => dict . Values . First ( ) ;
225
227
226
- public static T DictFirstKeyA < T > ( IDictionary < T , int > dict ) => dict . Keys . First ( ) ;
228
+ public static T DictKeysFirst < T > ( IDictionary < T , int > dict ) => dict . Keys . First ( ) ;
227
229
228
- public static T DictFirstKeyB < T > ( IDictionary < T , int > dict ) => dict . First ( ) . Key ;
230
+ public static T DictFirstKey < T > ( IDictionary < T , int > dict ) => dict . First ( ) . Key ;
229
231
}
0 commit comments