@@ -23,6 +23,7 @@ public protocol MemberMacro: AttachedMacro {
23
23
///
24
24
/// - Returns: the set of member declarations introduced by this macro, which
25
25
/// are nested inside the `attachedTo` declaration.
26
+ @available ( * , deprecated, message: " Use expansion(of:providingMembersOf:implementingRequirementsFor:in: " )
26
27
static func expansion(
27
28
of node: AttributeSyntax ,
28
29
providingMembersOf declaration: some DeclGroupSyntax ,
@@ -34,7 +35,7 @@ public protocol MemberMacro: AttachedMacro {
34
35
/// - Parameters:
35
36
/// - node: The custom attribute describing the attached macro.
36
37
/// - declaration: The declaration the macro attribute is attached to.
37
- /// - missingConformancesTo : The set of protocols that were declared
38
+ /// - implementingRequirementsFor : The set of protocols that were declared
38
39
/// in the set of conformances for the macro and to which the declaration
39
40
/// does not explicitly conform. The member macro itself cannot declare
40
41
/// conformances to these protocols (only an extension macro can do that),
@@ -48,17 +49,26 @@ public protocol MemberMacro: AttachedMacro {
48
49
static func expansion(
49
50
of node: AttributeSyntax ,
50
51
providingMembersOf declaration: some DeclGroupSyntax ,
51
- missingConformancesTo protocols: [ TypeSyntax ] ,
52
+ implementingRequirementsFor protocols: [ TypeSyntax ] ,
52
53
in context: some MacroExpansionContext
53
54
) throws -> [ DeclSyntax ]
54
55
}
55
56
56
57
public extension MemberMacro {
58
+ /// Default implementation supplies no conformances.
59
+ static func expansion(
60
+ of node: AttributeSyntax ,
61
+ providingMembersOf declaration: some DeclGroupSyntax ,
62
+ in context: some MacroExpansionContext
63
+ ) throws -> [ DeclSyntax ] {
64
+ return try expansion ( of: node, providingMembersOf: declaration, implementingRequirementsFor: [ ] , in: context)
65
+ }
66
+
57
67
/// Default implementation that ignores the unhandled conformances.
58
68
static func expansion(
59
69
of node: AttributeSyntax ,
60
70
providingMembersOf declaration: some DeclGroupSyntax ,
61
- missingConformancesTo protocols: [ TypeSyntax ] ,
71
+ implementingRequirementsFor protocols: [ TypeSyntax ] ,
62
72
in context: some MacroExpansionContext
63
73
) throws -> [ DeclSyntax ] {
64
74
return try expansion ( of: node, providingMembersOf: declaration, in: context)
0 commit comments