Skip to content

Commit 62d8670

Browse files
committed
[AST] Use interface type to obtain the depth of parameter pack's element type.
1 parent c8fe36d commit 62d8670

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/AST/GenericEnvironment.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -734,10 +734,11 @@ GenericEnvironment::mapElementTypeIntoPackContext(Type type) const {
734734

735735
type = type->mapTypeOutOfContext();
736736

737+
auto interfaceType = element->getInterfaceType();
738+
737739
llvm::SmallDenseMap<GenericParamKey, GenericTypeParamType *>
738740
packParamForElement;
739-
auto elementDepth =
740-
sig.getInnermostGenericParams().front()->getDepth() + 1;
741+
auto elementDepth = interfaceType->getRootGenericParam()->getDepth();
741742

742743
for (auto *genericParam : sig.getGenericParams()) {
743744
if (!genericParam->isParameterPack())

0 commit comments

Comments
 (0)