Skip to content

Commit 4c9c719

Browse files
authored
Merge pull request #1313 from hborla/member-attribute-protocol-fix
[Macros] Update the `MemberAttributeMacro.expansion` requirement.
2 parents 013a48e + aa9dcd1 commit 4c9c719

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

Sources/SwiftSyntaxMacros/MacroProtocols/MemberAttributeMacro.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,12 @@ public protocol MemberAttributeMacro: AttachedMacro {
2727
/// - Returns: the set of attributes to apply to the given member.
2828
static func expansion<
2929
Declaration: DeclGroupSyntax,
30+
MemberDeclaration: DeclSyntaxProtocol,
3031
Context: MacroExpansionContext
3132
>(
3233
of node: AttributeSyntax,
3334
attachedTo declaration: Declaration,
34-
providingAttributesFor member: DeclSyntax,
35+
providingAttributesFor member: MemberDeclaration,
3536
in context: Context
3637
) throws -> [AttributeSyntax]
3738
}

Tests/SwiftSyntaxMacrosTest/MacroSystemTests.swift

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -469,11 +469,12 @@ public struct AddBackingStorage: MemberMacro {
469469
public struct WrapAllProperties: MemberAttributeMacro {
470470
public static func expansion<
471471
Declaration: DeclGroupSyntax,
472+
MemberDeclaration: DeclSyntaxProtocol,
472473
Context: MacroExpansionContext
473474
>(
474475
of node: AttributeSyntax,
475476
attachedTo decl: Declaration,
476-
providingAttributesFor member: DeclSyntax,
477+
providingAttributesFor member: MemberDeclaration,
477478
in context: Context
478479
) throws -> [AttributeSyntax] {
479480
guard member.is(VariableDeclSyntax.self) else {
@@ -494,11 +495,12 @@ public struct WrapAllProperties: MemberAttributeMacro {
494495
public struct WrapStoredProperties: MemberAttributeMacro {
495496
public static func expansion<
496497
Declaration: DeclGroupSyntax,
498+
MemberDeclaration: DeclSyntaxProtocol,
497499
Context: MacroExpansionContext
498500
>(
499501
of node: AttributeSyntax,
500502
attachedTo decl: Declaration,
501-
providingAttributesFor member: DeclSyntax,
503+
providingAttributesFor member: MemberDeclaration,
502504
in context: Context
503505
) throws -> [AttributeSyntax] {
504506
guard let property = member.as(VariableDeclSyntax.self),
@@ -559,11 +561,12 @@ extension CustomTypeWrapperMacro: MemberMacro {
559561
extension CustomTypeWrapperMacro: MemberAttributeMacro {
560562
static func expansion<
561563
Declaration: DeclGroupSyntax,
564+
MemberDeclaration: DeclSyntaxProtocol,
562565
Context: MacroExpansionContext
563566
>(
564567
of node: AttributeSyntax,
565568
attachedTo declaration: Declaration,
566-
providingAttributesFor member: DeclSyntax,
569+
providingAttributesFor member: MemberDeclaration,
567570
in context: Context
568571
) throws -> [AttributeSyntax] {
569572
return [

0 commit comments

Comments
 (0)