Skip to content

Swiftify anonymous params rel #81399

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

Conversation

hnrklssn
Copy link
Contributor

@hnrklssn hnrklssn commented May 9, 2025

  • Explanation:
    This changes the _SwiftifyImport macro to handle anonymous parameters, like can occur from imported C functions like void foo(int __counted_by(len), int len), where the pointer parameter is unnamed. Before this change the macro expansion would try to refer to the parameter with _, resulting in syntax errors.
  • Scope:
    This only affects code using the experimental SafeInteropWrappers feature flag.
  • Issues:
    rdar://150955944
  • Original PRs:
    [Swiftify] Handle anonymous parameters #81384
  • Risk:
    The risk should be low because it only affects code opting in to the experimental SafeInteropWrappers feature
  • Testing:
    Manual testing, lit tests
  • Reviewers:
    @DougGregor

This PR is stacked on top of #81388 to prevent conflicts.

hnrklssn added 2 commits May 8, 2025 16:40
…#81320)

This prevents errors when compiling for older targets using a newer
compiler.

rdar://150740330
(cherry picked from commit 59d7d31)
_SwiftifyImport would expand with syntax errors if applied to a function
with anonymous parameters, because it would try to refer to parameters
using the name `_`. Detect these cases and create names for unnamed
parameters.

rdar://150955944
(cherry picked from commit 8e27947)
@hnrklssn hnrklssn requested a review from DougGregor May 9, 2025 07:01
@hnrklssn hnrklssn requested a review from a team as a code owner May 9, 2025 07:01
@hnrklssn
Copy link
Contributor Author

@swift-ci please test

@hnrklssn
Copy link
Contributor Author

@swift-ci please test windows

@devincoughlin devincoughlin merged commit 0fbf660 into swiftlang:release/6.2 May 13, 2025
5 checks passed
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