diff --git a/Sources/SwiftDoc/Interface.swift b/Sources/SwiftDoc/Interface.swift index 8f5137ed..49e5008d 100644 --- a/Sources/SwiftDoc/Interface.swift +++ b/Sources/SwiftDoc/Interface.swift @@ -134,7 +134,7 @@ public final class Interface { var superclasses = Set(CollectionOfOne(baseClass)) while !superclasses.isEmpty { - let subclasses = Set(superclasses.flatMap { typesInheriting(from: $0) }.filter { $0.isPublic }) + let subclasses = Set(superclasses.flatMap { typesInheriting(from: $0) }) defer { superclasses = subclasses } classClusters[baseClass, default: []].formUnion(subclasses) } diff --git a/Sources/swift-doc/Subcommands/Diagram.swift b/Sources/swift-doc/Subcommands/Diagram.swift index 1487ea1d..360f5815 100644 --- a/Sources/swift-doc/Subcommands/Diagram.swift +++ b/Sources/swift-doc/Subcommands/Diagram.swift @@ -35,7 +35,7 @@ fileprivate func diagram(of module: Module, including symbolFilter: (Symbol) -> for (baseClass, subclasses) in module.interface.classHierarchies { var subgraph = Subgraph(id: "cluster_\(baseClass.id.description.replacingOccurrences(of: ".", with: "_"))") - for subclass in subclasses { + for subclass in subclasses.filter(symbolFilter) { var subclassNode = Node("\(subclass.id)") subclassNode.shape = .box @@ -54,7 +54,7 @@ fileprivate func diagram(of module: Module, including symbolFilter: (Symbol) -> } } - if subclasses.count > 1 { + if subgraph.nodes.count > 1 { graph.append(subgraph) } else { subgraph.nodes.forEach { graph.append($0) } @@ -67,7 +67,7 @@ fileprivate func diagram(of module: Module, including symbolFilter: (Symbol) -> let symbolNode = Node("\(symbol.id)") graph.append(symbolNode) - for inherited in module.interface.typesConformed(by: symbol) { + for inherited in module.interface.typesConformed(by: symbol).filter(symbolFilter) { let inheritedNode = Node("\(inherited.id.description)") let edge = Edge(from: symbolNode, to: inheritedNode) diff --git a/Sources/swift-doc/Supporting Types/Components/Relationships.swift b/Sources/swift-doc/Supporting Types/Components/Relationships.swift index 116adc2a..7db15956 100644 --- a/Sources/swift-doc/Supporting Types/Components/Relationships.swift +++ b/Sources/swift-doc/Supporting Types/Components/Relationships.swift @@ -36,7 +36,7 @@ struct Relationships: Component { init(of symbol: Symbol, in module: Module, baseURL: String, includingChildren symbolFilter: @escaping (Symbol) -> Bool) { self.module = module self.symbol = symbol - self.inheritedTypes = module.interface.typesInherited(by: symbol) + module.interface.typesConformed(by: symbol) + self.inheritedTypes = (module.interface.typesInherited(by: symbol) + module.interface.typesConformed(by: symbol)).filter(symbolFilter) self.baseURL = baseURL self.symbolFilter = symbolFilter } @@ -68,7 +68,7 @@ struct Relationships: Component { ("Subclasses", module.interface.typesInheriting(from: symbol)), ("Conforms To", module.interface.typesConformed(by: symbol)), ("Types Conforming to \(softbreak(symbol.id.description))", module.interface.typesConforming(to: symbol)), - ].map { (title: $0.0, symbols: $0.1.filter { $0.isPublic }) }.filter { !$0.symbols.isEmpty } + ].map { (title: $0.0, symbols: $0.1.filter(symbolFilter)) }.filter { !$0.symbols.isEmpty } } // MARK: - Component