Skip to content

Commit

Permalink
Update SwiftSyntax. (#190)
Browse files Browse the repository at this point in the history
* Update SwiftSyntax.

* wip

* re-record snapshots

* wip

* fix

* disable wasm for now

* wip

* wip

* wip

* Disable Wasm CI for now

---------

Co-authored-by: Stephen Celis <[email protected]>
  • Loading branch information
mbrandonw and stephencelis authored Mar 5, 2024
1 parent f5f64da commit 04d632f
Show file tree
Hide file tree
Showing 8 changed files with 116 additions and 109 deletions.
31 changes: 13 additions & 18 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
config: ['debug', 'release']
xcode: ['14.3.1', '15.0.1']
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Select Xcode ${{ matrix.xcode }}
run: sudo xcode-select -s /Applications/Xcode_${{ matrix.xcode }}.app
- name: Skip macro validation
Expand All @@ -38,7 +38,7 @@ jobs:
# name: Integration (UI Tests)
# runs-on: macos-13
# steps:
# - uses: actions/checkout@v3
# - uses: actions/checkout@v4
# - name: Select Xcode 14.3.1
# run: sudo xcode-select -s /Applications/Xcode_14.3.1.app
# - name: Run tests
Expand All @@ -48,23 +48,18 @@ jobs:
name: Linux
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Run tests
run: make test-swift

wasm:
name: Wasm
runs-on: ubuntu-latest
strategy:
matrix:
include:
- { toolchain: wasm-5.7.1-RELEASE }
steps:
- uses: actions/checkout@v3
- run: echo "${{ matrix.toolchain }}" > .swift-version
- uses: swiftwasm/[email protected]
with:
shell-action: carton test --environment node
# wasm:
# name: Wasm
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# - uses: swiftwasm/[email protected]
# with:
# shell-action: carton test

# windows:
# name: Windows
Expand All @@ -75,7 +70,7 @@ jobs:
# branch: swift-5.8-release
# tag: 5.8-RELEASE

# - uses: actions/checkout@v3
# - uses: actions/checkout@v4
# - name: Run tests
# run: swift test
# - name: Run tests (release)
Expand All @@ -89,7 +84,7 @@ jobs:
container:
image: ${{ matrix.image }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Build for static-stdlib (debug)
run: swift build -c debug --static-swift-stdlib
- name: Build for static-stdlib (release)
Expand Down
28 changes: 14 additions & 14 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-argument-parser",
"state" : {
"revision" : "fee6933f37fde9a5e12a1e4aeaa93fe60116ff2a",
"version" : "1.2.2"
"revision" : "c8ed701b513cf5177118a175d85fbbbcd707ab41",
"version" : "1.3.0"
}
},
{
Expand All @@ -32,17 +32,17 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/swift-clocks",
"state" : {
"revision" : "d1fd837326aa719bee979bdde1f53cd5797443eb",
"version" : "1.0.0"
"revision" : "a8421d68068d8f45fbceb418fbf22c5dad4afd33",
"version" : "1.0.2"
}
},
{
"identity" : "swift-concurrency-extras",
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/swift-concurrency-extras",
"state" : {
"revision" : "ea631ce892687f5432a833312292b80db238186a",
"version" : "1.0.0"
"revision" : "bb5059bde9022d69ac516803f4f227d8ac967f71",
"version" : "1.1.0"
}
},
{
Expand All @@ -68,35 +68,35 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/swift-macro-testing",
"state" : {
"revision" : "35acd9468d40ae87e75991a18af6271e8124c261",
"version" : "0.2.1"
"revision" : "90e38eec4bf661ec0da1bbfd3ec507d0f0c05310",
"version" : "0.3.0"
}
},
{
"identity" : "swift-snapshot-testing",
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/swift-snapshot-testing",
"state" : {
"revision" : "bb0ea08db8e73324fe6c3727f755ca41a23ff2f4",
"version" : "1.14.2"
"revision" : "5b0c434778f2c1a4c9b5ebdb8682b28e84dd69bd",
"version" : "1.15.4"
}
},
{
"identity" : "swift-syntax",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-syntax",
"state" : {
"revision" : "ffa3cd6fc2aa62adbedd31d3efaf7c0d86a9f029",
"version" : "509.0.1"
"revision" : "08a2f0a9a30e0f705f79c9cfaca1f68b71bdc775",
"version" : "510.0.0"
}
},
{
"identity" : "xctest-dynamic-overlay",
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/xctest-dynamic-overlay",
"state" : {
"revision" : "23cbf2294e350076ea4dbd7d5d047c1e76b03631",
"version" : "1.0.2"
"branch" : "main",
"revision" : "32f6057b7c642802fe39b93007cb687f80f2e535"
}
}
],
Expand Down
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ let package = Package(
.package(url: "https://github.com/pointfreeco/combine-schedulers", from: "1.0.0"),
.package(url: "https://github.com/pointfreeco/swift-clocks", from: "1.0.0"),
.package(url: "https://github.com/pointfreeco/swift-concurrency-extras", from: "1.0.0"),
.package(url: "https://github.com/pointfreeco/xctest-dynamic-overlay", from: "1.0.0"),
.package(url: "https://github.com/pointfreeco/xctest-dynamic-overlay", branch: "main"),
],
targets: [
.target(
Expand Down
47 changes: 27 additions & 20 deletions [email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,12 @@ let package = Package(
),
],
dependencies: [
.package(url: "https://github.com/apple/swift-syntax", from: "509.0.0"),
.package(url: "https://github.com/apple/swift-syntax", "509.0.0"..<"511.0.0"),
.package(url: "https://github.com/google/swift-benchmark", from: "0.1.0"),
.package(url: "https://github.com/pointfreeco/combine-schedulers", from: "1.0.0"),
.package(url: "https://github.com/pointfreeco/swift-clocks", from: "1.0.0"),
.package(url: "https://github.com/pointfreeco/swift-concurrency-extras", from: "1.0.0"),
.package(url: "https://github.com/pointfreeco/swift-macro-testing", from: "0.2.0"),
.package(url: "https://github.com/pointfreeco/xctest-dynamic-overlay", from: "1.0.0"),
.package(url: "https://github.com/pointfreeco/xctest-dynamic-overlay", branch: "main"),
],
targets: [
.target(
Expand Down Expand Up @@ -67,13 +66,6 @@ let package = Package(
.product(name: "SwiftCompilerPlugin", package: "swift-syntax"),
]
),
.testTarget(
name: "DependenciesMacrosPluginTests",
dependencies: [
"DependenciesMacrosPlugin",
.product(name: "MacroTesting", package: "swift-macro-testing"),
]
),
.executableTarget(
name: "swift-dependencies-benchmark",
dependencies: [
Expand All @@ -84,21 +76,36 @@ let package = Package(
]
)

#if !os(Windows)
// Add the documentation compiler plugin if possible
#if !os(macOS) && !os(WASI)
package.products.append(
.library(
name: "DependenciesTestObserver",
type: .dynamic,
targets: ["DependenciesTestObserver"]
)
)
#endif

#if !os(WASI)
package.dependencies.append(
.package(url: "https://github.com/apple/swift-docc-plugin", from: "1.0.0")
.package(url: "https://github.com/pointfreeco/swift-macro-testing", from: "0.2.0")
)
package.targets.append(contentsOf: [
.testTarget(
name: "DependenciesMacrosPluginTests",
dependencies: [
"DependenciesMacrosPlugin",
.product(name: "MacroTesting", package: "swift-macro-testing"),
]
),
])
#endif

#if !os(macOS) && !os(WASI)
package.products.append(
.library(
name: "DependenciesTestObserver",
type: .dynamic,
targets: ["DependenciesTestObserver"]
#if !os(Windows)
// Add the documentation compiler plugin if possible
package.dependencies.append(
.package(url: "https://github.com/apple/swift-docc-plugin", from: "1.0.0")
)
)
#endif

//for target in package.targets {
Expand Down
11 changes: 6 additions & 5 deletions Sources/DependenciesMacrosPlugin/DependencyClientMacro.swift
Original file line number Diff line number Diff line change
Expand Up @@ -158,13 +158,14 @@ public enum DependencyClientMacro: MemberAttributeMacro, MemberMacro {
attributedTypeSyntax.attributes.append(
.attribute("@escaping").with(\.trailingTrivia, .space)
)
binding.typeAnnotation?.type = attributedTypeSyntax.cast(TypeSyntax.self)
binding.typeAnnotation?.type = TypeSyntax(attributedTypeSyntax)
} else if let typeSyntax = type.as(FunctionTypeSyntax.self) {
binding.typeAnnotation?.type = AttributedTypeSyntax(
attributes: [.attribute("@escaping").with(\.trailingTrivia, .space)],
baseType: typeSyntax
binding.typeAnnotation?.type = TypeSyntax(
AttributedTypeSyntax(
attributes: [.attribute("@escaping").with(\.trailingTrivia, .space)],
baseType: typeSyntax
)
)
.cast(TypeSyntax.self)
} else if binding.typeAnnotation == nil {
binding.pattern.trailingTrivia = ""
binding.typeAnnotation = TypeAnnotationSyntax(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ public enum DependencyEndpointMacro: AccessorMacro, PeerMacro {

let privateProperty = property.privatePrefixed("_", unimplementedDefault: unimplementedDefault)

return decls + [privateProperty.cast(DeclSyntax.self)]
return decls + [DeclSyntax(privateProperty)]
}
}

Expand Down
24 changes: 24 additions & 0 deletions Tests/DependenciesMacrosPluginTests/DependenciesMacros.xctestplan
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"configurations" : [
{
"id" : "53C60DBA-2CDB-4A5C-9411-7C681BEAAEF4",
"name" : "Test Scheme Action",
"options" : {

}
}
],
"defaultOptions" : {
"codeCoverage" : false
},
"testTargets" : [
{
"target" : {
"containerPath" : "container:",
"identifier" : "DependenciesMacrosPluginTests",
"name" : "DependenciesMacrosPluginTests"
}
}
],
"version" : 1
}
Loading

0 comments on commit 04d632f

Please sign in to comment.