Skip to content

Commit 3bb3a07

Browse files
committed
[AST] ASTPrinter: Make sure that attributes are printed as attributes and specifiers as keywords
(cherry picked from commit e302d73)
1 parent 24d168b commit 3bb3a07

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

lib/AST/ASTPrinter.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3889,7 +3889,7 @@ static void printParameterFlags(ASTPrinter &printer,
38893889

38903890
if (flags.isSending()) {
38913891
if (!options.SuppressSendingArgsAndResults) {
3892-
printer.printAttrName("sending ");
3892+
printer.printKeyword("sending", options, " ");
38933893
} else if (flags.getOwnershipSpecifier() ==
38943894
ParamSpecifier::ImplicitlyCopyableConsuming) {
38953895
// Ok. We are suppressing sending. If our ownership specifier was
@@ -3910,14 +3910,14 @@ static void printParameterFlags(ASTPrinter &printer,
39103910
// `inout` implies `@escaping`
39113911
if (flags.getOwnershipSpecifier() != ParamSpecifier::InOut) {
39123912
if (!options.excludeAttrKind(TypeAttrKind::Escaping) && escaping)
3913-
printer.printKeyword("@escaping", options, " ");
3913+
printer.printAttrName("@escaping ");
39143914
}
39153915

39163916
if (flags.isCompileTimeLiteral())
39173917
printer.printKeyword("_const", options, " ");
39183918

39193919
if (flags.isConstValue())
3920-
printer.printKeyword("@const", options, " ");
3920+
printer.printAttrName("@const ");
39213921
}
39223922

39233923
void PrintAST::visitVarDecl(VarDecl *decl) {

test/SymbolGraph/Symbols/Mixins/DeclarationFragments/Full/Function.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,12 @@ public func foo<S>(f: @escaping () -> (), ext int: Int = 2, s: S) where S: Seque
3939
// CHECK-NEXT: "spelling": ": "
4040
// CHECK-NEXT: },
4141
// CHECK-NEXT: {
42-
// CHECK-NEXT: "kind": "keyword",
43-
// CHECK-NEXT: "spelling": "@escaping"
42+
// CHECK-NEXT: "kind": "attribute",
43+
// CHECK-NEXT: "spelling": "@escaping "
4444
// CHECK-NEXT: },
4545
// CHECK-NEXT: {
4646
// CHECK-NEXT: "kind": "text",
47-
// CHECK-NEXT: "spelling": " () -> (), "
47+
// CHECK-NEXT: "spelling": "() -> (), "
4848
// CHECK-NEXT: },
4949
// CHECK-NEXT: {
5050
// CHECK-NEXT: "kind": "externalParam",

0 commit comments

Comments
 (0)