Skip to content

Commit 3c45cd3

Browse files
committed
Use some Protocol syntax
1 parent d5508bb commit 3c45cd3

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

lib/Macros/Sources/SwiftMacros/DebugDescriptionMacro.swift

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,13 @@ public enum _DebugDescriptionPropertyMacro {}
2323
/// The job of conversion is split across two macros. This macro performs some analysis on the attached
2424
/// type, and then delegates to `@_DebugDescriptionProperty` to perform the conversion step.
2525
extension DebugDescriptionMacro: MemberAttributeMacro {
26-
public static func expansion<DeclGroup, DeclSyntax, Context>(
26+
public static func expansion(
2727
of node: AttributeSyntax,
28-
attachedTo declaration: DeclGroup,
29-
providingAttributesFor member: DeclSyntax,
30-
in context: Context
28+
attachedTo declaration: some DeclGroupSyntax,
29+
providingAttributesFor member: some DeclSyntaxProtocol,
30+
in context: some MacroExpansionContext
3131
)
3232
throws -> [AttributeSyntax]
33-
where DeclGroup: DeclGroupSyntax, DeclSyntax: DeclSyntaxProtocol, Context: MacroExpansionContext
3433
{
3534
guard !declaration.is(ProtocolDeclSyntax.self) else {
3635
let message: ErrorMessage = "cannot be attached to a protocol"
@@ -119,13 +118,12 @@ extension DebugDescriptionMacro: MemberAttributeMacro {
119118
///
120119
/// See https://lldb.llvm.org/use/variable.html#type-summary
121120
extension _DebugDescriptionPropertyMacro: PeerMacro {
122-
public static func expansion<Decl, Context>(
121+
public static func expansion(
123122
of node: AttributeSyntax,
124-
providingPeersOf declaration: Decl,
125-
in context: Context
123+
providingPeersOf declaration: some DeclSyntaxProtocol,
124+
in context: some MacroExpansionContext
126125
)
127126
throws -> [DeclSyntax]
128-
where Decl: DeclSyntaxProtocol, Context: MacroExpansionContext
129127
{
130128
guard let arguments = node.arguments else {
131129
// Assertion as a diagnostic.
@@ -346,7 +344,7 @@ extension MacroExpansionContext {
346344
extension MacroExpansionContext {
347345
/// Determine the module name of the Syntax node, via its fileID.
348346
/// See https://developer.apple.com/documentation/swift/fileid()
349-
fileprivate func moduleName<T: SyntaxProtocol>(of node: T) -> String? {
347+
fileprivate func moduleName(of node: some SyntaxProtocol) -> String? {
350348
if let fileID = self.location(of: node)?.file.as(StringLiteralExprSyntax.self)?.representedLiteralValue,
351349
let firstSlash = fileID.firstIndex(of: "/") {
352350
return String(fileID.prefix(upTo: firstSlash))

0 commit comments

Comments
 (0)