Skip to content

Commit 814fb47

Browse files
authored
Merge pull request #13360 from rudkx/change-cast-locator-to-result-expr
[ConstraintSystem] Use locator from result of cast rather than source.
2 parents 572bb43 + 116b664 commit 814fb47

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/Sema/CSGen.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2512,7 +2512,7 @@ namespace {
25122512
expr->getCastTypeLoc().setType(toType, /*validated=*/true);
25132513

25142514
auto fromType = CS.getType(fromExpr);
2515-
auto locator = CS.getConstraintLocator(fromExpr);
2515+
auto locator = CS.getConstraintLocator(expr);
25162516

25172517
// The source type can be checked-cast to the destination type.
25182518
CS.addConstraint(ConstraintKind::CheckedCast, fromType, toType, locator);
@@ -2560,7 +2560,7 @@ namespace {
25602560
expr->getCastTypeLoc().setType(toType, /*validated=*/true);
25612561

25622562
auto fromType = CS.getType(fromExpr);
2563-
auto locator = CS.getConstraintLocator(fromExpr);
2563+
auto locator = CS.getConstraintLocator(expr);
25642564
CS.addConstraint(ConstraintKind::CheckedCast, fromType, toType, locator);
25652565
return OptionalType::get(toType);
25662566
}

0 commit comments

Comments
 (0)