Skip to content

[Macros] Adapt to rename of ExpressionMacro.expansion(of:in:). #62398

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 5, 2022
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
2 changes: 1 addition & 1 deletion lib/ASTGen/Sources/ASTGen/Macros.swift
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ func evaluateMacro(
return ExprSyntax(parentExpansion)
}

return exprMacro.expand(parentExpansion, in: &context)
return exprMacro.expansion(of: parentExpansion, in: &context)
}

// FIXME: Emit diagnostics accumulated in the
Expand Down
12 changes: 6 additions & 6 deletions test/Macros/Inputs/syntax_macro_definitions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ private func replaceFirstLabel(
}

public struct ColorLiteralMacro: ExpressionMacro {
public static func expand(
_ macro: MacroExpansionExprSyntax, in context: inout MacroExpansionContext
public static func expansion(
of macro: MacroExpansionExprSyntax, in context: inout MacroExpansionContext
) -> ExprSyntax {
let argList = replaceFirstLabel(
of: macro.argumentList, with: "_colorLiteralRed"
Expand All @@ -31,8 +31,8 @@ public struct ColorLiteralMacro: ExpressionMacro {
}

public struct FileIDMacro: ExpressionMacro {
public static func expand(
_ macro: MacroExpansionExprSyntax, in context: inout MacroExpansionContext
public static func expansion(
of macro: MacroExpansionExprSyntax, in context: inout MacroExpansionContext
) -> ExprSyntax {
let fileLiteral: ExprSyntax = #""\#(context.moduleName)/\#(context.fileName)""#
if let leadingTrivia = macro.leadingTrivia {
Expand All @@ -43,8 +43,8 @@ public struct FileIDMacro: ExpressionMacro {
}

public struct StringifyMacro: ExpressionMacro {
public static func expand(
_ macro: MacroExpansionExprSyntax, in context: inout MacroExpansionContext
public static func expansion(
of macro: MacroExpansionExprSyntax, in context: inout MacroExpansionContext
) -> ExprSyntax {
guard let argument = macro.argumentList.first?.expression else {
// FIXME: Create a diagnostic for the missing argument?
Expand Down