Record protocol conformance when we start checking, rather than at the end.

As part of this, take away the poor attempt at recovering by adding an
explicit protocol conformance. The recovery mode isn't all that useful
in a system with only explicit conformance, and it messes with
diagnostics further down the line. We can bring it back later once
we're happy with explicit conformance checking.


Swift SVN r11503
This commit is contained in:
Doug Gregor
2013-12-20 15:46:31 +00:00
parent 31ca8889cd
commit 256b946a83
6 changed files with 33 additions and 222 deletions

View File

@@ -830,7 +830,8 @@ ConstraintSystem::getTypeOfMemberReference(Type baseTy, ValueDecl *value,
auto proto = cast<ProtocolDecl>(assocType->getDeclContext());
ProtocolConformance *conformance = nullptr;
if (TC.conformsToProtocol(baseObjTy, proto, DC, &conformance)) {
if (TC.conformsToProtocol(baseObjTy, proto, DC, &conformance) &&
conformance->isComplete()) {
auto memberTy = conformance->getTypeWitness(assocType, &TC).Replacement;
if (!isTypeReference)
memberTy = MetatypeType::get(memberTy, TC.Context);
@@ -941,7 +942,8 @@ ConstraintSystem::getTypeOfMemberReference(Type baseTy, ValueDecl *value,
!baseObjTy->is<ArchetypeType>() &&
!baseObjTy->hasTypeVariable()) {
ProtocolConformance *conformance = nullptr;
if (TC.conformsToProtocol(baseObjTy, proto, DC, &conformance)) {
if (TC.conformsToProtocol(baseObjTy, proto, DC, &conformance) &&
conformance->isComplete()) {
type = conformance->getTypeWitness(assocType, &TC).Replacement;
}
}