Skip to content

Support swift-syntax from 600.0.0-latest #22

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
Jun 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Package.resolved

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ let package = Package(
)
],
dependencies: [
.package(url: "https://github.com/apple/swift-syntax", "509.0.0"..<"511.0.0"),
.package(url: "https://github.com/apple/swift-syntax", "509.0.0"..<"601.0.0"),
.package(url: "https://github.com/pointfreeco/swift-snapshot-testing", from: "1.16.0"),
],
targets: [
Expand Down
36 changes: 26 additions & 10 deletions Sources/MacroTesting/AssertMacro.swift
Original file line number Diff line number Diff line change
Expand Up @@ -177,11 +177,19 @@ public func assertMacro(
origSourceFile: .init(moduleName: "TestModule", fullFilePath: "Test.swift")
]
)
var expandedSourceFile = origSourceFile.expand(
macros: macros,
in: context,
indentationWidth: indentationWidth
)
#if canImport(SwiftSyntax600)
var expandedSourceFile = origSourceFile.expand(
macros: macros,
contextGenerator: { _ in context },
indentationWidth: indentationWidth
)
#else
var expandedSourceFile = origSourceFile.expand(
macros: macros,
in: context,
indentationWidth: indentationWidth
)
#endif

var offset = 0

Expand Down Expand Up @@ -300,11 +308,19 @@ public func assertMacro(
fixedSourceFile: .init(moduleName: "TestModule", fullFilePath: "Test.swift")
]
)
expandedSourceFile = fixedSourceFile.expand(
macros: macros,
in: context,
indentationWidth: indentationWidth
)
#if canImport(SwiftSyntax600)
expandedSourceFile = fixedSourceFile.expand(
macros: macros,
contextGenerator: { _ in context },
indentationWidth: indentationWidth
)
#else
expandedSourceFile = fixedSourceFile.expand(
macros: macros,
in: context,
indentationWidth: indentationWidth
)
#endif
} else if fixedSource != nil {
offset += 1
assertInlineSnapshot(
Expand Down
Loading