mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
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:
@@ -595,7 +595,7 @@ public:
|
||||
|
||||
virtual void
|
||||
loadAllConformances(const Decl *D, uint64_t contextData,
|
||||
SmallVectorImpl<ProtocolConformance*> &Conforms) override;
|
||||
SmallVectorImpl<ProtocolConformance*> &Conforms) override;
|
||||
|
||||
virtual TypeLoc loadAssociatedTypeDefault(const AssociatedTypeDecl *ATD,
|
||||
uint64_t contextData) override;
|
||||
@@ -653,9 +653,7 @@ public:
|
||||
Optional<Substitution> maybeReadSubstitution(llvm::BitstreamCursor &Cursor);
|
||||
|
||||
/// Recursively reads a protocol conformance from the given cursor.
|
||||
///
|
||||
/// Note that a null conformance is valid for archetypes.
|
||||
ProtocolConformance *readConformance(llvm::BitstreamCursor &Cursor);
|
||||
ProtocolConformanceRef readConformance(llvm::BitstreamCursor &Cursor);
|
||||
|
||||
/// Read the given normal conformance from the current module file.
|
||||
NormalProtocolConformance *
|
||||
|
||||
Reference in New Issue
Block a user