Files
swift-mirror/test/Interpreter/SDK/objc_dealloc.swift
Mike Ash cc0d207050 [Test] Disable Interpreter/SDK/objc_bridge_cast.swift and Interpreter/SDK/objc_dealloc.swift.
These tests are failing intermittently. Disabling them to keep PR testing happy while we figure out why.

rdar://80079617
2021-07-02 08:51:29 -04:00

29 lines
617 B
Swift

// RUN: %target-run-simple-swift | %FileCheck %s
// REQUIRES: executable_test
// REQUIRES: objc_interop
// REQUIRES: rdar80079617
import Foundation
// Check that ObjC associated objects are cleaned up when attached to native
// Swift objects.
class Root {
deinit { print("deallocating root") }
}
class Associated {
deinit { print("deallocating associated") }
}
var token: Int8 = 0
autoreleasepool {
let root = Root()
objc_setAssociatedObject(root, &token, Associated(),
.OBJC_ASSOCIATION_RETAIN_NONATOMIC)
}
// CHECK: deallocating root
// CHECK-NEXT: deallocating associated