Serialization: Serialize default witnesses when serializing a protocol

This will allow SILGen to check if a requirement was witnessed by
its default implementation.
This commit is contained in:
Slava Pestov
2016-03-15 23:06:00 -07:00
parent 1603b0f153
commit a4c50e1c40
8 changed files with 119 additions and 15 deletions

View File

@@ -54,7 +54,7 @@ const uint16_t VERSION_MAJOR = 0;
/// 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.
/// describe what change you made.
const uint16_t VERSION_MINOR = 241; // Last change: set_deallocating instruction
const uint16_t VERSION_MINOR = 242; // Last change: serialize ProtocolDecl::DefaultWitnesses
using DeclID = PointerEmbeddedInt<unsigned, 31>;
using DeclIDField = BCFixed<31>;
@@ -832,7 +832,15 @@ namespace decls_block {
AccessibilityKindField, // accessibility
BCVBR<4>, // number of protocols
BCArray<DeclIDField> // protocols and inherited types
// Trailed by the generic parameters (if any) and the members record
// Trailed by the generic parameters (if any), the members record, and
// the default witness table record
>;
/// A default witness table for a protocol.
using DefaultWitnessTableLayout = BCRecordLayout<
DEFAULT_WITNESS_TABLE,
BCArray<DeclIDField>
// An array of requirement / witness pairs
>;
using ConstructorLayout = BCRecordLayout<