mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
AST: Get rid of old form of Type::subst()
First, add some new utility methods to create SubstitutionMaps: - GenericSignature::getSubstitutionMap() -- provides a new way to directly build a SubstitutionMap. It takes a TypeSubstitutionFn and LookupConformanceFn. This is equivalent to first calling getSubstitutions() with the two functions to create an ArrayRef<Substitution>, followed by the old form of getSubstitutionMap() on the result. - TypeBase::getContextSubstitutionMap() -- replacement for getContextSubstitutions(), returning a SubstitutionMap. - TypeBase::getMemberSubstitutionMap() -- replacement for getMemberSubstitutions(), returning a SubstitutionMap. With these in place, almost all existing uses of subst() taking a ModuleDecl can now use the new form taking a SubstitutionMap instead. The few remaining cases are explicitly written to use a TypeSubstitutionFn and LookupConformanceFn.
This commit is contained in:
@@ -2003,12 +2003,13 @@ public:
|
||||
return T;
|
||||
|
||||
// For everything else, substitute in the base type.
|
||||
auto Subs = MaybeNominalType->getMemberSubstitutions(VD);
|
||||
auto Subs = MaybeNominalType->getMemberSubstitutionMap(M, VD);
|
||||
|
||||
// Pass in DesugarMemberTypes so that we see the actual
|
||||
// concrete type witnesses instead of type alias types.
|
||||
T = T.subst(M, Subs, (SubstFlags::DesugarMemberTypes |
|
||||
SubstFlags::UseErrorType));
|
||||
T = T.subst(Subs,
|
||||
(SubstFlags::DesugarMemberTypes |
|
||||
SubstFlags::UseErrorType));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user