Skip to content

Conversation

omochi
Copy link

@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
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
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
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
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
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
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.

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