Skip to content

Conversation

stmontgomery
Copy link
Contributor

This works around a Swift compiler bug which causes a failure validating the generated .swiftinterface of the Testing module due to it having macro declarations with #if-conditionalized @available(...) attributes before any other @-attributes.

The PR which recently landed to enable the Exit Tests feature (#324) revealed this compiler bug — specifically, that PR removed @_spi attributes which until then preceded #if SWT_NO_EXIT_TESTS. The workaround is to move other attributes on the affected macro declarations up before the #if.

The compiler bug is being fixed in swiftlang/swift#81346. It only appears to happen when building with the legacy driver, and Android uses that driver still. An example CI failure log can be found here:

https://github.com/thebrowsercompany/swift-build/actions/runs/14823859186/job/41615678071#step:32:72

Checklist:

  • Code and documentation should follow the style of the Style Guide.
  • If public symbols are renamed or modified, DocC references should be updated.

@stmontgomery stmontgomery added this to the Swift 6.x milestone May 7, 2025
@stmontgomery stmontgomery self-assigned this May 7, 2025
@stmontgomery stmontgomery added bug 🪲 Something isn't working workaround Workaround for an issue in another component (may need to revert later) exit-tests ☠️ Work related to exit tests android 🤖 Android support macros 🔭 Related to Swift macros such as @Test or #expect labels May 7, 2025
@stmontgomery stmontgomery requested a review from rintaro May 7, 2025 00:16
@stmontgomery
Copy link
Contributor Author

@swift-ci please test

Copy link
Member

@rintaro rintaro left a comment

Choose a reason for hiding this comment

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

This LGTM👍

@stmontgomery stmontgomery added the windows 🪟 Windows support label May 7, 2025
@stmontgomery stmontgomery merged commit 91f7889 into swiftlang:main May 7, 2025
3 checks passed
@stmontgomery stmontgomery deleted the macro-availability-workaround branch May 7, 2025 02:55
@stmontgomery stmontgomery modified the milestones: Swift 6.x, Swift 6.2 May 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
android 🤖 Android support bug 🪲 Something isn't working exit-tests ☠️ Work related to exit tests macros 🔭 Related to Swift macros such as @Test or #expect windows 🪟 Windows support workaround Workaround for an issue in another component (may need to revert later)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants