Skip to content

Commit

Permalink
Respond to reviewer feedback
Browse files Browse the repository at this point in the history
Signed-off-by: Danila Fedorin <[email protected]>
  • Loading branch information
DanilaFe committed Jan 24, 2025
1 parent 1f8aab5 commit cccd2fe
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 9 deletions.
1 change: 1 addition & 0 deletions frontend/include/chpl/framework/all-global-strings.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ X(borrow , "borrow")
X(borrowed , "borrowed")
X(buildTuple , "_build_tuple")
X(buildTupleNoref , "_build_tuple_noref")
X(buildTupleAlwaysRef , "_build_tuple_always_allow_ref")
X(by , "by")
X(bytes , "bytes")
X(coforall , "coforall")
Expand Down
11 changes: 7 additions & 4 deletions frontend/lib/resolution/InitResolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -382,9 +382,12 @@ static const ArrayType* arrayTypeFromSubsHelper(
if (!instanceBct || !baseArr) return genericArray;

if (baseArr->id().symbolPath() == "ChapelDistribution.BaseRectangularArr") {
// Note: the ArrayType predates our '_instance-aware' code (developed
// by Anna and currently at work in Domains). For now, just use the
// "old" style containing a domain type and element type to instantiate the array.
// TODO: the ArrayType predates our '_instance-aware' code (developed
// by Anna and currently at work in Domains). For now, just use the
// "old" style containing a domain type and element type to instantiate
// the array.
//
// Anna is planning on tackling this in future work.

auto baseArrRect = baseArr->parentClassType();
CHPL_ASSERT(baseArrRect && baseArrRect->id().symbolPath() == "ChapelDistribution.BaseArrOverRectangularDom");
Expand All @@ -400,7 +403,7 @@ static const ArrayType* arrayTypeFromSubsHelper(
eltType);
}

// If we reach here, we weren't able to resolve the domain type
// If we reach here, we weren't able to resolve the array type
return genericArray;
}

Expand Down
3 changes: 2 additions & 1 deletion frontend/lib/resolution/call-init-deinit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -832,7 +832,8 @@ void CallInitDeinit::handleDeclaration(const VarLikeDecl* ast, RV& rv) {
frame->addToInitedVars(id);
frame->localsAndDefers.push_back(id);
} else if (isCatchVariable || isRefLoopIntent) {
// initialized from the throw that activates this Catch
// initialized from the throw that activates this Catch, or implicitly with
// a reference to a variable in outer scope.
ID id = ast->id();
frame->addToInitedVars(id);
frame->localsAndDefers.push_back(id);
Expand Down
2 changes: 1 addition & 1 deletion frontend/lib/resolution/default-functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1068,7 +1068,7 @@ generateIteratorMethod(Context* context,
nullptr));
formalTypes.push_back(QualifiedType(QualifiedType::CONST_REF, it));

// It's a little scary to compue the ID for the function in this way
// It's a little scary to compute the ID for the function in this way
// here because for the FnIterator and PromotionIterator cases, it will
// conflict with the underlying function. Maybe that's okay?
ID id;
Expand Down
8 changes: 5 additions & 3 deletions frontend/lib/resolution/resolution-queries.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4118,8 +4118,11 @@ static bool resolveFnCallSpecial(Context* context,
// between 'ref' and non-'ref' type formals. Moreover, this function is
// filled in by the compiler in production.
if (!ci.isMethodCall() && (ci.name() == USTR("_build_tuple") ||
ci.name() == USTR("_build_tuple_noref"))) {
ci.name() == USTR("_build_tuple_noref") ||
ci.name() == USTR("_build_tuple_always_allow_ref"))) {
bool removeRefs = ci.name() == USTR("_build_tuple_noref");
auto intent = ci.name() == USTR("_build_tuple_always_allow_ref") ?
QualifiedType::CONST_VAR : QualifiedType::TYPE;
std::vector<QualifiedType> components;
for (size_t i = 0; i < ci.numActuals(); i++) {
auto actual = ci.actual(i).type();
Expand All @@ -4131,7 +4134,7 @@ static bool resolveFnCallSpecial(Context* context,
}

auto resultTuple = TupleType::getQualifiedTuple(context, components);
exprTypeOut = QualifiedType(QualifiedType::TYPE, resultTuple);
exprTypeOut = QualifiedType(intent, resultTuple);
return true;
}

Expand Down Expand Up @@ -6769,7 +6772,6 @@ shapeForIteratorQuery(Context* context,
break;
}
}
CHPL_ASSERT(!leaderType.isUnknownOrErroneous());
}

CHPL_ASSERT(!leaderType.isUnknownOrErroneous());
Expand Down

0 comments on commit cccd2fe

Please sign in to comment.