File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -3774,6 +3774,14 @@ bool ConstraintSystem::repairFailures(
3774
3774
}
3775
3775
3776
3776
case ConstraintLocator::KeyPathRoot: {
3777
+ // The root mismatch is from base U? to U or a subtype of U in keypath
3778
+ // application so let's suggest an unwrap the optional fix.
3779
+ if (auto unwrapFix = UnwrapOptionalBaseKeyPathApplication::attempt (
3780
+ *this , lhs, rhs, getConstraintLocator (locator))) {
3781
+ conversionsOrFixes.push_back (unwrapFix);
3782
+ break ;
3783
+ }
3784
+
3777
3785
conversionsOrFixes.push_back (AllowKeyPathRootTypeMismatch::create (
3778
3786
*this , lhs, rhs, getConstraintLocator (locator)));
3779
3787
@@ -9742,6 +9750,7 @@ ConstraintSystem::SolutionKind ConstraintSystem::simplifyFixConstraint(
9742
9750
case FixKind::CoerceToCheckedCast:
9743
9751
case FixKind::SpecifyObjectLiteralTypeImport:
9744
9752
case FixKind::AllowKeyPathRootTypeMismatch:
9753
+ case FixKind::UnwrapOptionalBaseKeyPathApplication:
9745
9754
case FixKind::AllowCoercionToForceCast:
9746
9755
case FixKind::SpecifyKeyPathRootType: {
9747
9756
return recordFix (fix) ? SolutionKind::Error : SolutionKind::Solved;
You can’t perform that action at this time.
0 commit comments