Skip to content

Commit 3343fe0

Browse files
authored
Merge pull request #1775 from rintaro/5.9-macros-protocols-params-some
2 parents df91a75 + c0cfb35 commit 3343fe0

File tree

8 files changed

+25
-50
lines changed

8 files changed

+25
-50
lines changed

Sources/SwiftSyntaxMacros/MacroProtocols/AccessorMacro.swift

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,9 @@ public protocol AccessorMacro: AttachedMacro {
1414
/// Expand a macro that's expressed as a custom attribute attached to
1515
/// the given declaration. The result is a set of accessors for the
1616
/// declaration.
17-
static func expansion<
18-
Context: MacroExpansionContext,
19-
Declaration: DeclSyntaxProtocol
20-
>(
17+
static func expansion(
2118
of node: AttributeSyntax,
22-
providingAccessorsOf declaration: Declaration,
23-
in context: Context
19+
providingAccessorsOf declaration: some DeclSyntaxProtocol,
20+
in context: some MacroExpansionContext
2421
) throws -> [AccessorDeclSyntax]
2522
}

Sources/SwiftSyntaxMacros/MacroProtocols/CodeItemMacro.swift

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,8 @@ import SwiftSyntax
1313
public protocol CodeItemMacro: FreestandingMacro {
1414
/// Expand a macro described by the given freestanding macro expansion
1515
/// declaration within the given context to produce a set of declarations.
16-
static func expansion<
17-
Node: FreestandingMacroExpansionSyntax,
18-
Context: MacroExpansionContext
19-
>(
20-
of node: Node,
21-
in context: Context
16+
static func expansion(
17+
of node: some FreestandingMacroExpansionSyntax,
18+
in context: some MacroExpansionContext
2219
) throws -> [CodeBlockItemSyntax]
2320
}

Sources/SwiftSyntaxMacros/MacroProtocols/ConformanceMacro.swift

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,9 @@ public protocol ConformanceMacro: AttachedMacro {
2525
/// - Returns: the set of `(type, where-clause?)` pairs that each provide the
2626
/// protocol type to which the declared type conforms, along with
2727
/// an optional where clause.
28-
static func expansion<
29-
Declaration: DeclGroupSyntax,
30-
Context: MacroExpansionContext
31-
>(
28+
static func expansion(
3229
of node: AttributeSyntax,
33-
providingConformancesOf declaration: Declaration,
34-
in context: Context
30+
providingConformancesOf declaration: some DeclGroupSyntax,
31+
in context: some MacroExpansionContext
3532
) throws -> [(TypeSyntax, GenericWhereClauseSyntax?)]
3633
}

Sources/SwiftSyntaxMacros/MacroProtocols/DeclarationMacro.swift

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,9 @@ import SwiftSyntax
1313
public protocol DeclarationMacro: FreestandingMacro {
1414
/// Expand a macro described by the given freestanding macro expansion
1515
/// declaration within the given context to produce a set of declarations.
16-
static func expansion<
17-
Node: FreestandingMacroExpansionSyntax,
18-
Context: MacroExpansionContext
19-
>(
20-
of node: Node,
21-
in context: Context
16+
static func expansion(
17+
of node: some FreestandingMacroExpansionSyntax,
18+
in context: some MacroExpansionContext
2219
) throws -> [DeclSyntax]
2320

2421
/// Whether to copy attributes on the expansion syntax to expanded declarations,

Sources/SwiftSyntaxMacros/MacroProtocols/ExpressionMacro.swift

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,8 @@ import SwiftSyntax
1616
public protocol ExpressionMacro: FreestandingMacro {
1717
/// Expand a macro described by the given freestanding macro expansion
1818
/// within the given context to produce a replacement expression.
19-
static func expansion<
20-
Node: FreestandingMacroExpansionSyntax,
21-
Context: MacroExpansionContext
22-
>(
23-
of node: Node,
24-
in context: Context
19+
static func expansion(
20+
of node: some FreestandingMacroExpansionSyntax,
21+
in context: some MacroExpansionContext
2522
) throws -> ExprSyntax
2623
}

Sources/SwiftSyntaxMacros/MacroProtocols/MemberAttributeMacro.swift

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,10 @@ public protocol MemberAttributeMacro: AttachedMacro {
2525
/// - context: The context in which to perform the macro expansion.
2626
///
2727
/// - Returns: the set of attributes to apply to the given member.
28-
static func expansion<
29-
Declaration: DeclGroupSyntax,
30-
MemberDeclaration: DeclSyntaxProtocol,
31-
Context: MacroExpansionContext
32-
>(
28+
static func expansion(
3329
of node: AttributeSyntax,
34-
attachedTo declaration: Declaration,
35-
providingAttributesFor member: MemberDeclaration,
36-
in context: Context
30+
attachedTo declaration: some DeclGroupSyntax,
31+
providingAttributesFor member: some DeclSyntaxProtocol,
32+
in context: some MacroExpansionContext
3733
) throws -> [AttributeSyntax]
3834
}

Sources/SwiftSyntaxMacros/MacroProtocols/MemberMacro.swift

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,9 @@ public protocol MemberMacro: AttachedMacro {
2323
///
2424
/// - Returns: the set of member declarations introduced by this macro, which
2525
/// are nested inside the `attachedTo` declaration.
26-
static func expansion<
27-
Declaration: DeclGroupSyntax,
28-
Context: MacroExpansionContext
29-
>(
26+
static func expansion(
3027
of node: AttributeSyntax,
31-
providingMembersOf declaration: Declaration,
32-
in context: Context
28+
providingMembersOf declaration: some DeclGroupSyntax,
29+
in context: some MacroExpansionContext
3330
) throws -> [DeclSyntax]
3431
}

Sources/SwiftSyntaxMacros/MacroProtocols/PeerMacro.swift

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,9 @@ public protocol PeerMacro: AttachedMacro {
1616
///
1717
/// The macro expansion can introduce "peer" declarations that sit alongside
1818
/// the given declaration.
19-
static func expansion<
20-
Context: MacroExpansionContext,
21-
Declaration: DeclSyntaxProtocol
22-
>(
19+
static func expansion(
2320
of node: AttributeSyntax,
24-
providingPeersOf declaration: Declaration,
25-
in context: Context
21+
providingPeersOf declaration: some DeclSyntaxProtocol,
22+
in context: some MacroExpansionContext
2623
) throws -> [DeclSyntax]
2724
}

0 commit comments

Comments
 (0)