Incorrect indentation added to macro that doesn’t start on a new line
ahoppen opened this issue · 1 comments
ahoppen commented
The following new test case fails.
public struct TestMacro: ExpressionMacro {
public static func expansion(of node: some FreestandingMacroExpansionSyntax, in context: some MacroExpansionContext) throws -> ExprSyntax {
return "1"
}
}
func testMacroAsArgument() {
assertMacroExpansion("""
func test() {
print(#test)
}
""", expandedSource: """
func test() {
print(1)
}
""", macros: ["test": TestMacro.self])
}
Instead, it produces print( 1)
, adding the indentation of the print
line to the macro expansion.
ahoppen commented
Tracked in Apple’s issue tracker as rdar://122346869