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:
parent
edb77bcf63
commit
afda8d91c5
1 changed files with 9 additions and 6 deletions
|
@ -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
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue