AST: Clean up getMemberSubstitutions() and friends

Rename the old getMemberSubstitutions() to getContextSubstitutions()
and add a new getMemberSubstitutions() that takes a ValueDecl, rather
than the member's DeclContext.

This new method forwards generic parameters if the member is a generic
function.
This commit is contained in:
Slava Pestov
2016-12-15 22:42:09 -08:00
parent ba81349542
commit 3989aea9ae
10 changed files with 62 additions and 37 deletions

View File

@@ -385,9 +385,8 @@ public:
/// Given part of the witness's interface type, produce its
/// substitution according to the witness substitutions.
CanType getSubstWitnessInterfaceType(CanType type) {
return SubstSelfType->getTypeOfMember(SGM.SwiftModule, type,
WitnessStorage->getDeclContext())
->getCanonicalType();
auto subs = SubstSelfType->getMemberSubstitutions(WitnessStorage);
return type.subst(SGM.SwiftModule, subs)->getCanonicalType();
}
};