Skip to content

Commit 1744b46

Browse files
committed
[AST printer] Stop printing -> () types on all macro declarations.
1 parent 5d54406 commit 1744b46

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

lib/AST/ASTPrinter.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4780,16 +4780,14 @@ void PrintAST::visitMacroDecl(MacroDecl *decl) {
47804780
}
47814781
);
47824782

4783-
{
4783+
if (decl->resultType.getTypeRepr() ||
4784+
!decl->getResultInterfaceType()->isVoid()) {
47844785
Printer.printStructurePre(PrintStructureKind::DeclResultTypeClause);
47854786
SWIFT_DEFER {
47864787
Printer.printStructurePost(PrintStructureKind::DeclResultTypeClause);
47874788
};
47884789

4789-
if (decl->parameterList)
4790-
Printer << " -> ";
4791-
else
4792-
Printer << ": ";
4790+
Printer << " -> ";
47934791

47944792
TypeLoc resultTypeLoc(
47954793
decl->resultType.getTypeRepr(), decl->getResultInterfaceType());

test/ModuleInterface/macros.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,14 @@
3030
@freestanding(expression) public macro publicLine<T: ExpressibleByIntegerLiteral>() -> T = #externalMacro(module: "SomeModule", type: "Line")
3131

3232
// CHECK: #if compiler(>=5.3) && $Macros
33-
// CHECK: @attached(accessor) public macro myWrapper() -> () = #externalMacro(module: "SomeModule", type: "Wrapper")
33+
// CHECK: @attached(accessor) public macro myWrapper() = #externalMacro(module: "SomeModule", type: "Wrapper")
3434
// CHECK-NEXT: #endif
3535
@attached(accessor) public macro myWrapper() = #externalMacro(module: "SomeModule", type: "Wrapper")
3636

3737
// CHECK: #if compiler(>=5.3) && $Macros && $AttachedMacros
38-
// CHECK: @attached(member, names: named(`init`), prefixed(`$`)) public macro MemberwiseInit() -> () = #externalMacro(module: "SomeModule", type: "MemberwiseInitMacro")
38+
// CHECK: @attached(member, names: named(`init`), prefixed(`$`)) public macro MemberwiseInit() = #externalMacro(module: "SomeModule", type: "MemberwiseInitMacro")
3939
// CHECK-NEXT: #endif
40-
@attached(member, names: named(init), prefixed(`$`)) public macro MemberwiseInit() -> () = #externalMacro(module: "SomeModule", type: "MemberwiseInitMacro")
40+
@attached(member, names: named(init), prefixed(`$`)) public macro MemberwiseInit() = #externalMacro(module: "SomeModule", type: "MemberwiseInitMacro")
4141

4242
// CHECK-NOT: internalStringify
4343
@freestanding(expression) macro internalStringify<T>(_ value: T) -> (T, String) = #externalMacro(module: "SomeModule", type: "StringifyMacro")

0 commit comments

Comments
 (0)