[ConstraintSystem] Don't produce argument mismatch fix when pointer conversions are involved

This commit is contained in:
Pavel Yaskevich
2019-09-03 17:07:24 -07:00
parent 93b39c9c23
commit c946b3862e

View File

@@ -2583,6 +2583,16 @@ bool ConstraintSystem::repairFailures(
if (hasConversionOrRestriction(ConversionRestrictionKind::DeepEquality))
break;
// If there implicit 'something-to-pointer' conversions involved,
// such conversions are going to be diagnosed by specialized fix
// which deals with generic argument mismatches.
if (hasConversionOrRestriction(ConversionRestrictionKind::ArrayToPointer) ||
hasConversionOrRestriction(ConversionRestrictionKind::InoutToPointer) ||
hasConversionOrRestriction(
ConversionRestrictionKind::PointerToPointer) ||
matchKind == ConstraintKind::BindToPointerType)
break;
// If this is a ~= operator implicitly generated by pattern matching
// let's not try to fix right-hand side of the operator because it's
// a correct contextual type.