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

Added ability to dynamically cast delegates with compatible signatures

This commit is contained in:
Brian Fiete 2025-03-22 15:34:59 -04:00
parent f10365c1ad
commit 37f72cd3b6
8 changed files with 217 additions and 76 deletions

View file

@ -232,9 +232,16 @@ namespace Tests
public static void TestCasting()
{
delegate int(int, int) dlg0 = null;
delegate int(int, int) dlg0 = scope (a, b) => 1;
delegate int(int a, int b) dlg1 = dlg0;
delegate int(int a2, int b2) dlg2 = (.)dlg1;
delegate int(float a, float b) dlg3 = scope (a, b) => 2;
Object obj = dlg0;
dlg1 = (.)obj;
dlg2 = (.)obj;
Test.Assert(obj is delegate int(int a, int b));
Test.Assert(!(obj is delegate int(float a, float b)));
function int(int, int) func0 = null;
function int(int a, int b) func1 = func0;