Skip to content

Commit

Permalink
replace conditional with assert, ensure alignment of actuals and ci.n…
Browse files Browse the repository at this point in the history
…umactuals

Signed-off-by: Ahmad Rezaii <[email protected]>
  • Loading branch information
arezaii committed Jan 28, 2025
1 parent a2bcbff commit 37ef570
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions frontend/lib/resolution/Resolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1010,9 +1010,8 @@ handleRejectedCandidates(Context* context,
const uast::AstNode *actualExpr = nullptr;
const uast::VarLikeDecl *actualDecl = nullptr;
size_t actualIdx = badPass.actualIdx();
if (0 <= actualIdx && actualIdx < actualAsts.size()) {
actualExpr = actualAsts[badPass.actualIdx()];
}
CHPL_ASSERT(0 <= actualIdx && actualIdx < actualAsts.size());
actualExpr = actualAsts[badPass.actualIdx()];

// look for a definition point of the actual for error reporting of
// uninitialized vars typically in the case of bad split-initialization
Expand Down Expand Up @@ -2445,7 +2444,7 @@ bool Resolver::resolveSpecialNewCall(const Call* call) {
// Prepare receiver.
auto receiverInfo = CallInfoActual(calledType, USTR("this"));
actuals.push_back(std::move(receiverInfo));

actualAsts.push_back(newExpr->typeExpression());
// Remaining actuals.
prepareCallInfoActuals(call, actuals, questionArg, &actualAsts);
CHPL_ASSERT(!questionArg);
Expand All @@ -2455,6 +2454,7 @@ bool Resolver::resolveSpecialNewCall(const Call* call) {
/* hasQuestionArg */ questionArg != nullptr,
/* isParenless */ false,
std::move(actuals));
CHPL_ASSERT(actualAsts.size() == (size_t)ci.numActuals());
auto inScope = scopeStack.back();
auto inPoiScope = poiScope;
auto inScopes = CallScopeInfo::forNormalCall(inScope, inPoiScope);
Expand Down

0 comments on commit 37ef570

Please sign in to comment.