Skip to content

Commit 14cf3c3

Browse files
committed
[AST] NFC: Teach getExpandedGenericArgs to handle partially resolved parameter packs
A temporary fix to make it possible to debug expressions with partially resolved variadic generic types. The issue stems from the fact that `BoundGenericType` is allowed to have pack parameters directly represented by type variables, as soon as that is no longer the case this check should be removed.
1 parent b68e5f6 commit 14cf3c3

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

lib/AST/ParameterPack.cpp

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -432,8 +432,17 @@ PackType::getExpandedGenericArgs(ArrayRef<GenericTypeParamType *> params,
432432
auto arg = args[i];
433433

434434
if (params[i]->isParameterPack()) {
435-
auto argPackElements = arg->castTo<PackType>()->getElementTypes();
436-
wrappedArgs.append(argPackElements.begin(), argPackElements.end());
435+
// FIXME: A temporary fix to make it possible to debug expressions
436+
// with partially resolved variadic generic types. The issue stems
437+
// from the fact that `BoundGenericType` is allowed to have pack
438+
// parameters directly represented by type variables, as soon as
439+
// that is no longer the case this check should be removed.
440+
if (arg->is<TypeVariableType>()) {
441+
wrappedArgs.push_back(arg);
442+
} else {
443+
auto argPackElements = arg->castTo<PackType>()->getElementTypes();
444+
wrappedArgs.append(argPackElements.begin(), argPackElements.end());
445+
}
437446
continue;
438447
}
439448

0 commit comments

Comments
 (0)