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

Equality fix

This commit is contained in:
Brian Fiete 2020-09-17 05:21:38 -07:00
parent 8fe9843441
commit 74bbdbadbf

View file

@ -4189,12 +4189,6 @@ void BfModule::CreateValueTypeEqualsMethod(bool strictEquals)
return; return;
auto boolType = GetPrimitiveType(BfTypeCode_Boolean); auto boolType = GetPrimitiveType(BfTypeCode_Boolean);
if (mCurTypeInstance->IsValuelessType())
{
mBfIRBuilder->CreateRet(GetDefaultValue(boolType));
return;
}
if (mCurTypeInstance->IsTypedPrimitive()) if (mCurTypeInstance->IsTypedPrimitive())
{ {
BfExprEvaluator exprEvaluator(this); BfExprEvaluator exprEvaluator(this);
@ -4210,6 +4204,12 @@ void BfModule::CreateValueTypeEqualsMethod(bool strictEquals)
auto compareType = mCurMethodInstance->mParams[0].mResolvedType; auto compareType = mCurMethodInstance->mParams[0].mResolvedType;
bool isValid = true; bool isValid = true;
if (compareType->IsValuelessType())
{
mBfIRBuilder->CreateRet(GetDefaultValue(boolType));
return;
}
auto compareDType = compareType->ToDependedType(); auto compareDType = compareType->ToDependedType();
BfTypeInstance* compareTypeInst = compareType->ToTypeInstance(); BfTypeInstance* compareTypeInst = compareType->ToTypeInstance();
if (compareTypeInst != NULL) if (compareTypeInst != NULL)