Skip to content

Commit e0791bb

Browse files
committed
[CS] Fix check in applyResultBuilderBodyTransform
If `matchResultBuilder` returns `nullopt` we should be bailing, rather than continuing, which would attempt to solve with an empty constraint system.
1 parent 9312899 commit e0791bb

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

lib/Sema/BuilderTransform.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -989,11 +989,11 @@ TypeChecker::applyResultBuilderBodyTransform(FuncDecl *func, Type builderType) {
989989
// of this decl; it's not part of the interface type.
990990
builderType = func->mapTypeIntoContext(builderType);
991991

992-
if (auto result = cs.matchResultBuilder(
993-
func, builderType, resultContextType, resultConstraintKind,
994-
/*contextualType=*/Type(),
995-
cs.getConstraintLocator(func->getBody()))) {
996-
if (result->isFailure())
992+
{
993+
auto result = cs.matchResultBuilder(
994+
func, builderType, resultContextType, resultConstraintKind,
995+
/*contextualType=*/Type(), cs.getConstraintLocator(func->getBody()));
996+
if (!result || result->isFailure())
997997
return nullptr;
998998
}
999999

0 commit comments

Comments
 (0)