mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[ConstraintSystem] Implement simplication of {Pack, PatternBinding}Element elements
This commit is contained in:
@@ -4906,6 +4906,20 @@ void constraints::simplifyLocator(ASTNode &anchor,
|
||||
case ConstraintLocator::ConformanceRequirement:
|
||||
case ConstraintLocator::TypeParameterRequirement:
|
||||
break;
|
||||
|
||||
case ConstraintLocator::PackElement:
|
||||
break;
|
||||
|
||||
case ConstraintLocator::PatternBindingElement: {
|
||||
auto pattern = path[0].castTo<LocatorPathElt::PatternBindingElement>();
|
||||
auto *patternBinding = cast<PatternBindingDecl>(anchor.get<Decl *>());
|
||||
anchor = patternBinding->getInit(pattern.getIndex());
|
||||
// If this pattern is uninitialized, let's use it as anchor.
|
||||
if (!anchor)
|
||||
anchor = patternBinding->getPattern(pattern.getIndex());
|
||||
path = path.slice(1);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// If we get here, we couldn't simplify the path further.
|
||||
|
||||
Reference in New Issue
Block a user