mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
This is an extension of a similar problem that I had fixed earlier where due to the usage of intermediate Sendable types we do not propagate regions correctly. The previous issue I fixed was that we were not properly tieing the result of a foreign async completion handler to the block storage since we used an intervening UnsafeContinuation (which is Sendable) to propagate the result into the block storage. I fixed this by changing SILGen to insert a merge_isolation_region that explicitly ties the result to the block storage. This new issue is that the block that we create and then pass as the completion handler is an @Sendable block. Thus when we call the actual objc_method, the block storage and self are not viewed as being in the same region. In this PR, I change it so that we add a merge_isolation_region from self onto the block storage. The end result of this is that we have that self, the result of the call, and the block storage are all in the same region meaning that we properly diagnose that returning an NSObject from the imported Objective-C function is task isolated and thus we cannot return it as a sending result. rdar://131422332
4.9 KiB
4.9 KiB