mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user