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

Added constraint test for casting

This commit is contained in:
Brian Fiete 2020-09-19 06:41:36 -07:00
parent 93f5890d6d
commit e4892af4c9
3 changed files with 95 additions and 62 deletions

View file

@ -9685,17 +9685,15 @@ BfType* BfModule::CheckOperator(BfTypeInstance* typeInstance, BfOperatorDef* ope
if (lhs)
{
if (operatorInfo->mLHSType == NULL)
return NULL;
// TODO: Make this be a special flag to do CheckOperator conversion checks?
if (!CanCast(lhs, operatorInfo->mLHSType, BfCastFlags_NoConversionOperator))
return NULL;
if (!CanCast(lhs, operatorInfo->mLHSType, BfCastFlags_IsConstraintCheck))
return NULL;
}
if (rhs)
{
if (operatorInfo->mRHSType == NULL)
return NULL;
// TODO: Make this be a special flag to do CheckOperator conversion checks?
if (!CanCast(rhs, operatorInfo->mRHSType, BfCastFlags_NoConversionOperator))
return NULL;
if (!CanCast(rhs, operatorInfo->mRHSType, BfCastFlags_IsConstraintCheck))
return NULL;
}
return operatorInfo->mReturnType;