Skip to content

Commit 594257f

Browse files
Merge pull request #63637 from apple/QuietMisdreavus/attr-token-kind
don't split attribute fragments with a separate typeIdentifier fragment rdar://104930571
2 parents c82e17a + aafa418 commit 594257f

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

lib/SymbolGraphGen/DeclarationFragmentPrinter.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,13 @@ void DeclarationFragmentPrinter::printStructurePre(PrintStructureKind Kind,
136136
void DeclarationFragmentPrinter::printTypeRef(Type T, const TypeDecl *RefTo,
137137
Identifier Name,
138138
PrintNameContext NameContext) {
139-
openFragment(FragmentKind::TypeIdentifier);
139+
if (Kind != FragmentKind::Attribute) {
140+
openFragment(FragmentKind::TypeIdentifier);
141+
} else {
142+
// create a separate fragment so that only the attribute name is linkable
143+
closeFragment();
144+
openFragment(FragmentKind::Attribute);
145+
}
140146
printText(Name.str());
141147
USR.clear();
142148

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public func wrapped(@SomeWrapper arg: Int) {}
3535
// CHECK-NEXT: "spelling": "@"
3636
// CHECK-NEXT: },
3737
// CHECK-NEXT: {
38-
// CHECK-NEXT: "kind": "typeIdentifier",
38+
// CHECK-NEXT: "kind": "attribute",
3939
// CHECK-NEXT: "spelling": "SomeWrapper",
4040
// CHECK-NEXT: "preciseIdentifier": "s:10CustomAttr11SomeWrapperV"
4141
// CHECK-NEXT: },

0 commit comments

Comments
 (0)