[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

@@ -54,7 +54,7 @@ const uint16_t VERSION_MAJOR = 0;
/// in source control, you should also update the comment to briefly
/// describe what change you made. The content of this comment isn't important;
/// it just ensures a conflict if two people change the module format.
const uint16_t VERSION_MINOR = 352; // Last change: 'shared' type attribute
const uint16_t VERSION_MINOR = 353; // Last change: count inherited conformances
using DeclID = PointerEmbeddedInt<unsigned, 31>;
using DeclIDField = BCFixed<31>;
@@ -1170,10 +1170,11 @@ namespace decls_block {
DeclContextIDField, // the decl that provided this conformance
BCVBR<5>, // value mapping count
BCVBR<5>, // type mapping count
BCVBR<5>, // requirement signature conformance count
BCArray<DeclIDField>
// The array contains archetype-value pairs, then type declarations.
// Inherited conformances follow, then the substitution records for the
// associated types.
// Requirement signature conformances follow, then the substitution records
// for the associated types.
>;
using SpecializedProtocolConformanceLayout = BCRecordLayout<