File tree Expand file tree Collapse file tree 8 files changed +15
-15
lines changed
SwiftCompilerPluginMessageHandling
Tests/SwiftSyntaxMacroExpansionTest Expand file tree Collapse file tree 8 files changed +15
-15
lines changed Original file line number Diff line number Diff line change @@ -102,7 +102,7 @@ public enum PluginMessage {
102
102
}
103
103
}
104
104
105
- public struct MacroReference : Codable {
105
+ public struct MacroReference : Codable , Sendable {
106
106
public var moduleName : String
107
107
public var typeName : String
108
108
@@ -116,7 +116,7 @@ public enum PluginMessage {
116
116
}
117
117
}
118
118
119
- public enum MacroRole : String , Codable {
119
+ public enum MacroRole : String , Codable , Sendable {
120
120
case expression
121
121
case declaration
122
122
case accessor
File renamed without changes.
Original file line number Diff line number Diff line change 10
10
//
11
11
//===----------------------------------------------------------------------===//
12
12
13
- #include "AtomicBool .h"
13
+ #include "SwiftSyntaxAtomicBool .h"
14
14
15
15
AtomicBool atomic_bool_create (bool initialValue ) {
16
16
AtomicBool atomic ;
Original file line number Diff line number Diff line change @@ -299,7 +299,7 @@ final class AccessorMacroTests: XCTestCase {
299
299
providingAccessorsOf declaration: some DeclSyntaxProtocol ,
300
300
in context: some MacroExpansionContext
301
301
) throws -> [ AccessorDeclSyntax ] {
302
- context. diagnose ( Diagnostic ( node: node, message: MacroExpansionErrorMessage ( " test " ) ) )
302
+ context. diagnose ( Diagnostic ( node: node, message: SwiftSyntaxMacros . MacroExpansionErrorMessage ( " test " ) ) )
303
303
return [ ]
304
304
}
305
305
}
Original file line number Diff line number Diff line change @@ -52,12 +52,12 @@ final class CodeItemMacroTests: XCTestCase {
52
52
in context: some MacroExpansionContext
53
53
) throws -> [ CodeBlockItemSyntax ] {
54
54
guard !node. arguments. isEmpty else {
55
- throw MacroExpansionErrorMessage ( " '#unwrap' requires arguments " )
55
+ throw SwiftSyntaxMacros . MacroExpansionErrorMessage ( " '#unwrap' requires arguments " )
56
56
}
57
57
let errorThrower = node. trailingClosure
58
58
let identifiers = try node. arguments. map { argument in
59
59
guard let declReferenceExpr = argument. expression. as ( DeclReferenceExprSyntax . self) else {
60
- throw MacroExpansionErrorMessage ( " Arguments must be identifiers " )
60
+ throw SwiftSyntaxMacros . MacroExpansionErrorMessage ( " Arguments must be identifiers " )
61
61
}
62
62
return declReferenceExpr. baseName
63
63
}
Original file line number Diff line number Diff line change @@ -57,13 +57,13 @@ final class DeclarationMacroTests: XCTestCase {
57
57
stringLiteral. segments. count == 1 ,
58
58
case let . stringSegment( messageString) = stringLiteral. segments. first
59
59
else {
60
- throw MacroExpansionErrorMessage ( " #error macro requires a string literal " )
60
+ throw SwiftSyntaxMacros . MacroExpansionErrorMessage ( " #error macro requires a string literal " )
61
61
}
62
62
63
63
context. diagnose (
64
64
Diagnostic (
65
65
node: Syntax ( node) ,
66
- message: MacroExpansionErrorMessage ( messageString. content. description)
66
+ message: SwiftSyntaxMacros . MacroExpansionErrorMessage ( messageString. content. description)
67
67
)
68
68
)
69
69
@@ -110,7 +110,7 @@ final class DeclarationMacroTests: XCTestCase {
110
110
stringLiteral. segments. count == 1 ,
111
111
case let . stringSegment( prefix) = stringLiteral. segments. first
112
112
else {
113
- throw MacroExpansionErrorMessage (
113
+ throw SwiftSyntaxMacros . MacroExpansionErrorMessage (
114
114
" #bitwidthNumberedStructs macro requires a string literal "
115
115
)
116
116
}
Original file line number Diff line number Diff line change @@ -30,7 +30,7 @@ fileprivate struct StringifyMacro: ExpressionMacro {
30
30
in context: some MacroExpansionContext
31
31
) throws -> ExprSyntax {
32
32
guard let argument = macro. arguments. first? . expression else {
33
- throw MacroExpansionErrorMessage ( " missing argument " )
33
+ throw SwiftSyntaxMacros . MacroExpansionErrorMessage ( " missing argument " )
34
34
}
35
35
36
36
return " ( \( argument) , \( StringLiteralExprSyntax ( content: argument. description) ) ) "
@@ -167,7 +167,7 @@ final class ExpressionMacroTests: XCTestCase {
167
167
in context: some MacroExpansionContext
168
168
) throws -> ExprSyntax {
169
169
guard let sourceLoc: AbstractSourceLocation = context. location ( of: macro) else {
170
- throw MacroExpansionErrorMessage ( " can't find location for macro " )
170
+ throw SwiftSyntaxMacros . MacroExpansionErrorMessage ( " can't find location for macro " )
171
171
}
172
172
return sourceLoc. column
173
173
}
@@ -179,7 +179,7 @@ final class ExpressionMacroTests: XCTestCase {
179
179
in context: some MacroExpansionContext
180
180
) throws -> ExprSyntax {
181
181
guard let sourceLoc: AbstractSourceLocation = context. location ( of: macro) else {
182
- throw MacroExpansionErrorMessage ( " can't find location for macro " )
182
+ throw SwiftSyntaxMacros . MacroExpansionErrorMessage ( " can't find location for macro " )
183
183
}
184
184
return sourceLoc. file
185
185
}
Original file line number Diff line number Diff line change @@ -37,7 +37,7 @@ final class PeerMacroTests: XCTestCase {
37
37
// Only on functions at the moment. We could handle initializers as well
38
38
// with a bit of work.
39
39
guard let funcDecl = declaration. as ( FunctionDeclSyntax . self) else {
40
- throw MacroExpansionErrorMessage ( " @addCompletionHandler only works on functions " )
40
+ throw SwiftSyntaxMacros . MacroExpansionErrorMessage ( " @addCompletionHandler only works on functions " )
41
41
}
42
42
43
43
// This only makes sense for async functions.
@@ -53,12 +53,12 @@ final class PeerMacroTests: XCTestCase {
53
53
54
54
let diag = Diagnostic (
55
55
node: Syntax ( funcDecl. funcKeyword) ,
56
- message: MacroExpansionErrorMessage (
56
+ message: SwiftSyntaxMacros . MacroExpansionErrorMessage (
57
57
" can only add a completion-handler variant to an 'async' function "
58
58
) ,
59
59
fixIts: [
60
60
FixIt (
61
- message: MacroExpansionFixItMessage (
61
+ message: SwiftSyntaxMacros . MacroExpansionFixItMessage (
62
62
" add 'async' "
63
63
) ,
64
64
changes: [
You can’t perform that action at this time.
0 commit comments