Introduce ProtocolConformanceRef. NFC.

The main idea here is that we really, really want to be
able to recover the protocol requirement of a conformance
reference even if it's abstract due to the conforming type
being abstract (e.g. an archetype).  I've made the conversion
from ProtocolConformance* explicit to discourage casual
contamination of the Ref with a null value.

As part of this change, always make conformance arrays in
Substitutions fully parallel to the requirements, as opposed
to occasionally being empty when the conformances are abstract.

As another part of this, I've tried to proactively fix
prospective bugs with partially-concrete conformances, which I
believe can happen with concretely-bound archetypes.

In addition to just giving us stronger invariants, this is
progress towards the removal of the archetype from Substitution.
This commit is contained in:
John McCall
2016-01-08 00:08:34 -08:00
parent 3771e9d9ee
commit 2df6880617
54 changed files with 644 additions and 455 deletions

View File

@@ -52,7 +52,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 = 230; // alloc_global instruction added
const uint16_t VERSION_MINOR = 231; // abstract protocol conformances
using DeclID = Fixnum<31>;
using DeclIDField = BCFixed<31>;
@@ -1115,10 +1115,10 @@ namespace decls_block {
BCVBR<2> // context-scoped discriminator counter
>;
/// A placeholder for lack of conformance information. Conformances are
/// indexed, so simply omitting one would be incorrect.
using NoConformanceLayout = BCRecordLayout<
NO_CONFORMANCE
/// A placeholder for lack of concrete conformance information.
using AbstractProtocolConformanceLayout = BCRecordLayout<
ABSTRACT_PROTOCOL_CONFORMANCE,
DeclIDField // the protocol
>;
using NormalProtocolConformanceLayout = BCRecordLayout<