Skip to content

Commit 80e98ca

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. (cherry picked from commit 557c6f7)
1 parent 14d4bf4 commit 80e98ca

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
@@ -5705,6 +5705,13 @@ void constraints::simplifyLocator(ASTNode &anchor,
57055705
// Extract tuple element.
57065706
auto elt = path[0].castTo<LocatorPathElt::AnyTupleElement>();
57075707
unsigned index = elt.getIndex();
5708+
5709+
if (auto *AE = getAsExpr<AssignExpr>(anchor)) {
5710+
if (isa<TupleExpr>(AE->getSrc())) {
5711+
anchor = AE->getSrc();
5712+
}
5713+
}
5714+
57085715
if (auto tupleExpr = getAsExpr<TupleExpr>(anchor)) {
57095716
if (index < tupleExpr->getNumElements()) {
57105717
anchor = tupleExpr->getElement(index);
@@ -5720,6 +5727,7 @@ void constraints::simplifyLocator(ASTNode &anchor,
57205727
continue;
57215728
}
57225729
}
5730+
57235731
break;
57245732
}
57255733

0 commit comments

Comments
 (0)