1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-17 23:56:05 +02:00

Fixed operator constraint checking with generic operators

This commit is contained in:
Brian Fiete 2021-01-20 11:23:28 -08:00
parent 48f2ec42f5
commit d0cfb37309
2 changed files with 56 additions and 13 deletions

View file

@ -59,6 +59,11 @@ namespace Tests
Test.Assert(i == 100);
}
public static T DoAdd<T>(T lhs, T rhs) where T : operator T + T
{
return lhs + rhs;
}
[Test]
public static void TestOperators()
{
@ -84,6 +89,9 @@ namespace Tests
Test.Assert(iNull == 100);
Test.Assert(iNull != 99);
Test.Assert(!(iNull != 100));
Test.Assert(DoAdd(iNull, iNull) == 200);
Test.Assert(DoAdd(iNull, null) == null);
}
}
}