Skip to content

Fix two diagnostics when building swift-syntax using pre Swift-6 compilers #2569

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 2 commits into from
Mar 27, 2024

Conversation

ahoppen
Copy link
Member

@ahoppen ahoppen commented Mar 25, 2024

  • Only mark keyword as experimental when using a Swift ≥5.8 compiler
    • In most other parts of the code base we only use the SPI attribute for Swift ≥5.8 compilers. If we unconditionally mark a keywords as SPI we run into issues if a syntax node (which is only experimental in Swift 5.8+) uses that keyword as a default value in its initializers. The concrete case here is the usage of .dependsOn.
  • Mark Syntax.Info as @unchecked Sendable
    • We were relying on the nonisolated(unsafe) annotation of Info.info to make Sendable checking pass. But that feature is only available in Swift 6.0. To be able to build swift-syntax without warnings using Swift <6.0, we need to use @unchecked Sendable here.

@ahoppen ahoppen requested a review from bnbarham as a code owner March 25, 2024 23:32
@ahoppen ahoppen changed the title Fix two diagnostics when building swift-syntax using pre Swift-6 compilers Fix two diagnostics when building swift-syntax using pre Swift-6 compilers 🚥 #2558 Mar 25, 2024
ahoppen added 2 commits March 27, 2024 00:18
In most other parts of the code base we only use the SPI attribute for Swift ≥5.8 compilers. If we unconditionally mark a keywords as SPI we run into issues if a syntax node (which is only experimental in Swift 5.8+) uses that keyword as a default value in its initializers. The concrete case here is the usage of `.dependsOn`.
We were relying on the `nonisolated(unsafe)` annotation of `Info.info` to make `Sendable` checking pass. But that feature is only available in Swift 6.0. To be able to build swift-syntax without warnings using Swift <6.0, we need to use `@unchecked Sendable` here.
@ahoppen ahoppen requested a review from rintaro March 26, 2024 23:18
@ahoppen ahoppen force-pushed the ahoppen/fix-old-swift-diags branch from d92f5da to 1f0e7d5 Compare March 26, 2024 23:18
@ahoppen ahoppen changed the title Fix two diagnostics when building swift-syntax using pre Swift-6 compilers 🚥 #2558 Fix two diagnostics when building swift-syntax using pre Swift-6 compilers Mar 26, 2024
@ahoppen
Copy link
Member Author

ahoppen commented Mar 26, 2024

@swift-ci Please test

@ahoppen ahoppen merged commit cfd0487 into swiftlang:main Mar 27, 2024
@ahoppen ahoppen deleted the ahoppen/fix-old-swift-diags branch March 27, 2024 09:32
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.

1 participant