Skip to content

Commit 976060e

Browse files
authored
Merge pull request swiftlang#63220 from AtariDreams/deprecations
Fix DeclarationMacro deprecations
2 parents 8a18fc0 + 0a380cb commit 976060e

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
@@ -206,7 +206,7 @@ func evaluateMacro(
206206
evaluatedSyntax = Syntax(try exprMacro.expansion(of: parentExpansion, in: &context))
207207

208208
// Handle expression macro. The resulting decls are wrapped in a `CodeBlockItemListSyntax`.
209-
case let declMacro as FreestandingDeclarationMacro.Type:
209+
case let declMacro as DeclarationMacro.Type:
210210
guard let parentExpansion = parentSyntax.as(MacroExpansionDeclSyntax.self) else {
211211
print("not on a macro expansion node: \(token.recursiveDescription)")
212212
return -1
@@ -350,7 +350,7 @@ func expandAttachedMacro(
350350
var evaluatedSyntaxStr: String
351351
do {
352352
switch (macro, macroRole) {
353-
case (let attachedMacro as AccessorDeclarationMacro.Type, .Accessor):
353+
case (let attachedMacro as AccessorMacro.Type, .Accessor):
354354
let accessors = try attachedMacro.expansion(
355355
of: customAttrNode, attachedTo: declarationNode, in: &context
356356
)
@@ -383,7 +383,7 @@ func expandAttachedMacro(
383383
$0.trimmedDescription
384384
}.joined(separator: " ")
385385

386-
case (let attachedMacro as MemberDeclarationMacro.Type, .SynthesizedMembers):
386+
case (let attachedMacro as MemberMacro.Type, .SynthesizedMembers):
387387
let members = try attachedMacro.expansion(
388388
of: customAttrNode,
389389
attachedTo: declarationNode,

test/Macros/Inputs/syntax_macro_definitions.swift

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

197-
public struct DefineBitwidthNumberedStructsMacro: FreestandingDeclarationMacro {
197+
public struct DefineBitwidthNumberedStructsMacro: DeclarationMacro {
198198
public static func expansion(
199199
of node: MacroExpansionDeclSyntax,
200200
in context: inout MacroExpansionContext
@@ -217,7 +217,7 @@ public struct DefineBitwidthNumberedStructsMacro: FreestandingDeclarationMacro {
217217

218218
public struct PropertyWrapperMacro {}
219219

220-
extension PropertyWrapperMacro: AccessorDeclarationMacro, Macro {
220+
extension PropertyWrapperMacro: AccessorMacro, Macro {
221221
public static func expansion(
222222
of node: AttributeSyntax,
223223
attachedTo declaration: DeclSyntax,
@@ -307,7 +307,7 @@ extension TypeWrapperMacro: MemberAttributeMacro {
307307
}
308308
}
309309

310-
extension TypeWrapperMacro: MemberDeclarationMacro {
310+
extension TypeWrapperMacro: MemberMacro {
311311
public static func expansion(
312312
of node: AttributeSyntax,
313313
attachedTo decl: DeclSyntax,
@@ -324,7 +324,7 @@ extension TypeWrapperMacro: MemberDeclarationMacro {
324324
}
325325
}
326326

327-
public struct AccessViaStorageMacro: AccessorDeclarationMacro {
327+
public struct AccessViaStorageMacro: AccessorMacro {
328328
public static func expansion(
329329
of node: AttributeSyntax,
330330
attachedTo declaration: DeclSyntax,
@@ -349,7 +349,7 @@ public struct AccessViaStorageMacro: AccessorDeclarationMacro {
349349
}
350350
}
351351

352-
public struct AddMembers: MemberDeclarationMacro {
352+
public struct AddMembers: MemberMacro {
353353
public static func expansion(
354354
of node: AttributeSyntax,
355355
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)