Skip to content

Commit 2771a33

Browse files
authored
Merge pull request #127 from Matejkob/swift-6
Add Support for Swift 6.0
2 parents 371c050 + 07ae071 commit 2771a33

File tree

8 files changed

+96
-7
lines changed

8 files changed

+96
-7
lines changed

.github/workflows/ci.yml

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ jobs:
2323
strategy:
2424
matrix:
2525
xcode:
26+
- '16.1'
2627
- '16.0'
2728
- '15.4'
2829
package:

Examples/Package.resolved

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
"kind" : "remoteSourceControl",
66
"location" : "https://github.com/swiftlang/swift-syntax",
77
"state" : {
8-
"revision" : "303e5c5c36d6a558407d364878df131c3546fad8",
9-
"version" : "510.0.2"
8+
"revision" : "0687f71944021d616d34d922343dcef086855920",
9+
"version" : "600.0.1"
1010
}
1111
}
1212
],

Examples/[email protected]

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
// swift-tools-version: 6.0
2+
3+
import PackageDescription
4+
5+
let package = Package(
6+
name: "Examples",
7+
platforms: [
8+
.macOS(.v10_15),
9+
.iOS(.v13),
10+
.tvOS(.v13),
11+
.watchOS(.v6),
12+
.macCatalyst(.v13),
13+
],
14+
products: [
15+
.library(
16+
name: "Examples",
17+
targets: ["Examples"]
18+
)
19+
],
20+
dependencies: [
21+
.package(name: "swift-spyable", path: "../")
22+
],
23+
targets: [
24+
.target(
25+
name: "Examples",
26+
dependencies: [
27+
.product(name: "Spyable", package: "swift-spyable")
28+
],
29+
path: "Sources"
30+
),
31+
.testTarget(
32+
name: "ExamplesTests",
33+
dependencies: ["Examples"],
34+
path: "Tests"
35+
),
36+
],
37+
swiftLanguageModes: [.v6]
38+
)

Package.resolved

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
"kind" : "remoteSourceControl",
66
"location" : "https://github.com/swiftlang/swift-syntax",
77
"state" : {
8-
"revision" : "303e5c5c36d6a558407d364878df131c3546fad8",
9-
"version" : "510.0.2"
8+
"revision" : "0687f71944021d616d34d922343dcef086855920",
9+
"version" : "600.0.1"
1010
}
1111
}
1212
],

Package.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ let package = Package(
1919
)
2020
],
2121
dependencies: [
22-
.package(url: "https://github.com/swiftlang/swift-syntax", "509.0.0"..<"601.0.0-prerelease")
22+
.package(url: "https://github.com/swiftlang/swift-syntax", "509.0.0"..<"601.0.0")
2323
],
2424
targets: [
2525
.macro(

[email protected]

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
// swift-tools-version: 6.0
2+
3+
import CompilerPluginSupport
4+
import PackageDescription
5+
6+
let package = Package(
7+
name: "swift-spyable",
8+
platforms: [
9+
.macOS(.v10_15),
10+
.iOS(.v13),
11+
.tvOS(.v13),
12+
.watchOS(.v6),
13+
.macCatalyst(.v13),
14+
],
15+
products: [
16+
.library(
17+
name: "Spyable",
18+
targets: ["Spyable"]
19+
)
20+
],
21+
dependencies: [
22+
.package(url: "https://github.com/swiftlang/swift-syntax", "509.0.0"..<"601.0.0")
23+
],
24+
targets: [
25+
.macro(
26+
name: "SpyableMacro",
27+
dependencies: [
28+
.product(name: "SwiftSyntaxMacros", package: "swift-syntax"),
29+
.product(name: "SwiftCompilerPlugin", package: "swift-syntax"),
30+
]
31+
),
32+
.target(
33+
name: "Spyable",
34+
dependencies: [
35+
"SpyableMacro"
36+
]
37+
),
38+
.testTarget(
39+
name: "SpyableMacroTests",
40+
dependencies: [
41+
"SpyableMacro",
42+
.product(name: "SwiftSyntaxMacrosTestSupport", package: "swift-syntax"),
43+
]
44+
),
45+
],
46+
swiftLanguageModes: [.v6]
47+
)

Sources/SpyableMacro/Extensions/TypeSyntax+Extensions.swift

+4
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,10 @@ extension ArrayTypeSyntax: TypeSyntaxSupportingGenerics {
101101
}
102102
}
103103

104+
#if compiler(>=6.0)
105+
extension GenericArgumentClauseSyntax: @retroactive TypeSyntaxProtocol {}
106+
#endif
107+
104108
extension GenericArgumentClauseSyntax: TypeSyntaxSupportingGenerics {
105109
fileprivate var nestedTypeSyntaxes: [TypeSyntax] {
106110
arguments.map { $0.argument }

Sources/SpyableMacro/Factories/VariablesImplementationFactory.swift

+1-2
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,6 @@ import SwiftSyntaxBuilder
4343
/// - Important: The variable declaration must have exactly one binding. Any deviation from this will result in
4444
/// an error diagnostic produced by the macro.
4545
struct VariablesImplementationFactory {
46-
private let accessorRemovalVisitor = AccessorRemovalVisitor()
47-
4846
@MemberBlockItemListBuilder
4947
func variablesDeclarations(
5048
protocolVariableDeclaration: VariableDeclSyntax
@@ -60,6 +58,7 @@ struct VariablesImplementationFactory {
6058
if binding.typeAnnotation?.type.is(OptionalTypeSyntax.self) == true
6159
|| binding.typeAnnotation?.type.is(ImplicitlyUnwrappedOptionalTypeSyntax.self) == true
6260
{
61+
let accessorRemovalVisitor = AccessorRemovalVisitor()
6362
accessorRemovalVisitor.visit(protocolVariableDeclaration)
6463
/*
6564
var name: String

0 commit comments

Comments
 (0)