diff --git a/lib/Sema/CSApply.cpp b/lib/Sema/CSApply.cpp index 2b08dda1cd2bb..437481c310d4a 100644 --- a/lib/Sema/CSApply.cpp +++ b/lib/Sema/CSApply.cpp @@ -5813,9 +5813,11 @@ Expr *ExprRewriter::coerceCallArguments( // - new types are propagated to constraint system auto *closureType = param.getPlainType()->castTo(); + auto argLoc = getArgLocator(argIdx, paramIdx, param.getParameterFlags()); + arg = coerceToType( arg, closureType->getResult(), - locator.withPathElement(ConstraintLocator::AutoclosureResult)); + argLoc.withPathElement(ConstraintLocator::AutoclosureResult)); if (shouldInjectWrappedValuePlaceholder) { // If init(wrappedValue:) takes an autoclosure, then we want