Skip to content

Commit 98d8eb9

Browse files
committed
[SymbolGraph] Use isImplicitlyPrivate for extended types
This was just using `hasUnderscoredNaming` before but this only checks the leafmost type. When filtering extended types, it should continue to look up through nesting types to see if they are also implicitly private. rdar://61843516
1 parent 8324fed commit 98d8eb9

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

lib/SymbolGraphGen/SymbolGraphASTWalker.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,9 @@ bool SymbolGraphASTWalker::walkToDeclPre(Decl *D, CharSourceRange Range) {
107107
// potentially with generic requirements.
108108
if (const auto *Extension = dyn_cast<ExtensionDecl>(D)) {
109109
const auto *ExtendedNominal = Extension->getExtendedNominal();
110+
auto ExtendedSG = getModuleSymbolGraph(ExtendedNominal);
110111
// Ignore effecively private decls.
111-
if (ExtendedNominal->hasUnderscoredNaming()) {
112+
if (ExtendedSG->isImplicitlyPrivate(ExtendedNominal)) {
112113
return false;
113114
}
114115

@@ -119,8 +120,6 @@ bool SymbolGraphASTWalker::walkToDeclPre(Decl *D, CharSourceRange Range) {
119120
// If there are some protocol conformances on this extension, we'll
120121
// grab them for some new conformsTo relationships.
121122
if (!Extension->getInherited().empty()) {
122-
auto ExtendedSG =
123-
getModuleSymbolGraph(ExtendedNominal);
124123

125124
// The symbol graph to use to record these relationships.
126125
SmallVector<const ProtocolDecl *, 4> Protocols;

test/SymbolGraph/Symbols/SkipsPublicUnderscore.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ public protocol PublicProtocol {}
1010
public protocol _ProtocolShouldntAppear {}
1111

1212
// CHECK-NOT: _ShouldntAppear
13+
1314
public struct _ShouldntAppear: PublicProtocol, _ProtocolShouldntAppear {
1415
// Although these are public and not underscored,
1516
// they are inside an underscored type,
@@ -51,3 +52,11 @@ extension _ShouldntAppear {
5152
public var shouldntAppear: Int
5253
}
5354
}
55+
56+
extension _ShouldntAppear.InnerShouldntAppear {
57+
public struct ShouldntAppear {}
58+
}
59+
60+
extension _ShouldntAppear.InnerShouldntAppear: Equatable {}
61+
62+
// CHECK: "relationships": []

0 commit comments

Comments
 (0)