@@ -23,7 +23,9 @@ 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:conformingTo:in: " )
26
+ ///
27
+ /// - Warning: This is the legacy `expansion` function of `MemberMacro` that is provided for backwards-compatiblity.
28
+ /// Use ``expansion(of:providingMembersOf:conformingTo:in:)-1sxoe`` instead.
27
29
static func expansion(
28
30
of node: AttributeSyntax ,
29
31
providingMembersOf declaration: some DeclGroupSyntax ,
@@ -54,14 +56,24 @@ public protocol MemberMacro: AttachedMacro {
54
56
) throws -> [ DeclSyntax ]
55
57
}
56
58
59
+ private struct UnimplementedExpansionMethodError : Error , CustomStringConvertible {
60
+ var description : String {
61
+ """
62
+ Types conforming to `MemberMacro` must implement either \
63
+ expansion(of:providingMembersOf:in:) or \
64
+ expansion(of:providingMembersOf:conformingTo:in:)
65
+ """
66
+ }
67
+ }
68
+
57
69
public extension MemberMacro {
58
70
/// Default implementation supplies no conformances.
59
71
static func expansion(
60
72
of node: AttributeSyntax ,
61
73
providingMembersOf declaration: some DeclGroupSyntax ,
62
74
in context: some MacroExpansionContext
63
75
) throws -> [ DeclSyntax ] {
64
- return try expansion ( of : node , providingMembersOf : declaration , conformingTo : [ ] , in : context )
76
+ throw UnimplementedExpansionMethodError ( )
65
77
}
66
78
67
79
/// Default implementation that ignores the unhandled conformances.
0 commit comments