Skip to content

Commit a368f02

Browse files
ahoppenxedin
authored andcommitted
[TypeChecker] Use the brace statement as the start location of a buildLimitedAvailability call
Otherwise, the call to buildLimitedAvailability has a bigger source range than the brace statement that surrounds it, causing a verification failure.
1 parent a59b8be commit a368f02

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/Sema/BuilderTransform.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1370,9 +1370,9 @@ class ResultBuilderTransform
13701370
auto *elseVarRef =
13711371
builder.buildVarRef(elseVar.get(), elseBraceStmt->getEndLoc());
13721372

1373-
auto *builderCall = buildCallIfWanted(
1374-
ifStmt->getThenStmt()->getEndLoc(),
1375-
ctx.Id_buildLimitedAvailability, {elseVarRef}, {Identifier()});
1373+
auto *builderCall = buildCallIfWanted(elseBraceStmt->getStartLoc(),
1374+
ctx.Id_buildLimitedAvailability,
1375+
{elseVarRef}, {Identifier()});
13761376

13771377
elseVar = captureExpr(builderCall, elseBody);
13781378
}

0 commit comments

Comments
 (0)