Skip to content

Commit

Permalink
Improve comments, adjust return type to something more appropriate
Browse files Browse the repository at this point in the history
Signed-off-by: Ben Harshbarger <[email protected]>
  • Loading branch information
benharsh committed Jan 31, 2025
1 parent b5030fd commit fcfa248
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 2 additions & 1 deletion frontend/lib/resolution/resolution-queries.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4033,7 +4033,8 @@ static bool resolveFnCallSpecial(Context* context,
exprTypeOut = QualifiedType::makeParamString(context, oss.str());
return true;
} else if (srcTy->isClassType() && dstTy->isClassType()) {
// cast (borrowed class) : unmanaged
// cast (borrowed class) : unmanaged,
// and (unmanaged class) : borrowed
auto srcClass = srcTy->toClassType();
auto dstClass = dstTy->toClassType();
bool isValidDst = dstClass->manageableType()->isAnyClassType() &&
Expand Down
5 changes: 4 additions & 1 deletion frontend/lib/resolution/return-type-inference.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1304,7 +1304,10 @@ static bool helpComputeReturnType(ResolutionContext* rc,
result = QualifiedType(QualifiedType::CONST_VAR, VoidType::get(context));
return true;
} else {
result = QualifiedType(QualifiedType::CONST_VAR, ErroneousType::get(context));
// TODO: This is a workaround for a bug where the return type was
// not found for some reason. By returning a type we prevent an attempt
// to resolve the non-existent function body.
result = QualifiedType(QualifiedType::CONST_VAR, UnknownType::get(context));
return true;
}
} else if (fnAstReturnsNonVoid(context, ast->id()) == false) {
Expand Down

0 comments on commit fcfa248

Please sign in to comment.