[CSSimplify] Handle optional wrong type conversion

This commit is contained in:
Luciano Almeida
2020-01-07 16:37:09 -03:00
parent 06201a64be
commit 0e1a03dc61

View File

@@ -2842,8 +2842,10 @@ bool ConstraintSystem::repairFailures(
// If it has a deep equality restriction, defer the diagnostic to
// GenericMismatch.
if (hasConversionOrRestriction(ConversionRestrictionKind::DeepEquality))
return false;
if (hasConversionOrRestriction(ConversionRestrictionKind::DeepEquality)) {
if (!lhs->getOptionalObjectType() && !rhs->getOptionalObjectType())
return false;
}
auto *fix = ContextualMismatch::create(*this, lhs, rhs,
getConstraintLocator(locator));