Skip to content

Commit 0a380cb

Browse files
committed
Fix DeclarationMacro deprecations
These deprecations are simple renames, but this PR should get rid of the warnings.
1 parent cfa0d63 commit 0a380cb

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

lib/ASTGen/Sources/ASTGen/Macros.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ func evaluateMacro(
177177
evaluatedSyntax = Syntax(try exprMacro.expansion(of: parentExpansion, in: &context))
178178

179179
// Handle expression macro. The resulting decls are wrapped in a `CodeBlockItemListSyntax`.
180-
case let declMacro as FreestandingDeclarationMacro.Type:
180+
case let declMacro as DeclarationMacro.Type:
181181
guard let parentExpansion = parentSyntax.as(MacroExpansionDeclSyntax.self) else {
182182
print("not on a macro expansion node: \(token.recursiveDescription)")
183183
return -1
@@ -321,7 +321,7 @@ func expandAttachedMacro(
321321
var evaluatedSyntaxStr: String
322322
do {
323323
switch (macro, macroRole) {
324-
case (let attachedMacro as AccessorDeclarationMacro.Type, .Accessor):
324+
case (let attachedMacro as AccessorMacro.Type, .Accessor):
325325
let accessors = try attachedMacro.expansion(
326326
of: customAttrNode, attachedTo: declarationNode, in: &context
327327
)
@@ -354,7 +354,7 @@ func expandAttachedMacro(
354354
$0.withoutTrivia().description
355355
}.joined(separator: " ")
356356

357-
case (let attachedMacro as MemberDeclarationMacro.Type, .SynthesizedMembers):
357+
case (let attachedMacro as MemberMacro.Type, .SynthesizedMembers):
358358
let members = try attachedMacro.expansion(
359359
of: customAttrNode,
360360
attachedTo: declarationNode,

test/Macros/Inputs/syntax_macro_definitions.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ enum CustomError: Error, CustomStringConvertible {
192192
}
193193
}
194194

195-
public struct DefineBitwidthNumberedStructsMacro: FreestandingDeclarationMacro {
195+
public struct DefineBitwidthNumberedStructsMacro: DeclarationMacro {
196196
public static func expansion(
197197
of node: MacroExpansionDeclSyntax,
198198
in context: inout MacroExpansionContext
@@ -215,7 +215,7 @@ public struct DefineBitwidthNumberedStructsMacro: FreestandingDeclarationMacro {
215215

216216
public struct PropertyWrapperMacro {}
217217

218-
extension PropertyWrapperMacro: AccessorDeclarationMacro, Macro {
218+
extension PropertyWrapperMacro: AccessorMacro, Macro {
219219
public static func expansion(
220220
of node: AttributeSyntax,
221221
attachedTo declaration: DeclSyntax,
@@ -305,7 +305,7 @@ extension TypeWrapperMacro: MemberAttributeMacro {
305305
}
306306
}
307307

308-
extension TypeWrapperMacro: MemberDeclarationMacro {
308+
extension TypeWrapperMacro: MemberMacro {
309309
public static func expansion(
310310
of node: AttributeSyntax,
311311
attachedTo decl: DeclSyntax,
@@ -322,7 +322,7 @@ extension TypeWrapperMacro: MemberDeclarationMacro {
322322
}
323323
}
324324

325-
public struct AccessViaStorageMacro: AccessorDeclarationMacro {
325+
public struct AccessViaStorageMacro: AccessorMacro {
326326
public static func expansion(
327327
of node: AttributeSyntax,
328328
attachedTo declaration: DeclSyntax,
@@ -347,7 +347,7 @@ public struct AccessViaStorageMacro: AccessorDeclarationMacro {
347347
}
348348
}
349349

350-
public struct AddMembers: MemberDeclarationMacro {
350+
public struct AddMembers: MemberMacro {
351351
public static func expansion(
352352
of node: AttributeSyntax,
353353
attachedTo decl: DeclSyntax,

test/Serialization/Inputs/def_macro_plugin.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public struct StringifyMacro: ExpressionMacro {
1515
}
1616
}
1717

18-
public struct MyWrapperMacro: AccessorDeclarationMacro {
18+
public struct MyWrapperMacro: AccessorMacro {
1919
public static func expansion(
2020
of node: AttributeSyntax,
2121
attachedTo declaration: DeclSyntax,

0 commit comments

Comments
 (0)