File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -4497,8 +4497,21 @@ bool ConstraintSystem::repairFailures(
4497
4497
break ;
4498
4498
}
4499
4499
4500
+ auto *parentLoc = getConstraintLocator (anchor, path);
4501
+
4500
4502
if ((lhs->is <InOutType>() && !rhs->is <InOutType>()) ||
4501
4503
(!lhs->is <InOutType>() && rhs->is <InOutType>())) {
4504
+ // Since `FunctionArgument` as a last locator element represents
4505
+ // a single parameter of the function type involved in a conversion
4506
+ // to another function type, see `matchFunctionTypes`. If there is already
4507
+ // a fix for the this convertion, we can just ignore individual function
4508
+ // argument in-out mismatch failure by considered this fixed increasing
4509
+ // the score.
4510
+ if (hasFixFor (parentLoc)) {
4511
+ increaseScore (SK_Fix);
4512
+ return true ;
4513
+ }
4514
+
4502
4515
// We want to call matchTypes with the default decomposition options
4503
4516
// in case there are type variables that we couldn't bind due to the
4504
4517
// inout attribute mismatch.
@@ -4514,7 +4527,6 @@ bool ConstraintSystem::repairFailures(
4514
4527
}
4515
4528
}
4516
4529
4517
- auto *parentLoc = getConstraintLocator (anchor, path);
4518
4530
// In cases like this `FunctionArgument` as a last locator element
4519
4531
// represents a single parameter of the function type involved in
4520
4532
// a conversion to another function type, see `matchFunctionTypes`.
You can’t perform that action at this time.
0 commit comments