Skip to content

[6.0] AST: #if hasAttribute(retroactive) should evaluate true #72573

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

tshortli
Copy link
Contributor

@tshortli tshortli commented Mar 25, 2024

  • Explanation: The implementation of #if hasAttribute(...) only accepted declaration attributes. It should also accept type attributes, like @retroactive.
  • Scope: Affects use of hasAttributes with any type attribute. Fixing this is important because multiple new type attributes are being introduced in Swift 6 (@retroactive and @isolated) and package owners may need to conditionalize code that uses these attributes.
  • Issue/Radar: rdar://125195051
  • Original PR: AST: #if hasAttribute(retroactive) should evaluate true #72571
  • Risk: Low. The main risk is that existing code could be written with hasAttribute checks that failed due to this bug but will now unexpectedly succeed.
  • Testing: Added tests in the compiler test suite. Ran source compatibility testing.
  • Reviewer: @rintaro @bnbarham

The implementation of `#if hasAttribute(...)` only accepted declaration
attributes. It should also accept type attributes, like `@retroactive`.

Resolves rdar://125195051
@tshortli
Copy link
Contributor Author

@swift-ci please test

@tshortli tshortli added 🍒 release cherry pick Flag: Release branch cherry picks swift 6.0 labels Mar 25, 2024
@tshortli
Copy link
Contributor Author

@swift-ci please test source compatibility

@tshortli tshortli marked this pull request as ready for review March 26, 2024 03:30
@tshortli tshortli requested a review from a team as a code owner March 26, 2024 03:30
@tshortli tshortli requested a review from bnbarham March 26, 2024 03:30
@tshortli
Copy link
Contributor Author

The source compatibility failures appear to be existing issues.

@tshortli tshortli merged commit c17acf4 into swiftlang:release/6.0 Mar 26, 2024
@tshortli tshortli deleted the has-retroactive-attribute-6.0 branch March 26, 2024 18:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🍒 release cherry pick Flag: Release branch cherry picks swift 6.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants