1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-10 12:32:20 +02:00

No error on return type mismatch on NoReturn expression-bodied calls

This commit is contained in:
Brian Fiete 2022-04-19 08:26:52 -07:00
parent 2de490fd59
commit 3ef627e3e2
3 changed files with 8 additions and 1 deletions

View file

@ -8149,6 +8149,12 @@ BfTypedValue BfExprEvaluator::CreateCall(BfAstNode* targetSrc, const BfTypedValu
auto func = moduleMethodInstance.mFunc;
BfTypedValue callResult = CreateCall(targetSrc, methodInstance, func, bypassVirtual, irArgs, NULL, physCallFlags);
if ((methodInstance->mMethodDef->mIsNoReturn) && ((mBfEvalExprFlags & BfEvalExprFlags_IsExpressionBody) != 0) &&
(mExpectingType != NULL) && (callResult.mType != mExpectingType))
{
callResult = mModule->GetDefaultTypedValue(mExpectingType);
}
// This gets triggered for non-sret (ie: comptime) composite returns so they aren't considered readonly
if ((callResult.mKind == BfTypedValueKind_Value) && (!callResult.mValue.IsConst()) &&
(!callResult.mType->IsValuelessType()) && (callResult.mType->IsComposite()) && (!methodInstance->GetLoweredReturnType()))