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

Fixed tuple equality check

This commit is contained in:
Brian Fiete 2020-06-18 06:33:33 -07:00
parent 229a5aa5c5
commit 78ffe6a682
2 changed files with 23 additions and 1 deletions

View file

@ -210,7 +210,7 @@ bool BfMethodMatcher::IsMemberAccessible(BfTypeInstance* typeInst, BfTypeDef* de
return false;
// This may not be completely correct - BUT if we don't have this then even Dictionary TKey's operator == won't be considered accessible
if (!mModule->IsInSpecializedSection())
if ((!mModule->IsInSpecializedSection()) && (mActiveTypeDef->mTypeDeclaration != NULL))
{
if (!typeInst->IsTypeMemberAccessible(declaringType, mActiveTypeDef))
return false;

View file

@ -37,6 +37,23 @@ namespace Tests
}
}
struct StructC
{
public int mA;
public int mB;
public this(int a, int b)
{
mA = a;
mB = b;
}
public static bool operator==(StructC lhs, StructC rhs)
{
return lhs.mA == rhs.mA;
}
}
struct StructOp<T, T2> where T : operator T + T2
{
public T DoIt(T val, T2 val2)
@ -209,6 +226,11 @@ namespace Tests
int32 res7 = sOp2.GetInt();
Test.Assert(res7 == 100);
Result<StructC> rsc = .Ok(.(123, 234));
Result<StructC> rsc2 = .Ok(.(123, 345));
Test.Assert(rsc == rsc2);
Test.Assert(rsc !== rsc2);
/*let oai = OuterOp<float>.InnerOp<int>.Op(1.0f, 100);
Test.Assert(oai == 101.0f);