mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-09 20:12:21 +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,15 +13905,18 @@ BfIRValue BfModule::CastToValue(BfAstNode* srcNode, BfTypedValue typedVal, BfTyp
|
||||||
else if (isConstraintCheck)
|
else if (isConstraintCheck)
|
||||||
{
|
{
|
||||||
auto result = BfTypedValue(mBfIRBuilder->GetFakeVal(), operatorConstraintReturnType);
|
auto result = BfTypedValue(mBfIRBuilder->GetFakeVal(), operatorConstraintReturnType);
|
||||||
|
if (result)
|
||||||
|
{
|
||||||
if (result.mType != toType)
|
if (result.mType != toType)
|
||||||
{
|
{
|
||||||
auto castedResult = CastToValue(srcNode, result, toType, (BfCastFlags)(castFlags | BfCastFlags_Explicit | BfCastFlags_NoConversionOperator), resultFlags);
|
auto castedResult = CastToValue(srcNode, result, toType, (BfCastFlags)(castFlags | BfCastFlags_Explicit | BfCastFlags_NoConversionOperator), resultFlags);
|
||||||
if (castedResult)
|
if (castedResult)
|
||||||
return castedResult;
|
return castedResult;
|
||||||
}
|
}
|
||||||
else if (result)
|
else
|
||||||
return result.mValue;
|
return result.mValue;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
BfTypedValue result;
|
BfTypedValue result;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue