[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:
Pavel Yaskevich
2020-03-03 00:24:23 -08:00
parent b5cb81bd0a
commit f7b264583d
3 changed files with 24 additions and 0 deletions

View File

@@ -1884,6 +1884,12 @@ bool ContextualFailure::diagnoseAsError() {
return true;
}
if (isa<AssignExpr>(anchor)) {
emitDiagnostic(anchor->getLoc(), diag::cannot_convert_assign,
getFromType(), getToType());
return true;
}
return false;
}