mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[ConstraintSystem] Add a missing case to locator simplification
If tuple element is anchored on an assignment, we need to look at the source of the assignment to find tuple expression the element belongs to.
This commit is contained in:
@@ -5729,6 +5729,13 @@ void constraints::simplifyLocator(ASTNode &anchor,
|
||||
// Extract tuple element.
|
||||
auto elt = path[0].castTo<LocatorPathElt::AnyTupleElement>();
|
||||
unsigned index = elt.getIndex();
|
||||
|
||||
if (auto *AE = getAsExpr<AssignExpr>(anchor)) {
|
||||
if (isa<TupleExpr>(AE->getSrc())) {
|
||||
anchor = AE->getSrc();
|
||||
}
|
||||
}
|
||||
|
||||
if (auto tupleExpr = getAsExpr<TupleExpr>(anchor)) {
|
||||
if (index < tupleExpr->getNumElements()) {
|
||||
anchor = tupleExpr->getElement(index);
|
||||
@@ -5744,6 +5751,7 @@ void constraints::simplifyLocator(ASTNode &anchor,
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user