[Property Wrappers] Add a constraint fix and diagnostic for the case

where the programmer tries to pass a projection argument to a wrapped
parameter without 'var projectedValue'.
This commit is contained in:
Holly Borla
2021-01-27 16:04:08 -08:00
parent a4e39688f0
commit ea3fe03c98
8 changed files with 84 additions and 4 deletions

View File

@@ -1422,8 +1422,10 @@ ConstraintSystem::TypeMatchResult constraints::matchCallArguments(
if (auto *param = paramInfo.getPropertyWrapperParam(argIdx)) {
auto argLabel = argInfo->Labels[argIdx];
cs.applyPropertyWrapperParameter(paramTy, argTy, const_cast<ParamDecl *>(param),
argLabel, subKind, locator);
if (cs.applyPropertyWrapperParameter(paramTy, argTy, const_cast<ParamDecl *>(param),
argLabel, subKind, locator).isFailure()) {
return cs.getTypeMatchFailure(loc);
}
continue;
}
@@ -10662,6 +10664,7 @@ ConstraintSystem::SolutionKind ConstraintSystem::simplifyFixConstraint(
case FixKind::SkipUnhandledConstructInResultBuilder:
case FixKind::UsePropertyWrapper:
case FixKind::UseWrappedValue:
case FixKind::AddProjectedValue:
case FixKind::ExpandArrayIntoVarargs:
case FixKind::UseRawValue:
case FixKind::ExplicitlyConstructRawRepresentable: