Skip to content
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

[cxx-interop] Fix transforming spans that are not behind type aliases #79951

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Xazax-hun
Copy link
Contributor

While we expect our users to use type aliases for template instantiations, there are some contexts when we import instantiations without aliases. Unfortunately, in case of C++ span we generated a name for the instantiation that cannot be a syntactically valid Swift type due to unary negation appearing in the type name. This PR replaces the unary negation with "Neg" in the type name and also fixed a bug that ended up printing certain unsigned values as signed. Moreover, this PR also fixes some other fallouts in the SwiftifyImport macro.

rdar://146833480

@Xazax-hun Xazax-hun added the c++ interop Feature: Interoperability with C++ label Mar 12, 2025
While we expect our users to use type aliases for template
instantiations, there are some contexts when we import instantiations
without aliases. Unfortunately, in case of C++ span we generated a name
for the instantiation that cannot be a syntactically valid Swift type
due to unary negation appearing in the type name. This PR replaces the
unary negation with "Neg" in the type name and also fixed a bug that
ended up printing certain unsigned values as signed. Moreover, this PR
also fixes some other fallouts in the SwiftifyImport macro.

rdar://146833480
@Xazax-hun Xazax-hun force-pushed the gaborh/non-type-alias-span branch from 8aa48c5 to af4f594 Compare March 12, 2025 15:44
@Xazax-hun Xazax-hun requested a review from hnrklssn March 12, 2025 15:44
Copy link
Contributor

@hnrklssn hnrklssn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Xazax-hun
Copy link
Contributor Author

@swift-ci please smoke test

@Xazax-hun Xazax-hun enabled auto-merge March 12, 2025 17:36
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