Skip to content

[SymbolGraph] Use isImplicitlyPrivate for extended types #31044

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 15, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions lib/SymbolGraphGen/SymbolGraphASTWalker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,9 @@ bool SymbolGraphASTWalker::walkToDeclPre(Decl *D, CharSourceRange Range) {
// potentially with generic requirements.
if (const auto *Extension = dyn_cast<ExtensionDecl>(D)) {
const auto *ExtendedNominal = Extension->getExtendedNominal();
auto ExtendedSG = getModuleSymbolGraph(ExtendedNominal);
// Ignore effecively private decls.
if (ExtendedNominal->hasUnderscoredNaming()) {
if (ExtendedSG->isImplicitlyPrivate(ExtendedNominal)) {
return false;
}

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

// The symbol graph to use to record these relationships.
SmallVector<const ProtocolDecl *, 4> Protocols;
Expand Down
9 changes: 9 additions & 0 deletions test/SymbolGraph/Symbols/SkipsPublicUnderscore.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ public protocol PublicProtocol {}
public protocol _ProtocolShouldntAppear {}

// CHECK-NOT: _ShouldntAppear

public struct _ShouldntAppear: PublicProtocol, _ProtocolShouldntAppear {
// Although these are public and not underscored,
// they are inside an underscored type,
Expand Down Expand Up @@ -51,3 +52,11 @@ extension _ShouldntAppear {
public var shouldntAppear: Int
}
}

extension _ShouldntAppear.InnerShouldntAppear {
public struct ShouldntAppear {}
}

extension _ShouldntAppear.InnerShouldntAppear: Equatable {}

// CHECK: "relationships": []