1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-16 15:24:10 +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 doFail = false;
bool doWarn = false; bool doWarn = false;
BfType* boxedType = NULL;
if (exprValue.mType->IsGenericParam()) if (exprValue.mType->IsGenericParam())
{ {
@ -15152,6 +15153,8 @@ void BfExprEvaluator::Visit(BfBoxExpression* boxExpr)
if ((genericParamInstance->mTypeConstraint != NULL) && (genericParamInstance->mTypeConstraint->IsObjectOrInterface())) if ((genericParamInstance->mTypeConstraint != NULL) && (genericParamInstance->mTypeConstraint->IsObjectOrInterface()))
doWarn = true; doWarn = true;
boxedType = mModule->mContext->mBfObjectType;
} }
else else
{ {
@ -15172,7 +15175,8 @@ void BfExprEvaluator::Visit(BfBoxExpression* boxExpr)
return; return;
} }
BfType* boxedType = mModule->CreateBoxedType(exprValue.mType); if (boxedType == NULL)
boxedType = mModule->CreateBoxedType(exprValue.mType);
if (boxedType == NULL) if (boxedType == NULL)
boxedType = mModule->mContext->mBfObjectType; boxedType = mModule->mContext->mBfObjectType;
mResult = mModule->BoxValue(boxExpr->mExpression, exprValue, boxedType, allocTarget); mResult = mModule->BoxValue(boxExpr->mExpression, exprValue, boxedType, allocTarget);