File tree Expand file tree Collapse file tree 3 files changed +10
-8
lines changed
Sources/_SwiftSyntaxMacros/MacroProtocols
Tests/SwiftSyntaxMacrosTest Expand file tree Collapse file tree 3 files changed +10
-8
lines changed Original file line number Diff line number Diff line change @@ -13,8 +13,8 @@ import SwiftSyntax
13
13
public protocol CodeItemMacro : FreestandingMacro {
14
14
/// Expand a macro described by the given freestanding macro expansion
15
15
/// declaration within the given context to produce a set of declarations.
16
- static func expansion(
16
+ static func expansion< Context : MacroExpansionContext > (
17
17
of node: MacroExpansionDeclSyntax ,
18
- in context: any MacroExpansionContext
18
+ in context: Context
19
19
) throws -> [ CodeBlockItemSyntax ]
20
20
}
Original file line number Diff line number Diff line change @@ -13,9 +13,11 @@ import SwiftSyntax
13
13
public protocol DeclarationMacro : FreestandingMacro {
14
14
/// Expand a macro described by the given freestanding macro expansion
15
15
/// declaration within the given context to produce a set of declarations.
16
- static func expansion(
16
+ static func expansion<
17
+ Context: MacroExpansionContext
18
+ > (
17
19
of node: MacroExpansionDeclSyntax ,
18
- in context: any MacroExpansionContext
20
+ in context: Context
19
21
) throws -> [ DeclSyntax ]
20
22
}
21
23
Original file line number Diff line number Diff line change @@ -198,9 +198,9 @@ extension SimpleDiagnosticMessage: FixItMessage {
198
198
}
199
199
200
200
public struct ErrorMacro : DeclarationMacro {
201
- public static func expansion(
201
+ public static func expansion< Context : MacroExpansionContext > (
202
202
of node: MacroExpansionDeclSyntax ,
203
- in context: any MacroExpansionContext
203
+ in context: Context
204
204
) throws -> [ DeclSyntax ] {
205
205
guard let firstElement = node. argumentList. first,
206
206
let stringLiteral = firstElement. expression
@@ -227,9 +227,9 @@ public struct ErrorMacro: DeclarationMacro {
227
227
}
228
228
229
229
struct DefineBitwidthNumberedStructsMacro : DeclarationMacro {
230
- static func expansion(
230
+ static func expansion< Context : MacroExpansionContext > (
231
231
of node: MacroExpansionDeclSyntax ,
232
- in context: any MacroExpansionContext
232
+ in context: Context
233
233
) throws -> [ DeclSyntax ] {
234
234
guard let firstElement = node. argumentList. first,
235
235
let stringLiteral = firstElement. expression
You can’t perform that action at this time.
0 commit comments