File tree Expand file tree Collapse file tree 2 files changed +49
-1
lines changed Expand file tree Collapse file tree 2 files changed +49
-1
lines changed Original file line number Diff line number Diff line change @@ -1279,7 +1279,7 @@ constexpr InitFn initWithTakeTable[] = {
12791279 ©ingInitWithTake,
12801280 ©ingInitWithTake,
12811281 ©ingInitWithTake,
1282- nullptr , // Custom
1282+ ©ingInitWithTake,
12831283 &metatypeInitWithTake,
12841284 nullptr , // Generic
12851285 &existentialInitWithTake,
Original file line number Diff line number Diff line change @@ -290,3 +290,51 @@ func testNestedGenericEnumSwiftObjC() {
290290}
291291
292292testNestedGenericEnumSwiftObjC ( )
293+
294+ struct SwiftObjCAndWeakObjC {
295+ let x : SwiftObjC
296+ weak var y : NSObject ?
297+ }
298+
299+ func testSwiftObjCAndWeakObjC( ) {
300+ let ptr = UnsafeMutablePointer< SwiftObjCAndWeakObjC> . allocate( capacity: 1 )
301+
302+ // initWithCopy
303+ do {
304+ let x = SwiftObjCAndWeakObjC ( x: SwiftObjC ( ) , y: nil )
305+ testInit ( ptr, to: x)
306+ }
307+
308+ // assignWithTake
309+ do {
310+ let y = SwiftObjCAndWeakObjC ( x: SwiftObjC ( ) , y: nil )
311+
312+ // CHECK-NEXT: Before deinit
313+ print ( " Before deinit " )
314+
315+ // CHECK-NEXT: SwiftObjC deinitialized!
316+ testAssign ( ptr, from: y)
317+ }
318+
319+ // assignWithCopy
320+ do {
321+ var z = SwiftObjCAndWeakObjC ( x: SwiftObjC ( ) , y: nil )
322+
323+ // CHECK-NEXT: Before deinit
324+ print ( " Before deinit " )
325+
326+ // CHECK-NEXT: SwiftObjC deinitialized!
327+ testAssignCopy ( ptr, from: & z)
328+ }
329+
330+ // CHECK-NEXT: Before deinit
331+ print ( " Before deinit " )
332+
333+ // destroy
334+ // CHECK-NEXT: SwiftObjC deinitialized!
335+ testDestroy ( ptr)
336+
337+ ptr. deallocate ( )
338+ }
339+
340+ testSwiftObjCAndWeakObjC ( )
You can’t perform that action at this time.
0 commit comments