Skip to content

Commit 557c6f7

Browse files
committed
[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.
1 parent fad02e3 commit 557c6f7

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

lib/Sema/ConstraintSystem.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5729,6 +5729,13 @@ void constraints::simplifyLocator(ASTNode &anchor,
57295729
// Extract tuple element.
57305730
auto elt = path[0].castTo<LocatorPathElt::AnyTupleElement>();
57315731
unsigned index = elt.getIndex();
5732+
5733+
if (auto *AE = getAsExpr<AssignExpr>(anchor)) {
5734+
if (isa<TupleExpr>(AE->getSrc())) {
5735+
anchor = AE->getSrc();
5736+
}
5737+
}
5738+
57325739
if (auto tupleExpr = getAsExpr<TupleExpr>(anchor)) {
57335740
if (index < tupleExpr->getNumElements()) {
57345741
anchor = tupleExpr->getElement(index);
@@ -5744,6 +5751,7 @@ void constraints::simplifyLocator(ASTNode &anchor,
57445751
continue;
57455752
}
57465753
}
5754+
57475755
break;
57485756
}
57495757

0 commit comments

Comments
 (0)