[ConstraintSystem] Record generic fix if destination of a pointer conversion is invalid

If the right-hand side (destination) of value-to-pointer conversion
is incorrect e.g. base type of member is a hole, let's record
a generic "invalid conversion" failure.

Resolves: rdar://problem/68254165
This commit is contained in:
Pavel Yaskevich
2020-09-04 13:22:08 -07:00
parent 309cb93043
commit e4f6041dba
2 changed files with 11 additions and 2 deletions

View File

@@ -3829,8 +3829,11 @@ bool ConstraintSystem::repairFailures(
// If this is an implicit 'something-to-pointer' conversion
// it's going to be diagnosed by specialized fix which deals
// with generic argument mismatches.
if (matchKind == ConstraintKind::BindToPointerType)
break;
if (matchKind == ConstraintKind::BindToPointerType) {
auto *member = rhs->getAs<DependentMemberType>();
if (!(member && member->getBase()->hasHole()))
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