File tree Expand file tree Collapse file tree 8 files changed +25
-50
lines changed
Sources/SwiftSyntaxMacros/MacroProtocols Expand file tree Collapse file tree 8 files changed +25
-50
lines changed Original file line number Diff line number Diff line change @@ -14,12 +14,9 @@ public protocol AccessorMacro: AttachedMacro {
14
14
/// Expand a macro that's expressed as a custom attribute attached to
15
15
/// the given declaration. The result is a set of accessors for the
16
16
/// declaration.
17
- static func expansion<
18
- Context: MacroExpansionContext ,
19
- Declaration: DeclSyntaxProtocol
20
- > (
17
+ static func expansion(
21
18
of node: AttributeSyntax ,
22
- providingAccessorsOf declaration: Declaration ,
23
- in context: Context
19
+ providingAccessorsOf declaration: some DeclSyntaxProtocol ,
20
+ in context: some MacroExpansionContext
24
21
) throws -> [ AccessorDeclSyntax ]
25
22
}
Original file line number Diff line number Diff line change @@ -13,11 +13,8 @@ import SwiftSyntax
13
13
public protocol CodeItemMacro : FreestandingMacro {
14
14
/// Expand a macro described by the given freestanding macro expansion
15
15
/// 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
22
19
) throws -> [ CodeBlockItemSyntax ]
23
20
}
Original file line number Diff line number Diff line change @@ -25,12 +25,9 @@ public protocol ConformanceMacro: AttachedMacro {
25
25
/// - Returns: the set of `(type, where-clause?)` pairs that each provide the
26
26
/// protocol type to which the declared type conforms, along with
27
27
/// an optional where clause.
28
- static func expansion<
29
- Declaration: DeclGroupSyntax ,
30
- Context: MacroExpansionContext
31
- > (
28
+ static func expansion(
32
29
of node: AttributeSyntax ,
33
- providingConformancesOf declaration: Declaration ,
34
- in context: Context
30
+ providingConformancesOf declaration: some DeclGroupSyntax ,
31
+ in context: some MacroExpansionContext
35
32
) throws -> [ ( TypeSyntax , GenericWhereClauseSyntax ? ) ]
36
33
}
Original file line number Diff line number Diff line change @@ -13,12 +13,9 @@ import SwiftSyntax
13
13
public protocol DeclarationMacro : FreestandingMacro {
14
14
/// Expand a macro described by the given freestanding macro expansion
15
15
/// 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
22
19
) throws -> [ DeclSyntax ]
23
20
24
21
/// Whether to copy attributes on the expansion syntax to expanded declarations,
Original file line number Diff line number Diff line change @@ -16,11 +16,8 @@ import SwiftSyntax
16
16
public protocol ExpressionMacro : FreestandingMacro {
17
17
/// Expand a macro described by the given freestanding macro expansion
18
18
/// 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
25
22
) throws -> ExprSyntax
26
23
}
Original file line number Diff line number Diff line change @@ -25,14 +25,10 @@ public protocol MemberAttributeMacro: AttachedMacro {
25
25
/// - context: The context in which to perform the macro expansion.
26
26
///
27
27
/// - 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(
33
29
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
37
33
) throws -> [ AttributeSyntax ]
38
34
}
Original file line number Diff line number Diff line change @@ -23,12 +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
- static func expansion<
27
- Declaration: DeclGroupSyntax ,
28
- Context: MacroExpansionContext
29
- > (
26
+ static func expansion(
30
27
of node: AttributeSyntax ,
31
- providingMembersOf declaration: Declaration ,
32
- in context: Context
28
+ providingMembersOf declaration: some DeclGroupSyntax ,
29
+ in context: some MacroExpansionContext
33
30
) throws -> [ DeclSyntax ]
34
31
}
Original file line number Diff line number Diff line change @@ -16,12 +16,9 @@ public protocol PeerMacro: AttachedMacro {
16
16
///
17
17
/// The macro expansion can introduce "peer" declarations that sit alongside
18
18
/// the given declaration.
19
- static func expansion<
20
- Context: MacroExpansionContext ,
21
- Declaration: DeclSyntaxProtocol
22
- > (
19
+ static func expansion(
23
20
of node: AttributeSyntax ,
24
- providingPeersOf declaration: Declaration ,
25
- in context: Context
21
+ providingPeersOf declaration: some DeclSyntaxProtocol ,
22
+ in context: some MacroExpansionContext
26
23
) throws -> [ DeclSyntax ]
27
24
}
You can’t perform that action at this time.
0 commit comments