@@ -52,7 +52,7 @@ func testGeneric() {
52
52
53
53
testGeneric ( )
54
54
55
- func testPrespecializedAnyObject ( ) {
55
+ func testPrespecializedStructAnyObject ( ) {
56
56
let ptr = UnsafeMutablePointer< PrespecializedStruct< AnyObject>>. allocate( capacity: 1 )
57
57
58
58
do {
@@ -80,9 +80,9 @@ func testPrespecializedAnyObject() {
80
80
ptr. deallocate ( )
81
81
}
82
82
83
- testPrespecializedAnyObject ( )
83
+ testPrespecializedStructAnyObject ( )
84
84
85
- func testPrespecializedSimpleClass ( ) {
85
+ func testPrespecializedStructSimpleClass ( ) {
86
86
let ptr = UnsafeMutablePointer< PrespecializedStruct< SimpleClass>>. allocate( capacity: 1 )
87
87
88
88
do {
@@ -110,10 +110,10 @@ func testPrespecializedSimpleClass() {
110
110
ptr. deallocate ( )
111
111
}
112
112
113
- testPrespecializedSimpleClass ( )
113
+ testPrespecializedStructSimpleClass ( )
114
114
115
115
116
- func testPrespecializedInt ( ) {
116
+ func testPrespecializedStructInt ( ) {
117
117
let ptr = UnsafeMutablePointer< PrespecializedStruct< Int>>. allocate( capacity: 1 )
118
118
119
119
do {
@@ -129,7 +129,244 @@ func testPrespecializedInt() {
129
129
ptr. deallocate ( )
130
130
}
131
131
132
- testPrespecializedInt ( )
132
+ testPrespecializedStructInt ( )
133
+
134
+ func testPrespecializedSingletonEnumAnyObject( ) {
135
+ let ptr = UnsafeMutablePointer< PrespecializedSingletonEnum< AnyObject>>. allocate( capacity: 1 )
136
+
137
+ do {
138
+ let x = PrespecializedSingletonEnum< AnyObject> . only( 23 , SimpleClass ( x: 23 ) )
139
+ testInit ( ptr, to: x)
140
+ }
141
+
142
+ do {
143
+ let y = PrespecializedSingletonEnum< AnyObject> . only( 32 , SimpleClass ( x: 32 ) )
144
+
145
+ // CHECK-NEXT: Before deinit
146
+ print ( " Before deinit " )
147
+
148
+ // CHECK-NEXT: SimpleClass deinitialized!
149
+ testAssign ( ptr, from: y)
150
+ }
151
+
152
+ // CHECK-NEXT: Before deinit
153
+ print ( " Before deinit " )
154
+
155
+
156
+ // CHECK-NEXT: SimpleClass deinitialized!
157
+ testDestroy ( ptr)
158
+
159
+ ptr. deallocate ( )
160
+ }
161
+
162
+ testPrespecializedSingletonEnumAnyObject ( )
163
+
164
+ func testPrespecializedSingletonEnumSimpleClass( ) {
165
+ let ptr = UnsafeMutablePointer< PrespecializedSingletonEnum< SimpleClass>>. allocate( capacity: 1 )
166
+
167
+ do {
168
+ let x = PrespecializedSingletonEnum< SimpleClass> . only( 23 , SimpleClass ( x: 23 ) )
169
+ testInit ( ptr, to: x)
170
+ }
171
+
172
+ do {
173
+ let y = PrespecializedSingletonEnum< SimpleClass> . only( 32 , SimpleClass ( x: 32 ) )
174
+
175
+ // CHECK-NEXT: Before deinit
176
+ print ( " Before deinit " )
177
+
178
+ // CHECK-NEXT: SimpleClass deinitialized!
179
+ testAssign ( ptr, from: y)
180
+ }
181
+
182
+ // CHECK-NEXT: Before deinit
183
+ print ( " Before deinit " )
184
+
185
+
186
+ // CHECK-NEXT: SimpleClass deinitialized!
187
+ testDestroy ( ptr)
188
+
189
+ ptr. deallocate ( )
190
+ }
191
+
192
+ testPrespecializedSingletonEnumSimpleClass ( )
193
+
194
+
195
+ func testPrespecializedSingletonEnumInt( ) {
196
+ let ptr = UnsafeMutablePointer< PrespecializedSingletonEnum< Int>>. allocate( capacity: 1 )
197
+
198
+ do {
199
+ let x = PrespecializedSingletonEnum< Int> . only( 23 , 23 )
200
+ testInit ( ptr, to: x)
201
+ }
202
+
203
+ do {
204
+ let y = PrespecializedSingletonEnum< Int> . only( 32 , 32 )
205
+ testAssign ( ptr, from: y)
206
+ }
207
+
208
+ ptr. deallocate ( )
209
+ }
210
+
211
+ testPrespecializedSingletonEnumInt ( )
212
+
213
+ func testPrespecializedSinglePayloadEnumAnyObject( ) {
214
+ let ptr = UnsafeMutablePointer< PrespecializedSinglePayloadEnum< AnyObject>>. allocate( capacity: 1 )
215
+
216
+ do {
217
+ let x = PrespecializedSinglePayloadEnum< AnyObject> . nonEmpty( 23 , SimpleClass ( x: 23 ) )
218
+ testInit ( ptr, to: x)
219
+ }
220
+
221
+ do {
222
+ let y = PrespecializedSinglePayloadEnum< AnyObject> . nonEmpty( 32 , SimpleClass ( x: 32 ) )
223
+
224
+ // CHECK-NEXT: Before deinit
225
+ print ( " Before deinit " )
226
+
227
+ // CHECK-NEXT: SimpleClass deinitialized!
228
+ testAssign ( ptr, from: y)
229
+ }
230
+
231
+ // CHECK-NEXT: Before deinit
232
+ print ( " Before deinit " )
233
+
234
+
235
+ // CHECK-NEXT: SimpleClass deinitialized!
236
+ testDestroy ( ptr)
237
+
238
+ ptr. deallocate ( )
239
+ }
240
+
241
+ testPrespecializedSinglePayloadEnumAnyObject ( )
242
+
243
+ func testPrespecializedSinglePayloadEnumSimpleClass( ) {
244
+ let ptr = UnsafeMutablePointer< PrespecializedSinglePayloadEnum< SimpleClass>>. allocate( capacity: 1 )
245
+
246
+ do {
247
+ let x = PrespecializedSinglePayloadEnum< SimpleClass> . nonEmpty( 23 , SimpleClass ( x: 23 ) )
248
+ testInit ( ptr, to: x)
249
+ }
250
+
251
+ do {
252
+ let y = PrespecializedSinglePayloadEnum< SimpleClass> . nonEmpty( 32 , SimpleClass ( x: 32 ) )
253
+
254
+ // CHECK-NEXT: Before deinit
255
+ print ( " Before deinit " )
256
+
257
+ // CHECK-NEXT: SimpleClass deinitialized!
258
+ testAssign ( ptr, from: y)
259
+ }
260
+
261
+ // CHECK-NEXT: Before deinit
262
+ print ( " Before deinit " )
263
+
264
+
265
+ // CHECK-NEXT: SimpleClass deinitialized!
266
+ testDestroy ( ptr)
267
+
268
+ ptr. deallocate ( )
269
+ }
270
+
271
+ testPrespecializedSinglePayloadEnumSimpleClass ( )
272
+
273
+
274
+ func testPrespecializedSinglePayloadEnumInt( ) {
275
+ let ptr = UnsafeMutablePointer< PrespecializedSinglePayloadEnum< Int>>. allocate( capacity: 1 )
276
+
277
+ do {
278
+ let x = PrespecializedSinglePayloadEnum< Int> . nonEmpty( 23 , 23 )
279
+ testInit ( ptr, to: x)
280
+ }
281
+
282
+ do {
283
+ let y = PrespecializedSinglePayloadEnum< Int> . nonEmpty( 32 , 32 )
284
+ testAssign ( ptr, from: y)
285
+ }
286
+
287
+ ptr. deallocate ( )
288
+ }
289
+
290
+ testPrespecializedSinglePayloadEnumInt ( )
291
+
292
+ func testPrespecializedMultiPayloadEnumAnyObject( ) {
293
+ let ptr = UnsafeMutablePointer< PrespecializedMultiPayloadEnum< AnyObject>>. allocate( capacity: 1 )
294
+
295
+ do {
296
+ let x = PrespecializedMultiPayloadEnum< AnyObject> . nonEmpty0( 23 , SimpleClass ( x: 23 ) )
297
+ testInit ( ptr, to: x)
298
+ }
299
+
300
+ do {
301
+ let y = PrespecializedMultiPayloadEnum< AnyObject> . nonEmpty0( 32 , SimpleClass ( x: 32 ) )
302
+
303
+ // CHECK-NEXT: Before deinit
304
+ print ( " Before deinit " )
305
+
306
+ // CHECK-NEXT: SimpleClass deinitialized!
307
+ testAssign ( ptr, from: y)
308
+ }
309
+
310
+ // CHECK-NEXT: Before deinit
311
+ print ( " Before deinit " )
312
+
313
+
314
+ // CHECK-NEXT: SimpleClass deinitialized!
315
+ testDestroy ( ptr)
316
+
317
+ ptr. deallocate ( )
318
+ }
319
+
320
+ testPrespecializedMultiPayloadEnumAnyObject ( )
321
+
322
+ func testPrespecializedMultiPayloadEnumSimpleClass( ) {
323
+ let ptr = UnsafeMutablePointer< PrespecializedMultiPayloadEnum< SimpleClass>>. allocate( capacity: 1 )
324
+
325
+ do {
326
+ let x = PrespecializedMultiPayloadEnum< SimpleClass> . nonEmpty0( 23 , SimpleClass ( x: 23 ) )
327
+ testInit ( ptr, to: x)
328
+ }
329
+
330
+ do {
331
+ let y = PrespecializedMultiPayloadEnum< SimpleClass> . nonEmpty0( 32 , SimpleClass ( x: 32 ) )
332
+
333
+ // CHECK-NEXT: Before deinit
334
+ print ( " Before deinit " )
335
+
336
+ // CHECK-NEXT: SimpleClass deinitialized!
337
+ testAssign ( ptr, from: y)
338
+ }
339
+
340
+ // CHECK-NEXT: Before deinit
341
+ print ( " Before deinit " )
342
+
343
+
344
+ // CHECK-NEXT: SimpleClass deinitialized!
345
+ testDestroy ( ptr)
346
+
347
+ ptr. deallocate ( )
348
+ }
349
+
350
+ testPrespecializedMultiPayloadEnumSimpleClass ( )
351
+
352
+
353
+ func testPrespecializedMultiPayloadEnumInt( ) {
354
+ let ptr = UnsafeMutablePointer< PrespecializedMultiPayloadEnum< Int>>. allocate( capacity: 1 )
355
+
356
+ do {
357
+ let x = PrespecializedMultiPayloadEnum< Int> . nonEmpty0( 23 , 23 )
358
+ testInit ( ptr, to: x)
359
+ }
360
+
361
+ do {
362
+ let y = PrespecializedMultiPayloadEnum< Int> . nonEmpty0( 32 , 32 )
363
+ testAssign ( ptr, from: y)
364
+ }
365
+
366
+ ptr. deallocate ( )
367
+ }
368
+
369
+ testPrespecializedMultiPayloadEnumInt ( )
133
370
134
371
func testGenericTuple( ) {
135
372
let ptr = allocateInternalGenericPtr ( of: GenericTupleWrapper< TestClass> . self )
0 commit comments