mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[Diagnostic] Don't fix partial mismatch for sub-types associated with optional conversion
If mismatch detected by `repairFailures` is related to a complex wrapped value of optional type formed from optional-to-optional or value-to-optional conversion let's not try to fix it directly but let `simplifyRestrictedConstraintImpl` record a top-level fix for more context. Resolves: rdar://problem/59703585
This commit is contained in:
@@ -3788,6 +3788,12 @@ bool ConstraintSystem::repairFailures(
|
||||
tupleLocator->isLastElement<LocatorPathElt::GenericArgument>())
|
||||
break;
|
||||
|
||||
// If the mismatch is a part of either optional-to-optional or
|
||||
// value-to-optional conversions, let's allow fix refer to a complete
|
||||
// top level type and not just a part of it.
|
||||
if (tupleLocator->findLast<LocatorPathElt::OptionalPayload>())
|
||||
break;
|
||||
|
||||
ConstraintFix *fix;
|
||||
if (tupleLocator->isLastElement<LocatorPathElt::FunctionArgument>()) {
|
||||
fix = AllowFunctionTypeMismatch::create(*this, lhs, rhs, tupleLocator, index);
|
||||
|
||||
Reference in New Issue
Block a user