Skip to content

[6.0][Macros] Ignore the @TaskLocal macro attached to vars with projected value vars. #73854

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
May 24, 2024

Conversation

hborla
Copy link
Member

@hborla hborla commented May 23, 2024

  • Explanation: VarDecls with @_projectedValueProperty have already had the property wrapper transform applied. This only impacts swiftinterfaces, and if a swiftinterface was produced against a Concurrency library that does not declare TaskLocal as a macro, we need to ignore the macro to avoid producing duplicate declarations. This is only needed temporarily until all swiftinterfaces have been built against the Concurrency library containing the new macro declaration.

    Note that all of the property wrapper requests will not consider these declarations to have an attached property wrapper because the macro declaration always wins when resolving the custom attribute. I think this is okay, because the property wrapper transform has already been applied. As far as I can tell, the purpose of @_projectedValueProperty is to avoid synthesizing another projected value in the case where one has already been created.

  • Scope: Only impacts swiftinterfaces produced against older standard libraries so the interface contains @_Concurrency.TaskLocal.

  • Issue: rdar://128542258

  • Risk: Low, the worst thing that can happen is a swiftinterface fails to build or clients of task local values fail to build due to some property-wrapper-specific interaction, but if such an interaction exists, it'd be likely to fail against the current macro formulation of @TaskLocal.

  • Testing: Added new test that builds a swiftinterface containing the problematic declaration.

  • Reviewer: None

  • Main branch PR: [Macros] Ignore the @TaskLocal macro attached to vars with projected value vars. #73832

…d values.

VarDecls with `@_projectedValueProperty` have already had the property
wrapper transform applied. This only impacts swiftinterfaces, and if
a swiftinterface was produced against a Concurrency library that does
not declare `TaskLocal` as a macro, we need to ignore the macro to avoid
producing duplicate declarations. This is only needed temporarily until
all swiftinterfaces have been built against the Concurrency library
containing the new macro declaration.

(cherry picked from commit 7ded57b)
@hborla hborla requested a review from a team as a code owner May 23, 2024 18:49
@hborla
Copy link
Member Author

hborla commented May 23, 2024

@swift-ci please test

@hborla hborla merged commit 03dae14 into swiftlang:release/6.0 May 24, 2024
5 checks passed
@hborla hborla deleted the 6.0-task-local-macro-hack branch May 24, 2024 02:00
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.

2 participants