[Serialization] Recover from ObjC protocols changing inheritance. (#11109)

When there's an Objective-C protocol that adopts other protocols, the
other protocols become part of the requirement signature. If that can
change, Swift conformances to that protocol will get very confused
when it comes time to deserialize the conformances that satisfy the
requirement signature.

To recover from this, just deserialize /all/ trailing conformances,
rather than follow the requirement signature, and match them up after
the fact. (This only works for Objective-C protocols where we know all
conformance requirements represent inherited protocols, as opposed to
constraints on associated types.)

rdar://problem/33356098
This commit is contained in:
Jordan Rose
2017-07-24 16:22:10 -07:00
committed by GitHub
parent 780616a651
commit 4d26358708
6 changed files with 177 additions and 11 deletions

View File

@@ -1361,6 +1361,9 @@ void Serializer::writeNormalConformance(
return false;
});
unsigned numSignatureConformances =
conformance->getSignatureConformances().size();
unsigned abbrCode
= DeclTypeAbbrCodes[NormalProtocolConformanceLayout::Code];
auto ownerID = addDeclContextRef(conformance->getDeclContext());
@@ -1368,6 +1371,7 @@ void Serializer::writeNormalConformance(
addDeclRef(protocol), ownerID,
numValueWitnesses,
numTypeWitnesses,
numSignatureConformances,
data);
// Write requirement signature conformances.