Skip to content

Commit ac9dfe1

Browse files
committed
Add a utility to substitute generic arguments into a canonical
generic function type.
1 parent 5b6c008 commit ac9dfe1

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

include/swift/AST/Types.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3208,6 +3208,8 @@ BEGIN_CAN_TYPE_WRAPPER(GenericFunctionType, AnyFunctionType)
32083208
return cast<GenericFunctionType>(fnType->getCanonicalType());
32093209
}
32103210

3211+
CanFunctionType substGenericArgs(SubstitutionMap subs) const;
3212+
32113213
CanGenericSignature getGenericSignature() const {
32123214
return CanGenericSignature(getPointer()->getGenericSignature());
32133215
}

lib/AST/Type.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2683,6 +2683,12 @@ GenericFunctionType::substGenericArgs(SubstitutionMap subs) {
26832683
substFn->getResult(), getExtInfo());
26842684
}
26852685

2686+
CanFunctionType
2687+
CanGenericFunctionType::substGenericArgs(SubstitutionMap subs) const {
2688+
return cast<FunctionType>(
2689+
getPointer()->substGenericArgs(subs)->getCanonicalType());
2690+
}
2691+
26862692
static Type getMemberForBaseType(LookupConformanceFn lookupConformances,
26872693
Type origBase,
26882694
Type substBase,

0 commit comments

Comments
 (0)