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

Fixed explicit boxing of generic param

This commit is contained in:
Brian Fiete 2022-02-12 13:18:33 -05:00
parent b7e5d3fda5
commit d9ba98486e

View file

@ -15139,6 +15139,7 @@ void BfExprEvaluator::Visit(BfBoxExpression* boxExpr)
{
bool doFail = false;
bool doWarn = false;
BfType* boxedType = NULL;
if (exprValue.mType->IsGenericParam())
{
@ -15152,6 +15153,8 @@ void BfExprEvaluator::Visit(BfBoxExpression* boxExpr)
if ((genericParamInstance->mTypeConstraint != NULL) && (genericParamInstance->mTypeConstraint->IsObjectOrInterface()))
doWarn = true;
boxedType = mModule->mContext->mBfObjectType;
}
else
{
@ -15172,7 +15175,8 @@ void BfExprEvaluator::Visit(BfBoxExpression* boxExpr)
return;
}
BfType* boxedType = mModule->CreateBoxedType(exprValue.mType);
if (boxedType == NULL)
boxedType = mModule->CreateBoxedType(exprValue.mType);
if (boxedType == NULL)
boxedType = mModule->mContext->mBfObjectType;
mResult = mModule->BoxValue(boxExpr->mExpression, exprValue, boxedType, allocTarget);