Maintain the DeclContext of a NormalProtocolConformance as the type declaration or extension.

Previously, we only retained the module in which a normal protocol
conformance occurred, which meant we either had to go searching for
the appropriate extension (yuck) or do without that information. This
is part of the separating-extension-archetypes work.

Swift SVN r20793
This commit is contained in:
Doug Gregor
2014-07-31 01:00:30 +00:00
parent e098ce84fb
commit ba040d9f21
7 changed files with 27 additions and 15 deletions

View File

@@ -528,7 +528,7 @@ ModuleFile::maybeReadConformance(Type conformingType,
lastRecordOffset.reset();
DeclID protoID;
ModuleID ownerID;
DeclID ownerID;
unsigned valueCount, typeCount, inheritedCount, defaultedCount;
bool isIncomplete;
ArrayRef<uint64_t> rawIDs;
@@ -540,8 +540,14 @@ ModuleFile::maybeReadConformance(Type conformingType,
auto proto = cast<ProtocolDecl>(getDecl(protoID));
ASTContext &ctx = getContext();
auto owner = getDecl(ownerID);
DeclContext *ownerDC;
if (auto nominal = dyn_cast<NominalTypeDecl>(owner))
ownerDC = nominal;
else
ownerDC = cast<ExtensionDecl>(owner);
auto conformance = ctx.getConformance(conformingType, proto, SourceLoc(),
getModule(ownerID),
ownerDC,
ProtocolConformanceState::Incomplete);
InheritedConformanceMap inheritedConformances;