@@ -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,86 @@ 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 ( )
133
212
134
213
func testGenericTuple( ) {
135
214
let ptr = allocateInternalGenericPtr ( of: GenericTupleWrapper< TestClass> . self )
0 commit comments