From 37ef570709997c07e21eb5e55ae228bdaa139dd4 Mon Sep 17 00:00:00 2001 From: Ahmad Rezaii <ahmad.rezaii@hpe.com> Date: Tue, 28 Jan 2025 15:18:15 -0700 Subject: [PATCH] replace conditional with assert, ensure alignment of actuals and ci.numactuals Signed-off-by: Ahmad Rezaii <ahmad.rezaii@hpe.com> --- frontend/lib/resolution/Resolver.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/frontend/lib/resolution/Resolver.cpp b/frontend/lib/resolution/Resolver.cpp index 9eb7eba3abba..e7120336fc5f 100644 --- a/frontend/lib/resolution/Resolver.cpp +++ b/frontend/lib/resolution/Resolver.cpp @@ -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 @@ -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); @@ -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);