@@ -357,7 +357,8 @@ class InheritedProtocolCollector {
357357 // / For each type in \p directlyInherited, classify the protocols it refers to
358358 // / as included for printing or not, and record them in the appropriate
359359 // / vectors.
360- void recordProtocols (ArrayRef<TypeLoc> directlyInherited, const Decl *D) {
360+ void recordProtocols (ArrayRef<TypeLoc> directlyInherited, const Decl *D,
361+ bool skipSynthesized = false ) {
361362 Optional<AvailableAttrList> availableAttrs;
362363
363364 for (TypeLoc inherited : directlyInherited) {
@@ -378,6 +379,9 @@ class InheritedProtocolCollector {
378379 // any of those besides 'AnyObject'.
379380 }
380381
382+ if (skipSynthesized)
383+ return ;
384+
381385 // Check for synthesized protocols, like Hashable on enums.
382386 if (auto *nominal = dyn_cast<NominalTypeDecl>(D)) {
383387 SmallVector<ProtocolConformance *, 4 > localConformances =
@@ -455,7 +459,8 @@ class InheritedProtocolCollector {
455459 if (auto *CD = dyn_cast<ClassDecl>(D)) {
456460 for (auto *SD = CD->getSuperclassDecl (); SD;
457461 SD = SD->getSuperclassDecl ()) {
458- map[nominal].recordProtocols (SD->getInherited (), SD);
462+ map[nominal].recordProtocols (
463+ SD->getInherited (), SD, /* skipSynthesized=*/ true );
459464 for (auto *Ext: SD->getExtensions ()) {
460465 if (shouldInclude (Ext)) {
461466 map[nominal].recordProtocols (Ext->getInherited (), Ext);
0 commit comments