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:
parent
f10365c1ad
commit
37f72cd3b6
8 changed files with 217 additions and 76 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue