Skip to content

Commit 687075e

Browse files
committedMay 13, 2024
Update to SwiftSyntax 510.0.0 and fix tests (missing dependency)
1 parent 455abe4 commit 687075e

File tree

4 files changed

+57
-57
lines changed

4 files changed

+57
-57
lines changed
 

‎Package.resolved

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@
3232
"kind" : "remoteSourceControl",
3333
"location" : "https://github.com/apple/swift-syntax.git",
3434
"state" : {
35-
"revision" : "74203046135342e4a4a627476dd6caf8b28fe11b",
36-
"version" : "509.0.0"
35+
"revision" : "303e5c5c36d6a558407d364878df131c3546fad8",
36+
"version" : "510.0.2"
3737
}
3838
},
3939
{

‎Package.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ let package = Package(
1515
dependencies: [
1616
.package(
1717
url: "https://github.com/apple/swift-syntax.git",
18-
from: "509.0.0"
18+
from: "510.0.0"
1919
),
2020
.package(url: "https://github.com/apple/swift-docc-plugin", from: "1.3.0"),
2121
.package(url: "https://github.com/SwiftPackageIndex/SPIManifest.git", from: "0.12.0"),
@@ -47,7 +47,7 @@ let package = Package(
4747
.testTarget(
4848
name: "MacroToolkitTests",
4949
dependencies: [
50-
"MacroToolkitExample",
50+
"MacroToolkitExamplePlugin",
5151
"MacroToolkit",
5252
.product(name: "SwiftSyntax", package: "swift-syntax"),
5353
.product(name: "SwiftSyntaxMacros", package: "swift-syntax"),

‎Sources/MacroToolkitExamplePlugin/AddBlockerMacro.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public struct AddBlockerMacro: ExpressionMacro {
4747
of node: some FreestandingMacroExpansionSyntax,
4848
in context: some MacroExpansionContext
4949
) throws -> ExprSyntax {
50-
guard let (argument) = destructureSingle(node.argumentList) else {
50+
guard let (argument) = destructureSingle(node.arguments) else {
5151
throw MacroError("#addBlocker only expects one argument")
5252
}
5353

‎Tests/MacroToolkitTests/MacroToolkitTests.swift

+52-52
Original file line numberDiff line numberDiff line change
@@ -318,15 +318,15 @@ final class MacroToolkitTests: XCTestCase {
318318
expandedSource: """
319319
320320
struct Point {
321-
var x: Int = 1 {
321+
var x: Int {
322322
get {
323323
_storage["x", default: 1] as! Int
324324
}
325325
set {
326326
_storage["x"] = newValue
327327
}
328328
}
329-
var y: Int = 2 {
329+
var y: Int {
330330
get {
331331
_storage["y", default: 2] as! Int
332332
}
@@ -562,7 +562,7 @@ final class MacroToolkitTests: XCTestCase {
562562
XCTAssertEqual(n.initialValue?._syntax.description, "[1, 2.5]")
563563
XCTAssertEqual(n.isLazy, true)
564564
}
565-
565+
566566
func testAsyncInterfaceMacro() throws {
567567
assertMacroExpansion(
568568
"""
@@ -572,17 +572,17 @@ final class MacroToolkitTests: XCTestCase {
572572
}
573573
""",
574574
expandedSource:
575-
"""
576-
protocol API {
577-
func request(completion: (Int) -> Void)
578-
579-
func request() async -> Int
580-
}
581-
""",
575+
"""
576+
protocol API {
577+
func request(completion: (Int) -> Void)
578+
579+
func request() async -> Int
580+
}
581+
""",
582582
macros: testMacros
583583
)
584584
}
585-
585+
586586
func testAsyncInterfaceAllMembersMacro() throws {
587587
assertMacroExpansion(
588588
"""
@@ -593,16 +593,16 @@ final class MacroToolkitTests: XCTestCase {
593593
}
594594
""",
595595
expandedSource:
596-
"""
597-
protocol API {
598-
func request1(completion: (Int) -> Void)
599-
func request2(completion: (String) -> Void)
600-
601-
func request1() async -> Int
596+
"""
597+
protocol API {
598+
func request1(completion: (Int) -> Void)
599+
func request2(completion: (String) -> Void)
602600
603-
func request2() async -> String
604-
}
605-
""",
601+
func request1() async -> Int
602+
603+
func request2() async -> String
604+
}
605+
""",
606606
macros: testMacros
607607
)
608608
}
@@ -617,21 +617,21 @@ final class MacroToolkitTests: XCTestCase {
617617
}
618618
""",
619619
expandedSource:
620-
"""
621-
struct Client {
622-
func request1(completion: (Int) -> Void) {
623-
completion(0)
624-
}
625-
626-
func request1() async -> Int {
627-
await withCheckedContinuation { continuation in
628-
request1() { returnValue in
629-
continuation.resume(returning: returnValue)
620+
"""
621+
struct Client {
622+
func request1(completion: (Int) -> Void) {
623+
completion(0)
624+
}
625+
626+
func request1() async -> Int {
627+
await withCheckedContinuation { continuation in
628+
request1() { returnValue in
629+
continuation.resume(returning: returnValue)
630+
}
630631
}
631632
}
632633
}
633-
}
634-
""",
634+
""",
635635
macros: testMacros
636636
)
637637
}
@@ -649,32 +649,32 @@ final class MacroToolkitTests: XCTestCase {
649649
}
650650
""",
651651
expandedSource:
652-
"""
653-
struct Client {
654-
func request1(completion: (Int) -> Void) {
655-
completion(0)
656-
}
657-
func request2(completion: (String) -> Void) {
658-
completion("")
659-
}
660-
661-
func request1() async -> Int {
662-
await withCheckedContinuation { continuation in
663-
request1() { returnValue in
664-
continuation.resume(returning: returnValue)
652+
"""
653+
struct Client {
654+
func request1(completion: (Int) -> Void) {
655+
completion(0)
656+
}
657+
func request2(completion: (String) -> Void) {
658+
completion("")
659+
}
660+
661+
func request1() async -> Int {
662+
await withCheckedContinuation { continuation in
663+
request1() { returnValue in
664+
continuation.resume(returning: returnValue)
665+
}
665666
}
666667
}
667-
}
668668
669-
func request2() async -> String {
670-
await withCheckedContinuation { continuation in
671-
request2() { returnValue in
672-
continuation.resume(returning: returnValue)
669+
func request2() async -> String {
670+
await withCheckedContinuation { continuation in
671+
request2() { returnValue in
672+
continuation.resume(returning: returnValue)
673+
}
673674
}
674675
}
675676
}
676-
}
677-
""",
677+
""",
678678
macros: testMacros
679679
)
680680
}

0 commit comments

Comments
 (0)
Please sign in to comment.