Skip to content

Commit fb99cfc

Browse files
authored
Merge pull request #32189 from bitjammer/acgarland/rdar-63033669-sgf-full-decl-no-inherited
[SymbolGraph] Don't print inherited list in declaration fragments
2 parents 5083f83 + a722311 commit fb99cfc

File tree

4 files changed

+10
-1
lines changed

4 files changed

+10
-1
lines changed

include/swift/AST/PrintOptions.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -450,6 +450,9 @@ struct PrintOptions {
450450
/// Whether to print parameter specifiers as 'let' and 'var'.
451451
bool PrintParameterSpecifiers = false;
452452

453+
/// Whether to print inheritance lists for types.
454+
bool PrintInherited = true;
455+
453456
/// \see ShouldQualifyNestedDeclarations
454457
enum class QualifyNestedDeclarations {
455458
Never,

lib/AST/ASTPrinter.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2073,6 +2073,9 @@ void PrintAST::printDeclGenericRequirements(GenericContext *decl) {
20732073
}
20742074

20752075
void PrintAST::printInherited(const Decl *decl) {
2076+
if (!Options.PrintInherited) {
2077+
return;
2078+
}
20762079
SmallVector<TypeLoc, 6> TypesToPrint;
20772080
getInheritedForPrinting(decl, Options, TypesToPrint);
20782081
if (TypesToPrint.empty())

lib/SymbolGraphGen/SymbolGraph.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ PrintOptions SymbolGraph::getDeclarationFragmentsPrintOptions() const {
6161
Opts.SkipPrivateStdlibDecls = true;
6262
Opts.SkipUnderscoredStdlibProtocols = true;
6363
Opts.PrintGenericRequirements = true;
64+
Opts.PrintInherited = false;
6465

6566
Opts.ExclusiveAttrList.clear();
6667

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
// RUN: %FileCheck %s --input-file %t/NominalTypes.symbols.json --check-prefix=ENUM
77
// RUN: %FileCheck %s --input-file %t/NominalTypes.symbols.json --check-prefix=TYPEALIAS
88

9-
public struct S<T> where T: Sequence {}
9+
public protocol P {}
10+
11+
public struct S<T> : P where T: Sequence {}
1012

1113
// STRUCT-LABEL: "precise": "s:12NominalTypes1SV",
1214
// STRUCT: "declarationFragments": [

0 commit comments

Comments
 (0)