Skip to content

Commit

Permalink
Fixed nullable comparisons
Browse files Browse the repository at this point in the history
  • Loading branch information
bfiete committed Jun 25, 2020
1 parent fd1883f commit 9ea5b72
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions BeefLibs/corlib/src/Nullable.bf
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ namespace System
public static bool operator==<TOther>(TOther lhs, Nullable<T> rhs) where bool : operator TOther == T
{
if (!rhs.mHasValue) return false;
return lhs == rhs;
return lhs == rhs.mValue;
}

public static bool operator==<TOther>(Nullable<T> lhs, Nullable<TOther> rhs) where bool : operator T == TOther where TOther : struct
Expand All @@ -128,7 +128,7 @@ namespace System
public static bool operator!=<TOther>(TOther lhs, Nullable<T> rhs) where bool : operator TOther != T
{
if (!rhs.mHasValue) return true;
return lhs != rhs;
return lhs != rhs.mValue;
}

public static bool operator!=<TOther>(Nullable<T> lhs, Nullable<TOther> rhs) where bool : operator T != TOther where TOther : struct
Expand All @@ -148,7 +148,7 @@ namespace System
public static bool operator< <TOther>(TOther lhs, Nullable<T> rhs) where bool : operator TOther < T
{
if (!rhs.mHasValue) return false;
return lhs < rhs;
return lhs < rhs.mValue;
}

public static bool operator< <TOther>(Nullable<T> lhs, Nullable<TOther> rhs) where bool : operator T < TOther where TOther : struct
Expand All @@ -168,7 +168,7 @@ namespace System
public static bool operator<=<TOther>(TOther lhs, Nullable<T> rhs) where bool : operator TOther <= T
{
if (!rhs.mHasValue) return false;
return lhs <= rhs;
return lhs <= rhs.mValue;
}

public static bool operator<=<TOther>(Nullable<T> lhs, Nullable<TOther> rhs) where bool : operator T <= TOther where TOther : struct
Expand All @@ -188,7 +188,7 @@ namespace System
public static bool operator><TOther>(TOther lhs, Nullable<T> rhs) where bool : operator TOther > T
{
if (!rhs.mHasValue) return false;
return lhs > rhs;
return lhs > rhs.mValue;
}

public static bool operator><TOther>(Nullable<T> lhs, Nullable<TOther> rhs) where bool : operator T > TOther where TOther : struct
Expand All @@ -208,7 +208,7 @@ namespace System
public static bool operator>=<TOther>(TOther lhs, Nullable<T> rhs) where bool : operator TOther >= T
{
if (!rhs.mHasValue) return false;
return lhs >= rhs;
return lhs >= rhs.mValue;
}

public static bool operator>=<TOther>(Nullable<T> lhs, Nullable<TOther> rhs) where bool : operator T >= TOther where TOther : struct
Expand All @@ -226,7 +226,7 @@ namespace System

public static int operator<=><TOther>(TOther lhs, Nullable<T> rhs) where int : operator TOther <=> T
{
return lhs <=> rhs;
return lhs <=> rhs.mValue;
}

public static int operator<=><TOther>(Nullable<T> lhs, Nullable<TOther> rhs) where int : operator T <=> TOther where TOther : struct
Expand Down

0 comments on commit 9ea5b72

Please sign in to comment.