diff --git a/IDEHelper/Compiler/BfExprEvaluator.cpp b/IDEHelper/Compiler/BfExprEvaluator.cpp index 9ac785f7..5906ab3d 100644 --- a/IDEHelper/Compiler/BfExprEvaluator.cpp +++ b/IDEHelper/Compiler/BfExprEvaluator.cpp @@ -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; diff --git a/IDEHelper/Tests/src/Operators.bf b/IDEHelper/Tests/src/Operators.bf index 44251b1b..cd50e1b2 100644 --- a/IDEHelper/Tests/src/Operators.bf +++ b/IDEHelper/Tests/src/Operators.bf @@ -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 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 rsc = .Ok(.(123, 234)); + Result rsc2 = .Ok(.(123, 345)); + Test.Assert(rsc == rsc2); + Test.Assert(rsc !== rsc2); + /*let oai = OuterOp.InnerOp.Op(1.0f, 100); Test.Assert(oai == 101.0f);