Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions lib/ASTGen/Sources/ASTGen/Macros.swift
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ func evaluateMacro(
evaluatedSyntax = Syntax(try exprMacro.expansion(of: parentExpansion, in: &context))

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

case (let attachedMacro as MemberDeclarationMacro.Type, .SynthesizedMembers):
case (let attachedMacro as MemberMacro.Type, .SynthesizedMembers):
let members = try attachedMacro.expansion(
of: customAttrNode,
attachedTo: declarationNode,
Expand Down
10 changes: 5 additions & 5 deletions test/Macros/Inputs/syntax_macro_definitions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ enum CustomError: Error, CustomStringConvertible {
}
}

public struct DefineBitwidthNumberedStructsMacro: FreestandingDeclarationMacro {
public struct DefineBitwidthNumberedStructsMacro: DeclarationMacro {
public static func expansion(
of node: MacroExpansionDeclSyntax,
in context: inout MacroExpansionContext
Expand All @@ -215,7 +215,7 @@ public struct DefineBitwidthNumberedStructsMacro: FreestandingDeclarationMacro {

public struct PropertyWrapperMacro {}

extension PropertyWrapperMacro: AccessorDeclarationMacro, Macro {
extension PropertyWrapperMacro: AccessorMacro, Macro {
public static func expansion(
of node: AttributeSyntax,
attachedTo declaration: DeclSyntax,
Expand Down Expand Up @@ -305,7 +305,7 @@ extension TypeWrapperMacro: MemberAttributeMacro {
}
}

extension TypeWrapperMacro: MemberDeclarationMacro {
extension TypeWrapperMacro: MemberMacro {
public static func expansion(
of node: AttributeSyntax,
attachedTo decl: DeclSyntax,
Expand All @@ -322,7 +322,7 @@ extension TypeWrapperMacro: MemberDeclarationMacro {
}
}

public struct AccessViaStorageMacro: AccessorDeclarationMacro {
public struct AccessViaStorageMacro: AccessorMacro {
public static func expansion(
of node: AttributeSyntax,
attachedTo declaration: DeclSyntax,
Expand All @@ -347,7 +347,7 @@ public struct AccessViaStorageMacro: AccessorDeclarationMacro {
}
}

public struct AddMembers: MemberDeclarationMacro {
public struct AddMembers: MemberMacro {
public static func expansion(
of node: AttributeSyntax,
attachedTo decl: DeclSyntax,
Expand Down
2 changes: 1 addition & 1 deletion test/Serialization/Inputs/def_macro_plugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public struct StringifyMacro: ExpressionMacro {
}
}

public struct MyWrapperMacro: AccessorDeclarationMacro {
public struct MyWrapperMacro: AccessorMacro {
public static func expansion(
of node: AttributeSyntax,
attachedTo declaration: DeclSyntax,
Expand Down