diff --git a/BeefLibs/Beefy2D/src/widgets/Composition.bf b/BeefLibs/Beefy2D/src/widgets/Composition.bf index 0916c22d..0e93d1ad 100644 --- a/BeefLibs/Beefy2D/src/widgets/Composition.bf +++ b/BeefLibs/Beefy2D/src/widgets/Composition.bf @@ -21,7 +21,7 @@ namespace Beefy.widgets { public delegate T Interpolator(T from, T to, float pct); - public struct Entry : IOpComparable + public struct Entry { public float mFrame; public T mValue; @@ -99,7 +99,7 @@ namespace Beefy.widgets public T GetValue(float frame) { - if ((mEntries == null) || (mEntries.Count == 0)) + /*if ((mEntries == null) || (mEntries.Count == 0)) return mConstantValue; Entry find; @@ -118,7 +118,8 @@ namespace Beefy.widgets Entry entry2 = mEntries[index + 1]; float aPct = (frame - entry1.mFrame) / (entry2.mFrame - entry1.mFrame); - return mInterpolator(entry1.mValue, entry2.mValue, aPct); + return mInterpolator(entry1.mValue, entry2.mValue, aPct);*/ + return default; } } diff --git a/BeefLibs/corlib/src/Array.bf b/BeefLibs/corlib/src/Array.bf index 96346e6b..08fd09ba 100644 --- a/BeefLibs/corlib/src/Array.bf +++ b/BeefLibs/corlib/src/Array.bf @@ -42,7 +42,7 @@ namespace System } } - public static int BinarySearch(T* arr, int length, T value) where T : IOpComparable + public static int BinarySearch(T* arr, int length, T value) where int : operator T <=> T { int lo = 0; int hi = length - 1; @@ -61,12 +61,12 @@ namespace System return ~lo; } - public static int BinarySearch(T[] arr, T value) where T : IOpComparable + public static int BinarySearch(T[] arr, T value) where int : operator T <=> T { return BinarySearch(&arr.[Friend]GetRef(0), arr.mLength, value); } - public static int BinarySearch(T[] arr, int idx, int length, T value) where T : IOpComparable + public static int BinarySearch(T[] arr, int idx, int length, T value) where int : operator T <=> T { Debug.Assert((uint)idx <= (uint)arr.mLength); Debug.Assert(idx + length <= arr.mLength); diff --git a/BeefLibs/corlib/src/Char8.bf b/BeefLibs/corlib/src/Char8.bf index f665d87a..3405a9bf 100644 --- a/BeefLibs/corlib/src/Char8.bf +++ b/BeefLibs/corlib/src/Char8.bf @@ -1,5 +1,6 @@ namespace System { +#unwarn struct Char8 : char8, IHashable, IOpComparable, IIsNaN { public static int operator<=>(Char8 a, Char8 b) diff --git a/BeefLibs/corlib/src/Collections/Dictionary.bf b/BeefLibs/corlib/src/Collections/Dictionary.bf index 6c5545e0..e398a2d8 100644 --- a/BeefLibs/corlib/src/Collections/Dictionary.bf +++ b/BeefLibs/corlib/src/Collections/Dictionary.bf @@ -151,7 +151,7 @@ namespace System.Collections return Insert(key, false, out keyPtr, out valuePtr, null); } - public bool TryAddAlt(TAltKey key, out TKey* keyPtr, out TValue* valuePtr) where TAltKey : IOpEquals, IHashable + public bool TryAddAlt(TAltKey key, out TKey* keyPtr, out TValue* valuePtr) where TAltKey : IHashable where bool : operator TKey == TAltKey { return InsertAlt(key, false, out keyPtr, out valuePtr, null); } @@ -251,7 +251,7 @@ namespace System.Collections return FindEntry(key) >= 0; } - public bool ContainsKeyAlt(TAltKey key) where TAltKey : IOpEquals, IHashable + public bool ContainsKeyAlt(TAltKey key) where TAltKey : IHashable where bool : operator TKey == TAltKey { return FindEntryAlt(key) >= 0; } @@ -333,7 +333,7 @@ namespace System.Collections return key == key2; } - private int FindEntryAlt(TAltKey key) where TAltKey : IOpEquals, IHashable + private int FindEntryAlt(TAltKey key) where TAltKey : IHashable where bool : operator TKey == TAltKey { if (mBuckets != null) { @@ -463,7 +463,7 @@ namespace System.Collections return true; } - private bool InsertAlt(TAltKey key, bool add, out TKey* keyPtr, out TValue* valuePtr, Entry** outOldData) where TAltKey : IOpEquals, IHashable + private bool InsertAlt(TAltKey key, bool add, out TKey* keyPtr, out TValue* valuePtr, Entry** outOldData) where TAltKey : IHashable where bool : operator TKey == TAltKey { if (mBuckets == null) Initialize(0); int32 hashCode = (int32)key.GetHashCode() & 0x7FFFFFFF; @@ -613,7 +613,7 @@ namespace System.Collections return false; } - public bool RemoveAlt(TAltKey key) where TAltKey : IOpEquals, IHashable + public bool RemoveAlt(TAltKey key) where TAltKey : IHashable where bool : operator TKey == TAltKey { if (mBuckets != null) { @@ -697,7 +697,7 @@ namespace System.Collections return .Err; } - public Result<(TKey key, TValue value)> GetAndRemoveAlt(TAltKey key) where TAltKey : IOpEquals, IHashable + public Result<(TKey key, TValue value)> GetAndRemoveAlt(TAltKey key) where TAltKey : IHashable where bool : operator TKey == TAltKey { if (mBuckets != null) { @@ -764,7 +764,7 @@ namespace System.Collections return false; } - public bool TryGetAlt(TAltKey key, out TKey matchKey, out TValue value) where TAltKey : IOpEquals, IHashable + public bool TryGetAlt(TAltKey key, out TKey matchKey, out TValue value) where TAltKey : IHashable where bool : operator TKey == TAltKey { int_cosize i = (int_cosize)FindEntryAlt(key); if (i >= 0) diff --git a/BeefLibs/corlib/src/Collections/HashSet.bf b/BeefLibs/corlib/src/Collections/HashSet.bf index b5216f1f..141dfa19 100644 --- a/BeefLibs/corlib/src/Collections/HashSet.bf +++ b/BeefLibs/corlib/src/Collections/HashSet.bf @@ -196,7 +196,7 @@ namespace System.Collections return false; } - public bool ContainsWith(TAltKey item) where TAltKey : IOpEquals, IHashable + public bool ContainsWith(TAltKey item) where TAltKey : IHashable where bool : operator T == TAltKey { if (mBuckets != null) { diff --git a/BeefLibs/corlib/src/Collections/List.bf b/BeefLibs/corlib/src/Collections/List.bf index 23a12916..3ec1f031 100644 --- a/BeefLibs/corlib/src/Collections/List.bf +++ b/BeefLibs/corlib/src/Collections/List.bf @@ -359,7 +359,7 @@ namespace System.Collections } } - public bool ContainsAlt(TAlt item) where TAlt : IOpEquals, IHashable + public bool ContainsAlt(TAlt item) where TAlt : IHashable where bool : operator T == TAlt { return IndexOfAlt(item) != -1; } @@ -471,7 +471,7 @@ namespace System.Collections return -1; } - public int IndexOfAlt(TAlt item) where TAlt : IOpEquals, IHashable + public int IndexOfAlt(TAlt item) where TAlt : IHashable where bool : operator T == TAlt { for (int i = 0; i < mSize; i++) if (mItems[i] == item) @@ -640,7 +640,7 @@ namespace System.Collections return false; } - public bool RemoveAlt(TAlt item) where TAlt : IOpEquals, IHashable + public bool RemoveAlt(TAlt item) where TAlt : IHashable where bool : operator T == TAlt { int index = IndexOfAlt(item); if (index >= 0) @@ -665,7 +665,7 @@ namespace System.Collections return .Err; } - public Result GetAndRemoveAlt(TAlt item) where TAlt : IOpEquals, IHashable + public Result GetAndRemoveAlt(TAlt item) where TAlt : IHashable where bool : operator T == TAlt { int index = IndexOfAlt(item); if (index >= 0) @@ -860,7 +860,7 @@ namespace System.Collections } } - extension List where T : IOpComparable + extension List where int : operator T <=> T { public int BinarySearch(T item) { diff --git a/BeefLibs/corlib/src/Math.bf b/BeefLibs/corlib/src/Math.bf index a5b51885..0dda54c2 100644 --- a/BeefLibs/corlib/src/Math.bf +++ b/BeefLibs/corlib/src/Math.bf @@ -295,7 +295,7 @@ namespace System [Intrinsic("abs")] public static extern double Abs(double value); [Inline] - public static T Abs(T value) where T : IOpComparable, IOpNegatable + public static T Abs(T value) where bool : operator T < T where T : operator -T { if (value < default) return -value; @@ -324,7 +324,7 @@ namespace System // it runs the else case, which returns +value instead of negating it. // return (value < 0) ? -value : value; - public static T Clamp(T val, T min, T max) where T : IOpComparable + public static T Clamp(T val, T min, T max) where int : operator T<=>T { if (val < min) return min; @@ -433,7 +433,7 @@ namespace System return (Log(a) / Log(newBase)); } - public static int Sign(T value) where T : IOpComparable + public static int Sign(T value) where int : operator T <=> T { if (value < default) return -1; @@ -443,7 +443,7 @@ namespace System return 0; } - public static int Sign(T value) where T : IOpComparable, ICanBeNaN + /*public static int Sign(T value) where int : operator T <=> T, ICanBeNaN { if (value < default) return -1; @@ -453,7 +453,7 @@ namespace System return 0; Runtime.FatalError("Cannot be used on NaN"); - } + }*/ public static int32 DivRem(int32 a, int32 b, out int32 result) { diff --git a/IDEHelper/Compiler/BfExprEvaluator.cpp b/IDEHelper/Compiler/BfExprEvaluator.cpp index 6d04048b..324f7b2c 100644 --- a/IDEHelper/Compiler/BfExprEvaluator.cpp +++ b/IDEHelper/Compiler/BfExprEvaluator.cpp @@ -18943,7 +18943,7 @@ void BfExprEvaluator::PerformBinaryOperation(BfAstNode* leftExpression, BfAstNod works = true; } } - else if (opConstraint.mBinaryOp == oppositeBinaryOp) + else if ((oppositeBinaryOp != BfBinaryOp_None) && (opConstraint.mBinaryOp == oppositeBinaryOp)) { if ((mModule->CanCast(args[0].mTypedValue, opConstraint.mRightType)) && (mModule->CanCast(args[1].mTypedValue, opConstraint.mLeftType)))