-
Notifications
You must be signed in to change notification settings - Fork 17
Support SwiftSyntax 601 #50
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
base: main
Are you sure you want to change the base?
Conversation
"509.0.0..<510.0.0", | ||
"510.0.0..<511.0.0", | ||
"511.0.0..<601.0.0", | ||
"601.0.0..<602.0.0", |
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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.
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"), |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
SwiftSyntax 601 introduced support for SE-0452 (Integer Generic Parameters), which changed the type of
GenericArgumentSyntax.argument
fromTypeSyntax
toGenericArgumentSyntax.Argument
.As a result, the test code could no longer be built with SwiftSyntax 601.
Since
GenericArgumentSyntax.Argument
can be converted toTypeSyntax
using.as(TypeSyntax.self)
, I’ve introduced a compatibility accessor namedargumentCompat600
to maintain support for SwiftSyntax 600 and earlier.Note: This change does not implement support for Integer Generic Parameters itself.