1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-08 19:48:20 +02:00

Improved constraint cast check

This commit is contained in:
Brian Fiete 2022-06-27 13:23:34 -07:00
parent edb77bcf63
commit afda8d91c5

View file

@ -13905,14 +13905,17 @@ BfIRValue BfModule::CastToValue(BfAstNode* srcNode, BfTypedValue typedVal, BfTyp
else if (isConstraintCheck)
{
auto result = BfTypedValue(mBfIRBuilder->GetFakeVal(), operatorConstraintReturnType);
if (result.mType != toType)
if (result)
{
auto castedResult = CastToValue(srcNode, result, toType, (BfCastFlags)(castFlags | BfCastFlags_Explicit | BfCastFlags_NoConversionOperator), resultFlags);
if (castedResult)
return castedResult;
if (result.mType != toType)
{
auto castedResult = CastToValue(srcNode, result, toType, (BfCastFlags)(castFlags | BfCastFlags_Explicit | BfCastFlags_NoConversionOperator), resultFlags);
if (castedResult)
return castedResult;
}
else
return result.mValue;
}
else if (result)
return result.mValue;
}
else
{