[ModuleInterface] Fix implementation-only imported type leak in indirect conformance

Don't print indirect conformances for protocols that are
implementation-only imported. Indirect conformances are synthesized when
the middle protocol is internal and not printed in the swiftinterface.
This logic didn't previously check for implementation-only imports,
likely because type-checking usually forbids it. Let's still protect
this use case as we are considering relaxing this type-checking
restriction in the future.

rdar://78718838
This commit is contained in:
Alexis Laferrière
2021-06-14 11:23:57 -07:00
parent b18b29e7f8
commit 73960ee977
2 changed files with 21 additions and 1 deletions

View File

@@ -562,7 +562,8 @@ public:
return TypeWalker::Action::Continue;
if (isPublicOrUsableFromInline(inherited) &&
conformanceDeclaredInModule(M, nominal, inherited)) {
conformanceDeclaredInModule(M, nominal, inherited) &&
!M->isImportedImplementationOnly(inherited->getParentModule())) {
protocolsToPrint.push_back({inherited, protoAndAvailability.second});
return TypeWalker::Action::SkipChildren;
}