Skip to content

6.0: [BitwiseCopyable] Avoid a condfail. #73538

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

nate-chandler
Copy link
Contributor

Explanation: Fix a condfail related to BitwiseCopyable renaming.

Once the evolution proposal was accepted, the protocol was renamed from _BitwiseCopyable to BitwiseCopyable. Old compilers still only "know about" _BitwiseCopyable, however--it is a "known protocol" for them. They only permit suppression of _BitwiseCopyable and not BitwiseCopyable. This is a problem for the new standard library's swiftinterface which includes several suppressions of BitwiseCopyable.

The solution is to keep defining the _BitwiseCopyable protocol in the standard library's swiftinterface as understood by older compilers while defining BitwiseCopyable to be a typealias for it. Meanwhile, when current compilers read the same swiftinterface, they will see BitwiseCopyable to be defined as a protocol and _BitwiseCopyable to be a typealias for it.

Scope: Affects ASTPrinting of the BitwiseCopyable protocol and its deprecated typealias.
Issue: rdar://127755503
Original PR: #73516
Risk: Very low. Only affects ASTPrinting of two declarations.
Testing: Added tests.
Reviewer: Allan Shortlidge ( @tshortli )

Rather than immediately outright banning the old protocol, just make it
be a deprecated typealias for the real one.
The standard library defines
```
protocol BitwiseCopyable {}
typealias _BitwiseCopyable = BitwiseCopyable
```
For current compilers, `BitwiseCopyable` is a "known protocol".

For older compilers, it is not; instead `_BitwiseCopyable` is.  So
print the following into the swiftinterface for those older compilers:
```
protocol _BitwiseCopyable {}
typealias BitwiseCopyable = _BitwiseCopyable
```

rdar://127755503
@nate-chandler nate-chandler requested a review from a team as a code owner May 9, 2024 14:15
@nate-chandler
Copy link
Contributor Author

@swift-ci please test

@nate-chandler nate-chandler requested a review from tbkka May 9, 2024 14:16
@nate-chandler nate-chandler enabled auto-merge May 9, 2024 14:19
@nkcsgexi
Copy link
Contributor

nkcsgexi commented May 9, 2024

Thank you for fixing the condfail issue, Nate!

@nate-chandler nate-chandler merged commit 797765a into swiftlang:release/6.0 May 9, 2024
@nate-chandler nate-chandler deleted the cherrypick/release/6.0/rdar127755503 branch May 9, 2024 20:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants