[NFC] Collect protocol decls, not type, in ExistentialLayout

Another thing that will be necessary for correctness with
compositions of parameterized protocols.
This commit is contained in:
John McCall
2022-04-10 18:28:47 -04:00
parent 524ef5daa9
commit 5519749ade
27 changed files with 98 additions and 118 deletions

View File

@@ -390,12 +390,12 @@ class InheritedProtocolCollector {
bool canPrintNormally = canPrintProtocolTypeNormally(inheritedTy, D);
ExistentialLayout layout = inheritedTy->getExistentialLayout();
for (ProtocolType *protoTy : layout.getProtocols()) {
for (ProtocolDecl *protoDecl : layout.getProtocols()) {
if (canPrintNormally)
IncludedProtocols.push_back(protoTy->getDecl());
IncludedProtocols.push_back(protoDecl);
else
ExtraProtocols.push_back(
ProtocolAndAvailability(protoTy->getDecl(),
ProtocolAndAvailability(protoDecl,
getAvailabilityAttrs(D, availableAttrs),
inherited.isUnchecked,
getOtherAttrList(D)));
@@ -433,7 +433,8 @@ class InheritedProtocolCollector {
continue;
ExistentialLayout layout = inheritedTy->getExistentialLayout();
for (ProtocolType *protoTy : layout.getProtocols()) {
for (ProtocolDecl *protoDecl : layout.getProtocols()) {
auto protoTy = protoDecl->getDeclaredInterfaceType()->castTo<ProtocolType>();
if (!isPublicOrUsableFromInline(protoTy))
continue;
ConditionalConformanceProtocols.push_back(protoTy);