Skip to content

Commit d620dfa

Browse files
committed
Sourcekit/DocSupport: include fully annotated generic signatures for extension decls. rdar://40906297
1 parent d8f12cb commit d620dfa

File tree

11 files changed

+50
-4
lines changed

11 files changed

+50
-4
lines changed

include/swift/AST/GenericSignature.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,7 @@ class alignas(1 << TypeAlignInBits) GenericSignature final
313313
ArrayRef<Requirement> requirements);
314314

315315
void print(raw_ostream &OS, PrintOptions Options = PrintOptions()) const;
316+
void print(ASTPrinter &Printer, PrintOptions Opts = PrintOptions()) const;
316317
void dump() const;
317318
std::string getAsString() const;
318319
};

lib/AST/ASTPrinter.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4160,11 +4160,15 @@ void LayoutConstraintInfo::print(ASTPrinter &Printer,
41604160

41614161
void GenericSignature::print(raw_ostream &OS, PrintOptions Opts) const {
41624162
StreamPrinter Printer(OS);
4163-
PrintAST(Printer, Opts)
4164-
.printGenericSignature(this,
4165-
PrintAST::PrintParams |
4166-
PrintAST::PrintRequirements);
4163+
print(Printer, Opts);
4164+
}
4165+
4166+
void GenericSignature::print(ASTPrinter &Printer, PrintOptions Opts) const {
4167+
PrintAST(Printer, Opts).printGenericSignature(this,
4168+
PrintAST::PrintParams |
4169+
PrintAST::PrintRequirements);
41674170
}
4171+
41684172
void GenericSignature::dump() const {
41694173
print(llvm::errs());
41704174
llvm::errs() << '\n';

test/SourceKit/DocSupport/doc_clang_module.swift.response

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5276,6 +5276,7 @@ var FooSubUnnamedEnumeratorA1: Int { get }
52765276
key.doc.full_as_xml: "<Other><Name></Name><Declaration>extension FooRuncingOptions</Declaration><CommentParts><Abstract><Para><codeVoice>SetAlgebra</codeVoice> requirements for which default implementations are supplied.</Para></Abstract><Discussion><Note><Para>A type conforming to <codeVoice>SetAlgebra</codeVoice> can implement any of these initializers or methods, and those implementations will be used in lieu of these defaults.</Para></Note></Discussion></CommentParts></Other>",
52775277
key.offset: 1445,
52785278
key.length: 683,
5279+
key.fully_annotated_generic_signature: "&lt;<decl.generic_type_param usr=\"s:s10SetAlgebraP4Selfxmfp\"><decl.generic_type_param.name>Self</decl.generic_type_param.name></decl.generic_type_param> <syntaxtype.keyword>where</syntaxtype.keyword> <decl.generic_type_requirement><ref.generic_type_param usr=\"s:s10SetAlgebraP4Selfxmfp\">Self</ref.generic_type_param> : <ref.protocol usr=\"s:s10SetAlgebraP\">SetAlgebra</ref.protocol></decl.generic_type_requirement>&gt;",
52795280
key.extends: {
52805281
key.kind: source.lang.swift.ref.struct,
52815282
key.name: "FooRuncingOptions",
@@ -5464,6 +5465,7 @@ var FooSubUnnamedEnumeratorA1: Int { get }
54645465
key.doc.full_as_xml: "<Other><Name></Name><Declaration>extension FooRuncingOptions</Declaration><CommentParts><Abstract><Para><codeVoice>OptionSet</codeVoice> requirements for which default implementations are supplied.</Para></Abstract><Discussion><Note><Para>A type conforming to <codeVoice>OptionSet</codeVoice> can implement any of these initializers or methods, and those implementations will be used in lieu of these defaults.</Para></Note></Discussion></CommentParts></Other>",
54655466
key.offset: 2130,
54665467
key.length: 280,
5468+
key.fully_annotated_generic_signature: "&lt;<decl.generic_type_param usr=\"s:s9OptionSetP4Selfxmfp\"><decl.generic_type_param.name>Self</decl.generic_type_param.name></decl.generic_type_param> <syntaxtype.keyword>where</syntaxtype.keyword> <decl.generic_type_requirement><ref.generic_type_param usr=\"s:s9OptionSetP4Selfxmfp\">Self</ref.generic_type_param> : <ref.protocol usr=\"s:s9OptionSetP\">OptionSet</ref.protocol></decl.generic_type_requirement>&gt;",
54675469
key.extends: {
54685470
key.kind: source.lang.swift.ref.struct,
54695471
key.name: "FooRuncingOptions",
@@ -5539,6 +5541,7 @@ var FooSubUnnamedEnumeratorA1: Int { get }
55395541
key.doc.full_as_xml: "<Other><Name></Name><Declaration>extension FooRuncingOptions where Self == Self.Element</Declaration><CommentParts><Abstract><Para><codeVoice>OptionSet</codeVoice> requirements for which default implementations are supplied when <codeVoice>Element == Self</codeVoice>, which is the default.</Para></Abstract><Discussion><Note><Para>A type conforming to <codeVoice>OptionSet</codeVoice> can implement any of these initializers or methods, and those implementations will be used in lieu of these defaults.</Para></Note></Discussion></CommentParts></Other>",
55405542
key.offset: 2412,
55415543
key.length: 407,
5544+
key.fully_annotated_generic_signature: "&lt;<decl.generic_type_param usr=\"s:s9OptionSetPs7ElementQzRszrlE4Selfxmfp\"><decl.generic_type_param.name>Self</decl.generic_type_param.name></decl.generic_type_param> <syntaxtype.keyword>where</syntaxtype.keyword> <decl.generic_type_requirement><ref.generic_type_param usr=\"s:s9OptionSetPs7ElementQzRszrlE4Selfxmfp\">Self</ref.generic_type_param> : <ref.protocol usr=\"s:s9OptionSetP\">OptionSet</ref.protocol></decl.generic_type_requirement>, <decl.generic_type_requirement><ref.generic_type_param usr=\"s:s9OptionSetPs7ElementQzRszrlE4Selfxmfp\">Self</ref.generic_type_param> == <ref.generic_type_param usr=\"s:s9OptionSetPs7ElementQzRszrlE4Selfxmfp\">Self</ref.generic_type_param>.Element</decl.generic_type_requirement>&gt;",
55425545
key.extends: {
55435546
key.kind: source.lang.swift.ref.struct,
55445547
key.name: "FooRuncingOptions",
@@ -5633,6 +5636,7 @@ var FooSubUnnamedEnumeratorA1: Int { get }
56335636
key.doc.full_as_xml: "<Other><Name></Name><Declaration>extension FooRuncingOptions where Self.RawValue : FixedWidthInteger</Declaration><CommentParts><Abstract><Para><codeVoice>OptionSet</codeVoice> requirements for which default implementations are supplied when <codeVoice>RawValue</codeVoice> conforms to <codeVoice>FixedWidthInteger</codeVoice>, which is the usual case. Each distinct bit of an option set’s <codeVoice>.rawValue</codeVoice> corresponds to a disjoint value of the <codeVoice>OptionSet</codeVoice>.</Para></Abstract><Discussion><Note><Para>A type conforming to <codeVoice>OptionSet</codeVoice> can implement any of these initializers or methods, and those implementations will be used in lieu of these defaults.</Para></Note><List-Bullet><Item><Para><codeVoice>union</codeVoice> is implemented as a bitwise “or” (<codeVoice>|</codeVoice>) of <codeVoice>rawValue</codeVoice>s</Para></Item><Item><Para><codeVoice>intersection</codeVoice> is implemented as a bitwise “and” (<codeVoice>&amp;</codeVoice>) of <codeVoice>rawValue</codeVoice>s</Para></Item><Item><Para><codeVoice>symmetricDifference</codeVoice> is implemented as a bitwise “exclusive or” (<codeVoice>^</codeVoice>) of <codeVoice>rawValue</codeVoice>s</Para></Item></List-Bullet></Discussion></CommentParts></Other>",
56345637
key.offset: 2821,
56355638
key.length: 279,
5639+
key.fully_annotated_generic_signature: "&lt;<decl.generic_type_param usr=\"s:s9OptionSetPss17FixedWidthInteger8RawValueRpzrlE4Selfxmfp\"><decl.generic_type_param.name>Self</decl.generic_type_param.name></decl.generic_type_param> <syntaxtype.keyword>where</syntaxtype.keyword> <decl.generic_type_requirement><ref.generic_type_param usr=\"s:s9OptionSetPss17FixedWidthInteger8RawValueRpzrlE4Selfxmfp\">Self</ref.generic_type_param> : <ref.protocol usr=\"s:s9OptionSetP\">OptionSet</ref.protocol></decl.generic_type_requirement>, <decl.generic_type_requirement><ref.generic_type_param usr=\"s:s9OptionSetPss17FixedWidthInteger8RawValueRpzrlE4Selfxmfp\">Self</ref.generic_type_param>.RawValue : <ref.protocol usr=\"s:s17FixedWidthIntegerP\">FixedWidthInteger</ref.protocol></decl.generic_type_requirement>&gt;",
56365640
key.extends: {
56375641
key.kind: source.lang.swift.ref.struct,
56385642
key.name: "FooRuncingOptions",

test/SourceKit/DocSupport/doc_swift_module.swift.response

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1874,6 +1874,7 @@ func genfoo<T1, T2>(x ix: T1, y iy: T2) where T1 : Prot, T2 : cake.C1, T1.Elemen
18741874
],
18751875
key.offset: 427,
18761876
key.length: 187,
1877+
key.fully_annotated_generic_signature: "&lt;<decl.generic_type_param usr=\"s:SYsSHRzSH8RawValueSYRpzrlE4Selfxmfp\"><decl.generic_type_param.name>Self</decl.generic_type_param.name></decl.generic_type_param> <syntaxtype.keyword>where</syntaxtype.keyword> <decl.generic_type_requirement><ref.generic_type_param usr=\"s:SYsSHRzSH8RawValueSYRpzrlE4Selfxmfp\">Self</ref.generic_type_param> : <ref.protocol usr=\"s:SH\">Hashable</ref.protocol></decl.generic_type_requirement>, <decl.generic_type_requirement><ref.generic_type_param usr=\"s:SYsSHRzSH8RawValueSYRpzrlE4Selfxmfp\">Self</ref.generic_type_param> : <ref.protocol usr=\"s:SY\">RawRepresentable</ref.protocol></decl.generic_type_requirement>, <decl.generic_type_requirement><ref.generic_type_param usr=\"s:SYsSHRzSH8RawValueSYRpzrlE4Selfxmfp\">Self</ref.generic_type_param>.RawValue : <ref.protocol usr=\"s:SH\">Hashable</ref.protocol></decl.generic_type_requirement>&gt;",
18771878
key.extends: {
18781879
key.kind: source.lang.swift.ref.enum,
18791880
key.name: "C1Cases",
@@ -2236,6 +2237,7 @@ func genfoo<T1, T2>(x ix: T1, y iy: T2) where T1 : Prot, T2 : cake.C1, T1.Elemen
22362237
key.kind: source.lang.swift.decl.extension.protocol,
22372238
key.offset: 1258,
22382239
key.length: 53,
2240+
key.fully_annotated_generic_signature: "&lt;<decl.generic_type_param usr=\"s:4cake2P6P4Selfxmfp\"><decl.generic_type_param.name>Self</decl.generic_type_param.name></decl.generic_type_param> <syntaxtype.keyword>where</syntaxtype.keyword> <decl.generic_type_requirement><ref.generic_type_param usr=\"s:4cake2P6P4Selfxmfp\">Self</ref.generic_type_param> : <ref.protocol usr=\"s:4cake2P6P\">P6</ref.protocol></decl.generic_type_requirement>&gt;",
22392241
key.extends: {
22402242
key.kind: source.lang.swift.ref.protocol,
22412243
key.name: "P6",
@@ -2298,6 +2300,7 @@ func genfoo<T1, T2>(x ix: T1, y iy: T2) where T1 : Prot, T2 : cake.C1, T1.Elemen
22982300
key.kind: source.lang.swift.decl.extension.protocol,
22992301
key.offset: 1417,
23002302
key.length: 79,
2303+
key.fully_annotated_generic_signature: "&lt;<decl.generic_type_param usr=\"s:4cake4ProtP4Selfxmfp\"><decl.generic_type_param.name>Self</decl.generic_type_param.name></decl.generic_type_param> <syntaxtype.keyword>where</syntaxtype.keyword> <decl.generic_type_requirement><ref.generic_type_param usr=\"s:4cake4ProtP4Selfxmfp\">Self</ref.generic_type_param> : <ref.protocol usr=\"s:4cake4ProtP\">Prot</ref.protocol></decl.generic_type_requirement>&gt;",
23012304
key.extends: {
23022305
key.kind: source.lang.swift.ref.protocol,
23032306
key.name: "Prot",
@@ -2341,6 +2344,7 @@ func genfoo<T1, T2>(x ix: T1, y iy: T2) where T1 : Prot, T2 : cake.C1, T1.Elemen
23412344
],
23422345
key.offset: 1498,
23432346
key.length: 63,
2347+
key.fully_annotated_generic_signature: "&lt;<decl.generic_type_param usr=\"s:4cake4ProtPAASi7ElementRtzrlE4Selfxmfp\"><decl.generic_type_param.name>Self</decl.generic_type_param.name></decl.generic_type_param> <syntaxtype.keyword>where</syntaxtype.keyword> <decl.generic_type_requirement><ref.generic_type_param usr=\"s:4cake4ProtPAASi7ElementRtzrlE4Selfxmfp\">Self</ref.generic_type_param> : <ref.protocol usr=\"s:4cake4ProtP\">Prot</ref.protocol></decl.generic_type_requirement>, <decl.generic_type_requirement><ref.generic_type_param usr=\"s:4cake4ProtPAASi7ElementRtzrlE4Selfxmfp\">Self</ref.generic_type_param>.Element == <ref.struct usr=\"s:Si\">Int</ref.struct></decl.generic_type_requirement>&gt;",
23442348
key.extends: {
23452349
key.kind: source.lang.swift.ref.protocol,
23462350
key.name: "Prot",
@@ -2431,6 +2435,7 @@ func genfoo<T1, T2>(x ix: T1, y iy: T2) where T1 : Prot, T2 : cake.C1, T1.Elemen
24312435
key.kind: source.lang.swift.decl.extension.enum,
24322436
key.offset: 1707,
24332437
key.length: 76,
2438+
key.fully_annotated_generic_signature: "&lt;<decl.generic_type_param usr=\"s:SQ4Selfxmfp\"><decl.generic_type_param.name>Self</decl.generic_type_param.name></decl.generic_type_param> <syntaxtype.keyword>where</syntaxtype.keyword> <decl.generic_type_requirement><ref.generic_type_param usr=\"s:SQ4Selfxmfp\">Self</ref.generic_type_param> : <ref.protocol usr=\"s:SQ\">Equatable</ref.protocol></decl.generic_type_requirement>&gt;",
24342439
key.extends: {
24352440
key.kind: source.lang.swift.ref.enum,
24362441
key.name: "SE",
@@ -2542,6 +2547,7 @@ func genfoo<T1, T2>(x ix: T1, y iy: T2) where T1 : Prot, T2 : cake.C1, T1.Elemen
25422547
key.kind: source.lang.swift.decl.extension.struct,
25432548
key.offset: 1921,
25442549
key.length: 56,
2550+
key.fully_annotated_generic_signature: "&lt;<decl.generic_type_param usr=\"s:4cake2P6P4Selfxmfp\"><decl.generic_type_param.name>Self</decl.generic_type_param.name></decl.generic_type_param> <syntaxtype.keyword>where</syntaxtype.keyword> <decl.generic_type_requirement><ref.generic_type_param usr=\"s:4cake2P6P4Selfxmfp\">Self</ref.generic_type_param> : <ref.protocol usr=\"s:4cake2P6P\">P6</ref.protocol></decl.generic_type_requirement>&gt;",
25452551
key.extends: {
25462552
key.kind: source.lang.swift.ref.struct,
25472553
key.name: "S3",

test/SourceKit/DocSupport/doc_swift_module1.swift.response

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -742,6 +742,7 @@ extension Dictionary.Keys where Key : P1 {
742742
key.kind: source.lang.swift.decl.extension.protocol,
743743
key.offset: 160,
744744
key.length: 35,
745+
key.fully_annotated_generic_signature: "&lt;<decl.generic_type_param usr=\"s:5cake19InitProtoP4Selfxmfp\"><decl.generic_type_param.name>Self</decl.generic_type_param.name></decl.generic_type_param> <syntaxtype.keyword>where</syntaxtype.keyword> <decl.generic_type_requirement><ref.generic_type_param usr=\"s:5cake19InitProtoP4Selfxmfp\">Self</ref.generic_type_param> : <ref.protocol usr=\"s:5cake19InitProtoP\">InitProto</ref.protocol></decl.generic_type_requirement>&gt;",
745746
key.extends: {
746747
key.kind: source.lang.swift.ref.protocol,
747748
key.name: "InitProto",
@@ -920,6 +921,7 @@ extension Dictionary.Keys where Key : P1 {
920921
key.kind: source.lang.swift.decl.extension.protocol,
921922
key.offset: 493,
922923
key.length: 118,
924+
key.fully_annotated_generic_signature: "&lt;<decl.generic_type_param usr=\"s:5cake12P2P4Selfxmfp\"><decl.generic_type_param.name>Self</decl.generic_type_param.name></decl.generic_type_param> <syntaxtype.keyword>where</syntaxtype.keyword> <decl.generic_type_requirement><ref.generic_type_param usr=\"s:5cake12P2P4Selfxmfp\">Self</ref.generic_type_param> : <ref.protocol usr=\"s:5cake12P2P\">P2</ref.protocol></decl.generic_type_requirement>&gt;",
923925
key.extends: {
924926
key.kind: source.lang.swift.ref.protocol,
925927
key.name: "P2",
@@ -998,6 +1000,7 @@ extension Dictionary.Keys where Key : P1 {
9981000
],
9991001
key.offset: 613,
10001002
key.length: 58,
1003+
key.fully_annotated_generic_signature: "&lt;<decl.generic_type_param usr=\"s:5cake12P2PA2A2P3RzrlE4Selfxmfp\"><decl.generic_type_param.name>Self</decl.generic_type_param.name></decl.generic_type_param> <syntaxtype.keyword>where</syntaxtype.keyword> <decl.generic_type_requirement><ref.generic_type_param usr=\"s:5cake12P2PA2A2P3RzrlE4Selfxmfp\">Self</ref.generic_type_param> : <ref.protocol usr=\"s:5cake12P2P\">P2</ref.protocol></decl.generic_type_requirement>, <decl.generic_type_requirement><ref.generic_type_param usr=\"s:5cake12P2PA2A2P3RzrlE4Selfxmfp\">Self</ref.generic_type_param> : <ref.protocol usr=\"s:5cake12P3P\">P3</ref.protocol></decl.generic_type_requirement>&gt;",
10011004
key.extends: {
10021005
key.kind: source.lang.swift.ref.protocol,
10031006
key.name: "P2",
@@ -1050,6 +1053,7 @@ extension Dictionary.Keys where Key : P1 {
10501053
],
10511054
key.offset: 713,
10521055
key.length: 45,
1056+
key.fully_annotated_generic_signature: "&lt;<decl.generic_type_param usr=\"s:SD3Keyxmfp\"><decl.generic_type_param.name>Key</decl.generic_type_param.name></decl.generic_type_param>, <decl.generic_type_param usr=\"s:SD5Valueq_mfp\"><decl.generic_type_param.name>Value</decl.generic_type_param.name></decl.generic_type_param> <syntaxtype.keyword>where</syntaxtype.keyword> <decl.generic_type_requirement>Key : <ref.protocol usr=\"s:SH\">Hashable</ref.protocol></decl.generic_type_requirement>&gt;",
10531057
key.extends: {
10541058
key.kind: source.lang.swift.ref.struct,
10551059
key.name: "Keys",
@@ -1078,6 +1082,7 @@ extension Dictionary.Keys where Key : P1 {
10781082
],
10791083
key.offset: 760,
10801084
key.length: 60,
1085+
key.fully_annotated_generic_signature: "&lt;<decl.generic_type_param usr=\"s:SD4KeysV5cake1AC2P1RzrlE3Keyxmfp\"><decl.generic_type_param.name>Key</decl.generic_type_param.name></decl.generic_type_param>, <decl.generic_type_param usr=\"s:SD4KeysV5cake1AC2P1RzrlE5Valueq_mfp\"><decl.generic_type_param.name>Value</decl.generic_type_param.name></decl.generic_type_param> <syntaxtype.keyword>where</syntaxtype.keyword> <decl.generic_type_requirement>Key : <ref.protocol usr=\"s:SH\">Hashable</ref.protocol></decl.generic_type_requirement>, <decl.generic_type_requirement>Key : <ref.protocol usr=\"s:5cake12P1P\">P1</ref.protocol></decl.generic_type_requirement>&gt;",
10811086
key.extends: {
10821087
key.kind: source.lang.swift.ref.struct,
10831088
key.name: "Keys",

tools/SourceKit/include/SourceKit/Core/LangSupport.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,7 @@ struct DocEntityInfo {
398398
llvm::SmallString<64> ProvideImplementationOfUSR;
399399
llvm::SmallString<64> DocComment;
400400
llvm::SmallString<64> FullyAnnotatedDecl;
401+
llvm::SmallString<64> FullyAnnotatedGenericSig;
401402
llvm::SmallString<64> LocalizationKey;
402403
std::vector<DocGenericParam> GenericParams;
403404
std::vector<std::string> GenericRequirements;

tools/SourceKit/lib/SwiftLang/SwiftDocSupport.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,14 @@ static bool initDocEntityInfo(const Decl *D,
397397
VD, SynthesizedTarget, OS);
398398
else
399399
SwiftLangSupport::printFullyAnnotatedDeclaration(VD, Type(), OS);
400+
} else if (auto *E = dyn_cast<ExtensionDecl>(D)) {
401+
if (auto *Sig = E->getGenericSignature()) {
402+
// The extension under printing is potentially part of a synthesized
403+
// extension. Thus it's hard to print the fully annotated decl. We
404+
// need to at least print the generic signature here.
405+
llvm::raw_svector_ostream OS(Info.FullyAnnotatedGenericSig);
406+
SwiftLangSupport::printFullyAnnotatedGenericReq(Sig, OS);
407+
}
400408
}
401409
}
402410

tools/SourceKit/lib/SwiftLang/SwiftLangSupport.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ namespace swift {
4141
class SourceFile;
4242
class SILOptions;
4343
class ValueDecl;
44+
class GenericSignature;
4445
enum class AccessorKind;
4546

4647
namespace syntax {
@@ -377,6 +378,9 @@ class SwiftLangSupport : public LangSupport {
377378
swift::TypeOrExtensionDecl Target,
378379
llvm::raw_ostream &OS);
379380

381+
static void
382+
printFullyAnnotatedGenericReq(const swift::GenericSignature *Sig,
383+
llvm::raw_ostream &OS);
380384
/// Tries to resolve the path to the real file-system path. If it fails it
381385
/// returns the original path;
382386
static std::string resolvePathSymlinks(StringRef FilePath);

tools/SourceKit/lib/SwiftLang/SwiftSourceDocInfo.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include "swift/AST/Decl.h"
2121
#include "swift/AST/NameLookup.h"
2222
#include "swift/AST/SwiftNameTranslation.h"
23+
#include "swift/AST/GenericSignature.h"
2324
#include "swift/Basic/SourceManager.h"
2425
#include "swift/Frontend/Frontend.h"
2526
#include "swift/Frontend/PrintingDiagnosticConsumer.h"
@@ -431,6 +432,14 @@ void SwiftLangSupport::printFullyAnnotatedDeclaration(const ValueDecl *VD,
431432
VD->print(Printer, PO);
432433
}
433434

435+
void SwiftLangSupport::printFullyAnnotatedGenericReq(
436+
const swift::GenericSignature *Sig, llvm::raw_ostream &OS) {
437+
assert(Sig);
438+
FullyAnnotatedDeclarationPrinter Printer(OS);
439+
PrintOptions PO = PrintOptions::printQuickHelpDeclaration();
440+
Sig->print(Printer, PO);
441+
}
442+
434443
void SwiftLangSupport::printFullyAnnotatedSynthesizedDeclaration(
435444
const swift::ValueDecl *VD, TypeOrExtensionDecl Target,
436445
llvm::raw_ostream &OS) {

tools/SourceKit/tools/sourcekitd/lib/API/Requests.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1410,6 +1410,8 @@ void SKDocConsumer::addDocEntityInfoToDict(const DocEntityInfo &Info,
14101410
Elem.set(KeyDocFullAsXML, Info.DocComment);
14111411
if (!Info.FullyAnnotatedDecl.empty())
14121412
Elem.set(KeyFullyAnnotatedDecl, Info.FullyAnnotatedDecl);
1413+
if (!Info.FullyAnnotatedGenericSig.empty())
1414+
Elem.set(KeyFullyAnnotatedGenericSignature, Info.FullyAnnotatedGenericSig);
14131415
if (!Info.LocalizationKey.empty())
14141416
Elem.set(KeyLocalizationKey, Info.LocalizationKey);
14151417

utils/gyb_sourcekit_support/UIDs.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ def __init__(self, internal_name, external_name):
5959
KEY('SelectorName', 'key.selector_name'),
6060
KEY('AnnotatedDecl', 'key.annotated_decl'),
6161
KEY('FullyAnnotatedDecl', 'key.fully_annotated_decl'),
62+
KEY('FullyAnnotatedGenericSignature',
63+
'key.fully_annotated_generic_signature'),
6264
KEY('DocBrief', 'key.doc.brief'),
6365
KEY('Context', 'key.context'),
6466
KEY('ModuleImportDepth', 'key.moduleimportdepth'),

0 commit comments

Comments
 (0)