Skip to content

Commit 7513c79

Browse files
committed
Emit a warning if a conformance to MemberMacro does not contain the expansion method that takes a conformingTo parameter
The `expansion` method that takes a `conformingTo` has been defaulted to be source-compatible with older versions of swift-syntax that required a version of the `expansion` function without the `conformingTo` parameter. That meant that you could state a conformance to `MemberMacro` without implementing any methods and you wouldn’t get any compile time diagnostics. Deprecate the forwarding default implementation so that you get a warning if you are relying on it.
1 parent 3db6f01 commit 7513c79

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Sources/SwiftSyntaxMacros/MacroProtocols/MemberMacro.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,11 @@ extension MemberMacro {
8181
}
8282

8383
/// Default implementation that ignores the unhandled conformances.
84+
@available(
85+
*,
86+
deprecated,
87+
message: "`MemberMacro` conformance should implement the `expansion` function that takes a `conformingTo` parameter"
88+
)
8489
public static func expansion(
8590
of node: AttributeSyntax,
8691
providingMembersOf declaration: some DeclGroupSyntax,

0 commit comments

Comments
 (0)