1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-09 03:52:19 +02:00

Constraint check fixes

This commit is contained in:
Brian Fiete 2022-01-18 06:44:08 -05:00
parent b2eac81857
commit bac91516e7
3 changed files with 38 additions and 11 deletions

View file

@ -10600,18 +10600,23 @@ BfType* BfModule::CheckOperator(BfTypeInstance* typeInstance, BfOperatorDef* ope
return NULL;
if (operatorInfo->mReturnType == NULL)
return NULL;
auto castFlags = BfCastFlags_IsConstraintCheck;
if (operatorDef->mOperatorDeclaration->mIsConvOperator)
castFlags = (BfCastFlags)(castFlags | BfCastFlags_NoConversionOperator);
if (lhs)
{
if (operatorInfo->mLHSType == NULL)
return NULL;
if (!CanCast(lhs, operatorInfo->mLHSType, BfCastFlags_IsConstraintCheck))
return NULL;
if (!CanCast(lhs, operatorInfo->mLHSType, castFlags))
return NULL;
}
if (rhs)
{
if (operatorInfo->mRHSType == NULL)
return NULL;
if (!CanCast(rhs, operatorInfo->mRHSType, BfCastFlags_IsConstraintCheck))
if (!CanCast(rhs, operatorInfo->mRHSType, castFlags))
return NULL;
}
return operatorInfo->mReturnType;