[ConstraintSystem] Fix a situation when argument requires raw representable type

This commit is contained in:
Pavel Yaskevich
2019-09-04 10:15:49 -07:00
parent c946b3862e
commit 953b9f74aa
3 changed files with 71 additions and 5 deletions

View File

@@ -2600,8 +2600,20 @@ bool ConstraintSystem::repairFailures(
elt.castTo<LocatorPathElt::ApplyArgToParam>().getParamIdx() == 1)
break;
conversionsOrFixes.push_back(AllowArgumentMismatch::create(
*this, lhs, rhs, getConstraintLocator(locator)));
if (auto *fix = ExplicitlyConstructRawRepresentable::attempt(
*this, lhs, rhs, locator)) {
conversionsOrFixes.push_back(fix);
break;
}
if (auto *fix = UseValueTypeOfRawRepresentative::attempt(*this, lhs, rhs,
locator)) {
conversionsOrFixes.push_back(fix);
break;
}
conversionsOrFixes.push_back(
AllowArgumentMismatch::create(*this, lhs, rhs, loc));
break;
}
@@ -7474,7 +7486,9 @@ ConstraintSystem::SolutionKind ConstraintSystem::simplifyFixConstraint(
case FixKind::AddMissingArguments:
case FixKind::SkipUnhandledConstructInFunctionBuilder:
case FixKind::UsePropertyWrapper:
case FixKind::UseWrappedValue: {
case FixKind::UseWrappedValue:
case FixKind::UseValueTypeOfRawRepresentative:
case FixKind::ExplicitlyConstructRawRepresentable: {
return recordFix(fix) ? SolutionKind::Error : SolutionKind::Solved;
}