Skip to content

Conversation

@omochi
Copy link
Contributor

@omochi omochi commented Jun 14, 2025

SwiftSyntax 601 introduced support for SE-0452 (Integer Generic Parameters), which changed the type of GenericArgumentSyntax.argument from TypeSyntax to GenericArgumentSyntax.Argument.

As a result, the test code could no longer be built with SwiftSyntax 601.

Since GenericArgumentSyntax.Argument can be converted to TypeSyntax using .as(TypeSyntax.self), I’ve introduced a compatibility accessor named argumentCompat600 to maintain support for SwiftSyntax 600 and earlier.

Note: This change does not implement support for Integer Generic Parameters itself.

"509.0.0..<510.0.0",
"510.0.0..<511.0.0",
"511.0.0..<601.0.0",
"601.0.0..<602.0.0",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

add 601

url: "https://github.com/swiftlang/swift-syntax",
envVar: "SWIFT_SYNTAX_VERSION",
default: "509.0.0..<601.0.0"
default: "509.0.0..<602.0.0"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

support 601

// From: https://github.com/apple/swift-syntax/blob/d647052/Sources/SwiftSyntaxMacrosTestSupport/Assertions.swift
extension FixIt.Change {
// From: https://github.com/swiftlang/swift-syntax/blob/601.0.1/Sources/SwiftSyntaxMacrosGenericTestSupport/Assertions.swift
fileprivate extension FixIt.Change {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I copy-pasted the latest code and made some small adjustments.

replacement: newTrivia.description
)

#if canImport(SwiftSyntax601)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added this compile-time conditional.

@gohanlon gohanlon self-assigned this Jun 17, 2025
Package.swift Outdated
.product(name: "SwiftParser", package: "swift-syntax"),
.product(name: "SwiftParserDiagnostics", package: "swift-syntax"),
.product(name: "SwiftSyntax", package: "swift-syntax"),
.product(name: "SwiftSyntaxBuilder", package: "swift-syntax"),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

In Xcode 26, if this is missing, a warning will appear at build time in the consuming package.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Adding it doesn’t resolve the issue, so I’m reverting it.

@bwised
Copy link

bwised commented Oct 21, 2025

Let's get this merged in! 😄

@gohanlon gohanlon merged commit 64aa192 into gohanlon:main Oct 30, 2025
5 checks passed
@omochi
Copy link
Contributor Author

omochi commented Nov 1, 2025

Thank you for merging it.

@gohanlon
Copy link
Owner

gohanlon commented Nov 2, 2025

Thank you! 💯

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