Skip to content

Commit 0133108

Browse files
committed
SILGen: Replace calls to subst() on a GenericFunctionType with substGenericArgs()
1 parent ae99651 commit 0133108

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

lib/SILGen/SILGenExpr.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4265,16 +4265,16 @@ static void lowerKeyPathMemberIndexTypes(
42654265
if (auto subscript = dyn_cast<SubscriptDecl>(decl)) {
42664266
auto subscriptSubstTy = subscript->getInterfaceType();
42674267
auto sig = subscript->getGenericSignature();
4268-
if (sig) {
4269-
subscriptSubstTy = subscriptSubstTy.subst(memberSubs);
4268+
if (auto *subscriptGenericTy = subscriptSubstTy->getAs<GenericFunctionType>()) {
4269+
subscriptSubstTy = subscriptGenericTy->substGenericArgs(memberSubs);
42704270
}
42714271
needsGenericContext |= subscriptSubstTy->hasArchetype();
42724272
processIndicesOrParameters(subscript->getIndices(), &sig);
42734273
} else if (auto method = dyn_cast<AbstractFunctionDecl>(decl)) {
42744274
auto methodSubstTy = method->getInterfaceType();
42754275
auto sig = method->getGenericSignature();
4276-
if (sig) {
4277-
methodSubstTy = methodSubstTy.subst(memberSubs);
4276+
if (auto *methodGenericTy = methodSubstTy->getAs<GenericFunctionType>()) {
4277+
methodSubstTy = methodGenericTy->substGenericArgs(memberSubs);
42784278
}
42794279
needsGenericContext |= methodSubstTy->hasArchetype();
42804280
processIndicesOrParameters(method->getParameters(), &sig);

lib/SILGen/SILGenType.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -946,8 +946,7 @@ static SILFunction *emitSelfConformanceWitness(SILGenModule &SGM,
946946
openedConf);
947947

948948
// Substitute to get the formal substituted type of the thunk.
949-
auto reqtSubstTy =
950-
cast<AnyFunctionType>(reqtOrigTy.subst(reqtSubs)->getCanonicalType());
949+
auto reqtSubstTy = reqtOrigTy.substGenericArgs(reqtSubs);
951950

952951
// Substitute into the requirement type to get the type of the thunk.
953952
auto witnessSILFnType = requirementInfo.SILFnType->substGenericArgs(

0 commit comments

Comments
 (0)