Skip to content

Commit af82e6f

Browse files
committed
[TypeChecker] Use special locator while matching function builder body to closure result type
1 parent cf2cad0 commit af82e6f

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/Sema/BuilderTransform.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -709,6 +709,12 @@ ConstraintSystem::TypeMatchResult ConstraintSystem::matchFunctionBuilder(
709709
fn,
710710
AppliedBuilderTransform{builderType, singleExpr, bodyResultType}));
711711

712+
// If builder is applied to the closure expression then
713+
// `closure body` to `closure result` matching should
714+
// use special locator.
715+
if (auto *closure = fn.getAbstractClosureExpr())
716+
locator = getConstraintLocator(closure, ConstraintLocator::ClosureResult);
717+
712718
// Bind the body result type to the type of the transformed expression.
713719
addConstraint(bodyResultConstraintKind, transformedType, bodyResultType,
714720
locator);

0 commit comments

Comments
 (0)