Merge pull request #65267 from xymus/serial-indirect-conformances

[Serialization] Keep indirect conformances knowledge with safety
This commit is contained in:
Alexis Laferrière
2023-04-19 10:52:20 -07:00
committed by GitHub
4 changed files with 66 additions and 14 deletions

View File

@@ -3124,14 +3124,11 @@ class Serializer::DeclSerializer : public DeclVisitor<DeclSerializer> {
if (hasSafeMembers)
return true;
// We can mark the extension unsafe only if it has no public
// We can mark the extension unsafe only if it has no public
// conformances.
auto protocols = ext->getLocalProtocols(
ConformanceLookupKind::OnlyExplicit);
bool hasSafeConformances = std::any_of(protocols.begin(),
protocols.end(),
isDeserializationSafe);
if (hasSafeConformances)
if (!protocols.empty())
return true;
// Truly empty extensions are safe, it may happen in swiftinterfaces.
@@ -3141,6 +3138,9 @@ class Serializer::DeclSerializer : public DeclVisitor<DeclSerializer> {
return false;
}
if (isa<ProtocolDecl>(decl))
return true;
auto value = cast<ValueDecl>(decl);
// A decl is safe if formally accessible publicly.