@@ -11,7 +11,7 @@ enum OptionSetMacroDiagnostic {
1111}
1212
1313extension OptionSetMacroDiagnostic : DiagnosticMessage {
14- func diagnose( at node: some SyntaxProtocol ) -> Diagnostic {
14+ func diagnose< Node : SyntaxProtocol > ( at node: Node ) -> Diagnostic {
1515 Diagnostic ( node: Syntax ( node) , message: self )
1616 }
1717
@@ -65,10 +65,13 @@ public struct OptionSetMacro {
6565 ///
6666 /// - Returns: the important arguments used by the various roles of this
6767 /// macro inhabits, or nil if an error occurred.
68- static func decodeExpansion(
68+ static func decodeExpansion<
69+ Decl: DeclGroupSyntax ,
70+ Context: MacroExpansionContext
71+ > (
6972 of attribute: AttributeSyntax ,
70- attachedTo decl: some DeclGroupSyntax ,
71- in context: some MacroExpansionContext
73+ attachedTo decl: Decl ,
74+ in context: Context
7275 ) -> ( StructDeclSyntax , EnumDeclSyntax , TypeSyntax ) ? {
7376 // Determine the name of the options enum.
7477 let optionsEnumName : String
@@ -119,10 +122,13 @@ public struct OptionSetMacro {
119122}
120123
121124extension OptionSetMacro : ConformanceMacro {
122- public static func expansion(
125+ public static func expansion<
126+ Decl: DeclGroupSyntax ,
127+ Context: MacroExpansionContext
128+ > (
123129 of attribute: AttributeSyntax ,
124- providingConformancesOf decl: some DeclGroupSyntax ,
125- in context: some MacroExpansionContext
130+ providingConformancesOf decl: Decl ,
131+ in context: Context
126132 ) throws -> [ ( TypeSyntax , GenericWhereClauseSyntax ? ) ] {
127133 // Decode the expansion arguments.
128134 guard let ( structDecl, _, _) = decodeExpansion ( of: attribute, attachedTo: decl, in: context) else {
@@ -140,10 +146,13 @@ extension OptionSetMacro: ConformanceMacro {
140146}
141147
142148extension OptionSetMacro : MemberMacro {
143- public static func expansion(
149+ public static func expansion<
150+ Decl: DeclGroupSyntax ,
151+ Context: MacroExpansionContext
152+ > (
144153 of attribute: AttributeSyntax ,
145- providingMembersOf decl: some DeclGroupSyntax ,
146- in context: some MacroExpansionContext
154+ providingMembersOf decl: Decl ,
155+ in context: Context
147156 ) throws -> [ DeclSyntax ] {
148157 // Decode the expansion arguments.
149158 guard let ( _, optionsEnum, rawType) = decodeExpansion ( of: attribute, attachedTo: decl, in: context) else {
@@ -190,7 +199,7 @@ extension DeclModifierSyntax {
190199extension SyntaxStringInterpolation {
191200 // It would be nice for SwiftSyntaxBuilder to provide this out-of-the-box.
192201 mutating func appendInterpolation< Node: SyntaxProtocol > ( _ node: Node ? ) {
193- if let node {
202+ if let node = node {
194203 appendInterpolation ( node)
195204 }
196205 }
0 commit comments