[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.
This commit is contained in:
Alex Hoppen
2022-06-20 13:08:22 +02:00
committed by Pavel Yaskevich
parent a59b8bee14
commit a368f024bb

View File

@@ -1370,9 +1370,9 @@ protected:
auto *elseVarRef =
builder.buildVarRef(elseVar.get(), elseBraceStmt->getEndLoc());
auto *builderCall = buildCallIfWanted(
ifStmt->getThenStmt()->getEndLoc(),
ctx.Id_buildLimitedAvailability, {elseVarRef}, {Identifier()});
auto *builderCall = buildCallIfWanted(elseBraceStmt->getStartLoc(),
ctx.Id_buildLimitedAvailability,
{elseVarRef}, {Identifier()});
elseVar = captureExpr(builderCall, elseBody);
}