Construct the type witnesses of SpecializedProtocolConformance lazily.

A SpecializedProtocolConformance intentionally contains all of the
information we need to synthesize the type witnesses from the
underlying (generic) conformance. Do so lazily rather than eagerly,
because we won't always need all of them.

As a nice side effect, we no longer need to serialize the witnesses of
these specialized protocol conformances, so we can save some space in
the Swift module file.


Swift SVN r11303
This commit is contained in:
Doug Gregor
2013-12-14 06:20:44 +00:00
parent b26ac34ade
commit 07c0793e30
14 changed files with 84 additions and 151 deletions

View File

@@ -835,7 +835,7 @@ ConstraintSystem::getTypeOfMemberReference(Type baseTy, ValueDecl *value,
auto proto = cast<ProtocolDecl>(assocType->getDeclContext());
ProtocolConformance *conformance = nullptr;
if (TC.conformsToProtocol(baseObjTy, proto, DC, &conformance)) {
auto memberTy = conformance->getTypeWitness(assocType).Replacement;
auto memberTy = conformance->getTypeWitness(assocType, &TC).Replacement;
if (!isTypeReference)
memberTy = MetaTypeType::get(memberTy, TC.Context);
@@ -947,7 +947,7 @@ ConstraintSystem::getTypeOfMemberReference(Type baseTy, ValueDecl *value,
!baseObjTy->hasTypeVariable()) {
ProtocolConformance *conformance = nullptr;
if (TC.conformsToProtocol(baseObjTy, proto, DC, &conformance)) {
type = conformance->getTypeWitness(assocType).Replacement;
type = conformance->getTypeWitness(assocType, &TC).Replacement;
}
}
} else if (isa<ConstructorDecl>(value) || isa<EnumElementDecl>(value) ||