@@ -2394,7 +2394,7 @@ ConstraintSystem::matchTypes(Type type1, Type type2, ConstraintKind kind,
2394
2394
if (forceUnwrapPossible) {
2395
2395
conversionsOrFixes.push_back (ForceOptional::create (
2396
2396
*this , objectType1, objectType1->getOptionalObjectType (),
2397
- getConstraintLocator (locator)));
2397
+ getConstraintLocator (locator. getAnchor () )));
2398
2398
}
2399
2399
}
2400
2400
@@ -2744,7 +2744,7 @@ ConstraintSystem::SolutionKind ConstraintSystem::simplifyConformsToConstraint(
2744
2744
subflags);
2745
2745
if (result == SolutionKind::Solved) {
2746
2746
auto *fix = ForceOptional::create (*this , type, optionalObjectType,
2747
- getConstraintLocator (locator));
2747
+ getConstraintLocator (locator. getAnchor () ));
2748
2748
if (recordFix (fix)) {
2749
2749
return SolutionKind::Error;
2750
2750
}
@@ -3042,7 +3042,7 @@ ConstraintSystem::simplifyFunctionComponentConstraint(
3042
3042
if (unwrapCount > 0 ) {
3043
3043
auto *fix = ForceOptional::create (*this , simplifiedCopy,
3044
3044
simplifiedCopy->getOptionalObjectType (),
3045
- getConstraintLocator (locator));
3045
+ getConstraintLocator (locator. getAnchor () ));
3046
3046
while (unwrapCount-- > 0 ) {
3047
3047
if (recordFix (fix))
3048
3048
return SolutionKind::Error;
@@ -4668,7 +4668,7 @@ ConstraintSystem::simplifyApplicableFnConstraint(
4668
4668
// Record any fixes we attempted to get to the correct solution.
4669
4669
auto *fix = ForceOptional::create (*this , origType2,
4670
4670
origType2->getOptionalObjectType (),
4671
- getConstraintLocator (locator));
4671
+ getConstraintLocator (locator. getAnchor () ));
4672
4672
while (unwrapCount-- > 0 ) {
4673
4673
if (recordFix (fix))
4674
4674
return SolutionKind::Error;
@@ -4693,7 +4693,7 @@ ConstraintSystem::simplifyApplicableFnConstraint(
4693
4693
if (simplified == SolutionKind::Solved) {
4694
4694
auto *fix = ForceOptional::create (*this , origType2,
4695
4695
origType2->getOptionalObjectType (),
4696
- getConstraintLocator (locator));
4696
+ getConstraintLocator (locator. getAnchor () ));
4697
4697
while (unwrapCount-- > 0 ) {
4698
4698
if (recordFix (fix))
4699
4699
return SolutionKind::Error;
@@ -5409,12 +5409,7 @@ bool ConstraintSystem::recordFix(ConstraintFix *fix) {
5409
5409
// This situation might happen when the same fix kind is applicable to
5410
5410
// different overload choices.
5411
5411
auto *loc = fix->getLocator ();
5412
- auto *anchor = loc->getAnchor ();
5413
5412
auto existingFix = llvm::find_if (Fixes, [&](const ConstraintFix *e) {
5414
- if (e->getKind () == FixKind::ForceOptional &&
5415
- e->getLocator ()->getAnchor () == anchor) {
5416
- return true ;
5417
- }
5418
5413
// If we already have a fix like this recorded, let's not do it again,
5419
5414
return e->getKind () == fix->getKind () && e->getLocator () == loc;
5420
5415
});
0 commit comments