@@ -1529,7 +1529,6 @@ Optional<BraceStmt *> TypeChecker::applyFunctionBuilderBodyTransform(
15291529
15301530 if (auto result = cs.matchFunctionBuilder (
15311531 func, builderType, resultContextType, resultConstraintKind,
1532- cs.getConstraintLocator (func->getBody ()),
15331532 cs.getConstraintLocator (func->getBody ()))) {
15341533 if (result->isFailure ())
15351534 return nullptr ;
@@ -1583,7 +1582,7 @@ Optional<ConstraintSystem::TypeMatchResult>
15831582ConstraintSystem::matchFunctionBuilder (
15841583 AnyFunctionRef fn, Type builderType, Type bodyResultType,
15851584 ConstraintKind bodyResultConstraintKind,
1586- ConstraintLocator *calleeLocator, ConstraintLocatorBuilder locator) {
1585+ ConstraintLocatorBuilder locator) {
15871586 auto builder = builderType->getAnyNominal ();
15881587 assert (builder && " Bad function builder type" );
15891588 assert (builder->getAttrs ().hasAttribute <FunctionBuilderAttr>());
@@ -1657,8 +1656,12 @@ ConstraintSystem::matchFunctionBuilder(
16571656 // If builder is applied to the closure expression then
16581657 // `closure body` to `closure result` matching should
16591658 // use special locator.
1660- if (auto *closure = fn.getAbstractClosureExpr ())
1659+ if (auto *closure = fn.getAbstractClosureExpr ()) {
16611660 locator = getConstraintLocator (closure, ConstraintLocator::ClosureResult);
1661+ } else {
1662+ locator = getConstraintLocator (fn.getAbstractFunctionDecl (),
1663+ ConstraintLocator::FunctionBuilderBodyResult);
1664+ }
16621665
16631666 // Bind the body result type to the type of the transformed expression.
16641667 addConstraint (bodyResultConstraintKind, transformedType, bodyResultType,
0 commit comments