1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-08 11:38:21 +02:00

Improved pointer generic constraints

This commit is contained in:
Brian Fiete 2025-03-21 11:37:26 -04:00
parent 0bdaa03545
commit 195463cb77
3 changed files with 27 additions and 9 deletions

View file

@ -23498,6 +23498,15 @@ void BfExprEvaluator::PerformUnaryOperation_OnResult(BfExpression* unaryOpExpr,
case BfUnaryOp_Dereference:
{
CheckResultForReading(mResult);
if (mResult.mType->IsGenericParam())
{
auto genericParamInstance = mModule->GetGenericParamInstance((BfGenericParamType*)mResult.mType);
if ((genericParamInstance->mTypeConstraint != NULL) && (genericParamInstance->mTypeConstraint->IsPointer()))
{
mResult = mModule->GetDefaultTypedValue(genericParamInstance->mTypeConstraint->GetUnderlyingType(), false, BfDefaultValueKind_Addr);
break;
}
}
if (!mResult.mType->IsPointer())
{
mResult = BfTypedValue();