1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-08 11:38:21 +02:00

Fixed generic operator overload method generic arg inference from toType

This commit is contained in:
Brian Fiete 2022-01-21 12:01:50 -05:00
parent 0de32f7b34
commit dd2ecfb316
4 changed files with 38 additions and 18 deletions

View file

@ -12805,7 +12805,11 @@ BfIRValue BfModule::CastToValue(BfAstNode* srcNode, BfTypedValue typedVal, BfTyp
if ((explicitCast) && (typedVal.mType->IsTypedPrimitive()))
{
auto underlyingType = typedVal.mType->GetUnderlyingType();
if ((returnType != underlyingType) && (CanCast(GetFakeTypedValue(underlyingType), toType, (BfCastFlags)(castFlags | BfCastFlags_NoConversionOperator))))
if ((returnType == underlyingType) && (explicitCast))
{
doCall = false;
}
else if ((CanCast(GetFakeTypedValue(underlyingType), toType, (BfCastFlags)(castFlags | BfCastFlags_NoConversionOperator))))
{
float underlyingCanCast = CanCast(GetFakeTypedValue(underlyingType), toType, implicitCastFlags);
float returnCanCast = CanCast(GetFakeTypedValue(returnType), toType, implicitCastFlags);
@ -12834,8 +12838,11 @@ BfIRValue BfModule::CastToValue(BfAstNode* srcNode, BfTypedValue typedVal, BfTyp
if ((explicitCast) && (toType->IsTypedPrimitive()))
{
auto underlyingType = toType->GetUnderlyingType();
if ((paramType != underlyingType) &&
(CanCast(typedVal, underlyingType, (BfCastFlags)(castFlags | BfCastFlags_NoConversionOperator))))
if ((paramType == underlyingType) && (explicitCast))
{
doCall = false;
}
else if (CanCast(typedVal, underlyingType, (BfCastFlags)(castFlags | BfCastFlags_NoConversionOperator)))
{
float underlyingCanCast = CanCast(typedVal, underlyingType, implicitCastFlags);
float paramCanCast = CanCast(typedVal, paramType, implicitCastFlags);