@@ -1529,7 +1529,6 @@ Optional<BraceStmt *> TypeChecker::applyFunctionBuilderBodyTransform(
1529
1529
1530
1530
if (auto result = cs.matchFunctionBuilder (
1531
1531
func, builderType, resultContextType, resultConstraintKind,
1532
- cs.getConstraintLocator (func->getBody ()),
1533
1532
cs.getConstraintLocator (func->getBody ()))) {
1534
1533
if (result->isFailure ())
1535
1534
return nullptr ;
@@ -1583,7 +1582,7 @@ Optional<ConstraintSystem::TypeMatchResult>
1583
1582
ConstraintSystem::matchFunctionBuilder (
1584
1583
AnyFunctionRef fn, Type builderType, Type bodyResultType,
1585
1584
ConstraintKind bodyResultConstraintKind,
1586
- ConstraintLocator *calleeLocator, ConstraintLocatorBuilder locator) {
1585
+ ConstraintLocatorBuilder locator) {
1587
1586
auto builder = builderType->getAnyNominal ();
1588
1587
assert (builder && " Bad function builder type" );
1589
1588
assert (builder->getAttrs ().hasAttribute <FunctionBuilderAttr>());
@@ -1657,8 +1656,12 @@ ConstraintSystem::matchFunctionBuilder(
1657
1656
// If builder is applied to the closure expression then
1658
1657
// `closure body` to `closure result` matching should
1659
1658
// use special locator.
1660
- if (auto *closure = fn.getAbstractClosureExpr ())
1659
+ if (auto *closure = fn.getAbstractClosureExpr ()) {
1661
1660
locator = getConstraintLocator (closure, ConstraintLocator::ClosureResult);
1661
+ } else {
1662
+ locator = getConstraintLocator (fn.getAbstractFunctionDecl (),
1663
+ ConstraintLocator::FunctionBuilderBodyResult);
1664
+ }
1662
1665
1663
1666
// Bind the body result type to the type of the transformed expression.
1664
1667
addConstraint (bodyResultConstraintKind, transformedType, bodyResultType,
0 commit comments