[CSSimplify] Fix external property wrapper check to use parameter index

Both `ParameterListInfo` and `getParameterAt` expect parameter index
because they operate on a declaration referenced by a call.
This commit is contained in:
Pavel Yaskevich
2023-04-05 15:53:06 -07:00
parent 756fe15bdd
commit 0b41ea84b9
2 changed files with 19 additions and 4 deletions

View File

@@ -1912,11 +1912,14 @@ static ConstraintSystem::TypeMatchResult matchCallArguments(
}
auto argLabel = argument.getLabel();
if (paramInfo.hasExternalPropertyWrapper(argIdx) || argLabel.hasDollarPrefix()) {
auto *param = getParameterAt(callee, argIdx);
if (paramInfo.hasExternalPropertyWrapper(paramIdx) ||
argLabel.hasDollarPrefix()) {
auto *param = getParameterAt(callee, paramIdx);
assert(param);
if (cs.applyPropertyWrapperToParameter(paramTy, argTy, const_cast<ParamDecl *>(param),
argLabel, subKind, loc).isFailure()) {
if (cs.applyPropertyWrapperToParameter(paramTy, argTy,
const_cast<ParamDecl *>(param),
argLabel, subKind, loc)
.isFailure()) {
return cs.getTypeMatchFailure(loc);
}
continue;