Skip to content

[cxx-interop] Fix generated header for Swift closures using CF_OPTIONS types #82691

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

Merged
merged 1 commit into from
Jul 2, 2025

Conversation

egorzhdan
Copy link
Contributor

If a Swift class has a field, which has a closure type, which takes an instance of a CF_OPTIONS/NS_OPTIONS type as a parameter, the reverse interop logic would generate an invalid Objective-C++ header for such type.

This was discovered with UIKit's UIControlState type, which is declared with NS_OPTIONS in Objective-C, then renamed to UIControl.State with API Notes, and then re-exported to Objective-C++ via the generated header.

rdar://129622886

…NS` types

If a Swift class has a field, which has a closure type, which takes an instance of a `CF_OPTIONS`/`NS_OPTIONS` type as a parameter, the reverse interop logic would generate an invalid Objective-C++ header for such type.

This was discovered with UIKit's `UIControlState` type, which is declared with `NS_OPTIONS` in Objective-C, then renamed to `UIControl.State` with API Notes, and then re-exported to Objective-C++ via the generated header.

rdar://129622886
@egorzhdan egorzhdan added the c++ interop Feature: Interoperability with C++ label Jul 1, 2025
@egorzhdan
Copy link
Contributor Author

@swift-ci please test

@egorzhdan
Copy link
Contributor Author

@swift-ci please test Linux

@egorzhdan egorzhdan merged commit 5a6a147 into main Jul 2, 2025
5 checks passed
@egorzhdan egorzhdan deleted the egorzhdan/cfoptions-block-param branch July 2, 2025 13:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c++ interop Feature: Interoperability with C++
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants