Skip to content

Commit 8fe78d4

Browse files
committed
[ConstraintSystem] Implement simplication of {Pack, PatternBinding}Element elements
1 parent 029b112 commit 8fe78d4

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

lib/Sema/ConstraintSystem.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4906,6 +4906,20 @@ void constraints::simplifyLocator(ASTNode &anchor,
49064906
case ConstraintLocator::ConformanceRequirement:
49074907
case ConstraintLocator::TypeParameterRequirement:
49084908
break;
4909+
4910+
case ConstraintLocator::PackElement:
4911+
break;
4912+
4913+
case ConstraintLocator::PatternBindingElement: {
4914+
auto pattern = path[0].castTo<LocatorPathElt::PatternBindingElement>();
4915+
auto *patternBinding = cast<PatternBindingDecl>(anchor.get<Decl *>());
4916+
anchor = patternBinding->getInit(pattern.getIndex());
4917+
// If this pattern is uninitialized, let's use it as anchor.
4918+
if (!anchor)
4919+
anchor = patternBinding->getPattern(pattern.getIndex());
4920+
path = path.slice(1);
4921+
continue;
4922+
}
49094923
}
49104924

49114925
// If we get here, we couldn't simplify the path further.

0 commit comments

Comments
 (0)