[4.2 EARLY] Hack: Force UIEdgeInsets.zero to always come from the SDK #17149
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Explanation: The UIKit overlay has long had convenience properties
UIEdgeInsets.zero
andUIOffset.zero
, as Swiftier versions of constants in the UIKit framework UIEdgeInsetsZero and UIOffsetZero. In the iOS 12 SDK, we (Apple) tried to switch over to using the real C constants, since there's no need to duplicate the logic in Swift. However, trying to keep both declarations around but with different availability led to a crash in deserialization, which (deliberately) doesn't respect availability. Instead, let's go all the way to using the framework declarations…even though that means hacking the importer a little to pretend that UIKit's already updated their API notes.Scope: Affects UIEdgeInsetsZero and UIOffsetZero only.
Issue: SR-7879 / rdar://problem/40735990
Risk: Low. This is a targeted hack with very little chance of affecting anything else, and it should not make things worse either.
Testing: Added compiler regression tests.
Reviewed by: @moiseev