mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Don't print inherited, synthesized protocols
This commit is contained in:
@@ -357,7 +357,8 @@ class InheritedProtocolCollector {
|
||||
/// For each type in \p directlyInherited, classify the protocols it refers to
|
||||
/// as included for printing or not, and record them in the appropriate
|
||||
/// vectors.
|
||||
void recordProtocols(ArrayRef<TypeLoc> directlyInherited, const Decl *D) {
|
||||
void recordProtocols(ArrayRef<TypeLoc> directlyInherited, const Decl *D,
|
||||
bool skipSynthesized = false) {
|
||||
Optional<AvailableAttrList> availableAttrs;
|
||||
|
||||
for (TypeLoc inherited : directlyInherited) {
|
||||
@@ -378,6 +379,9 @@ class InheritedProtocolCollector {
|
||||
// any of those besides 'AnyObject'.
|
||||
}
|
||||
|
||||
if (skipSynthesized)
|
||||
return;
|
||||
|
||||
// Check for synthesized protocols, like Hashable on enums.
|
||||
if (auto *nominal = dyn_cast<NominalTypeDecl>(D)) {
|
||||
SmallVector<ProtocolConformance *, 4> localConformances =
|
||||
@@ -455,7 +459,8 @@ public:
|
||||
if (auto *CD = dyn_cast<ClassDecl>(D)) {
|
||||
for (auto *SD = CD->getSuperclassDecl(); SD;
|
||||
SD = SD->getSuperclassDecl()) {
|
||||
map[nominal].recordProtocols(SD->getInherited(), SD);
|
||||
map[nominal].recordProtocols(
|
||||
SD->getInherited(), SD, /*skipSynthesized=*/true);
|
||||
for (auto *Ext: SD->getExtensions()) {
|
||||
if (shouldInclude(Ext)) {
|
||||
map[nominal].recordProtocols(Ext->getInherited(), Ext);
|
||||
|
||||
Reference in New Issue
Block a user