Skip to content

Commit b9ef035

Browse files
committed
Generize PeerMacro
1 parent 511eb07 commit b9ef035

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

Sources/_SwiftSyntaxMacros/MacroProtocols/PeerMacro.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ public protocol PeerMacro: AttachedMacro {
1616
///
1717
/// The macro expansion can introduce "peer" declarations that sit alongside
1818
/// the given declaration.
19-
static func expansion(
19+
static func expansion<Context: MacroExpansionContext>(
2020
of node: AttributeSyntax,
2121
attachedTo declaration: DeclSyntax,
22-
in context: any MacroExpansionContext
22+
in context: Context
2323
) throws -> [DeclSyntax]
2424
}
2525

Tests/SwiftSyntaxMacrosTest/MacroSystemTests.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -285,10 +285,10 @@ extension PropertyWrapper: AccessorMacro {
285285
}
286286

287287
extension PropertyWrapper: PeerMacro {
288-
public static func expansion(
288+
public static func expansion<Context: MacroExpansionContext>(
289289
of node: AttributeSyntax,
290290
attachedTo declaration: DeclSyntax,
291-
in context: any MacroExpansionContext
291+
in context: Context
292292
) throws -> [SwiftSyntax.DeclSyntax] {
293293
guard let varDecl = declaration.as(VariableDeclSyntax.self),
294294
let binding = varDecl.bindings.first,
@@ -322,10 +322,10 @@ extension PropertyWrapper: PeerMacro {
322322
}
323323

324324
public struct AddCompletionHandler: PeerMacro {
325-
public static func expansion(
325+
public static func expansion<Context: MacroExpansionContext>(
326326
of node: AttributeSyntax,
327327
attachedTo declaration: DeclSyntax,
328-
in context: any MacroExpansionContext
328+
in context: Context
329329
) throws -> [DeclSyntax] {
330330
// Only on functions at the moment. We could handle initializers as well
331331
// with a bit of work.

0 commit comments

Comments
 (0)