Skip to content

Commit e302d73

Browse files
committed
[AST] ASTPrinter: Make sure that attributes are printed as attributes and specifiers as keywords
1 parent ee38182 commit e302d73

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
@@ -3890,7 +3890,7 @@ static void printParameterFlags(ASTPrinter &printer,
38903890

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

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

39203920
if (flags.isConstValue())
3921-
printer.printKeyword("@const", options, " ");
3921+
printer.printAttrName("@const ");
39223922
}
39233923

39243924
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
@@ -41,12 +41,12 @@ public func foo<S>(f: @escaping () -> (), ext int: Int = 2, s: S) where S: Seque
4141
// FOO-NEXT: "spelling": ": "
4242
// FOO-NEXT: },
4343
// FOO-NEXT: {
44-
// FOO-NEXT: "kind": "keyword",
45-
// FOO-NEXT: "spelling": "@escaping"
44+
// FOO-NEXT: "kind": "attribute",
45+
// FOO-NEXT: "spelling": "@escaping "
4646
// FOO-NEXT: },
4747
// FOO-NEXT: {
4848
// FOO-NEXT: "kind": "text",
49-
// FOO-NEXT: "spelling": " () -> (), "
49+
// FOO-NEXT: "spelling": "() -> (), "
5050
// FOO-NEXT: },
5151
// FOO-NEXT: {
5252
// FOO-NEXT: "kind": "externalParam",

0 commit comments

Comments
 (0)