mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
SIL: SILModule::lookUpWitnessTable should always return a substitution list for generic conformances.
Even if the type is the DeclaredTypeInContext of the nominal, we still want the substitution list for generic specialization. Ideally the AST would always have a SpecializedProtocolConformance when we refer to a generic type instance, but our representation makes that difficult. Swift SVN r12887
This commit is contained in:
@@ -75,6 +75,15 @@ SILModule::lookUpWitnessTable(const ProtocolConformance *C) {
|
||||
const NormalProtocolConformance *NormalC
|
||||
= cast<NormalProtocolConformance>(ParentC);
|
||||
|
||||
// If the normal conformance is for a generic type, and we didn't hit a
|
||||
// specialized conformance, collect the substitutions from the generic type.
|
||||
// FIXME: The AST should do this for us.
|
||||
if (NormalC->getType()->isSpecialized() && Subs.empty()) {
|
||||
Subs = NormalC->getType()
|
||||
->gatherAllSubstitutions(NormalC->getDeclContext()->getParentModule(),
|
||||
nullptr);
|
||||
}
|
||||
|
||||
// Did we already find this?
|
||||
auto found = WitnessTableLookupCache.find(NormalC);
|
||||
if (found != WitnessTableLookupCache.end())
|
||||
|
||||
Reference in New Issue
Block a user