[ConstraintSystem] Add a locator path element for the pattern of a pack expansion.

This commit is contained in:
Holly Borla
2022-11-15 21:32:30 -08:00
parent 9eccfbd3ca
commit 72d87b5ca5
5 changed files with 27 additions and 6 deletions

View File

@@ -5330,6 +5330,14 @@ void constraints::simplifyLocator(ASTNode &anchor,
case ConstraintLocator::PackShape:
break;
case ConstraintLocator::PackExpansionPattern: {
if (auto *expansion = getAsExpr<PackExpansionExpr>(anchor))
anchor = expansion->getPatternExpr();
path = path.slice(1);
break;
}
case ConstraintLocator::PatternBindingElement: {
auto pattern = path[0].castTo<LocatorPathElt::PatternBindingElement>();
auto *patternBinding = cast<PatternBindingDecl>(anchor.get<Decl *>());