mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Partially revert “Maintain the DeclContext of a NormalProtocolConformance as the type declaration or extension.”
We now have this information during parsing and throw it away during deserialization. This half-baked state works because all non-generic-extension clients only care about the module context. Swift SVN r20833
This commit is contained in:
@@ -131,17 +131,23 @@ GenericParamList *ProtocolConformance::getSubstitutedGenericParams() const {
|
||||
C = cast<SpecializedProtocolConformance>(C)->getGenericConformance();
|
||||
FoundSpecializedConformance = true;
|
||||
continue;
|
||||
case ProtocolConformanceKind::Normal:
|
||||
case ProtocolConformanceKind::Normal: {
|
||||
// If we have a normal protocol conformance and we have not seen a
|
||||
// specialized protocol conformance yet, we know that the normal protocol
|
||||
// conformance can only contain open types. Bail.
|
||||
if (!FoundSpecializedConformance)
|
||||
return nullptr;
|
||||
|
||||
|
||||
// Otherwise, this must be the original conformance containing the
|
||||
// specialized generic parameters. Attempt to create the param list.
|
||||
auto normal = cast<NormalProtocolConformance>(C);
|
||||
if (auto ext = dyn_cast<ExtensionDecl>(normal->getDeclContext()))
|
||||
return ext->getGenericParams();
|
||||
|
||||
return genericParamListForType(C->getType());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -160,11 +166,16 @@ GenericParamList *ProtocolConformance::getGenericParams() const {
|
||||
// currently partial specialization, we know that it can not have any open
|
||||
// type variables.
|
||||
return nullptr;
|
||||
case ProtocolConformanceKind::Normal:
|
||||
case ProtocolConformanceKind::Normal: {
|
||||
// If we have a normal protocol conformance, attempt to look up its open
|
||||
// generic type variables.
|
||||
auto normal = cast<NormalProtocolConformance>(C);
|
||||
if (auto ext = dyn_cast<ExtensionDecl>(normal->getDeclContext()))
|
||||
return ext->getGenericParams();
|
||||
|
||||
return genericParamListForType(C->getType());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user