[Serialization] Wire up archetype generic environments eagerly.

Teach the serialized form of ArchetypeType about its owning generic
environment, so we can wire up the generic environment of (primary)
archetypes eagerly (at the point of deserialization) rather than when
we form the generic environment. This ensures that there is no point
at which we have a (non-opened-existential) archetype without a
generic environment.

... except that the type reconstruction code creates such archetypes.
This commit is contained in:
Doug Gregor
2017-01-06 11:10:47 -08:00
parent b75ef56bdc
commit ad90116da9
9 changed files with 90 additions and 169 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 = 303; // Last change: SIL generic environments
const uint16_t VERSION_MINOR = 304; // Last change: Archetype generic env
using DeclID = PointerEmbeddedInt<unsigned, 31>;
using DeclIDField = BCFixed<31>;
@@ -630,7 +630,8 @@ namespace decls_block {
using ArchetypeTypeLayout = BCRecordLayout<
ARCHETYPE_TYPE,
TypeIDField, // parent if non-primary
BCFixed<1>, // whether this is a primary archetype or not
TypeIDField, // parent if non-primary, generic env if primary
DeclIDField, // associated type decl if non-primary, name if primary
TypeIDField, // superclass
BCArray<DeclIDField> // conformances