Skip to content

Commit 91152d3

Browse files
committed
Add additional tests to delegate call data flow
1 parent 191962f commit 91152d3

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

csharp/ql/test/library-tests/dataflow/delegates/DelegateFlow.cs

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ class DelegateFlow
44
{
55
void M1(int i) { }
66

7-
void M2(Action<int> a)
7+
static void M2(Action<int> a)
88
{
99
a(0);
1010
a = _ => { };
11-
a(0);
11+
a(1);
1212
}
1313

1414
void M3()
@@ -108,4 +108,20 @@ public void M15()
108108
}
109109

110110
public delegate void MyDelegate();
111+
112+
public unsafe void M16(delegate*<Action<int>, void> fnptr, Action<int> a)
113+
{
114+
fnptr(a);
115+
}
116+
117+
public unsafe void M17()
118+
{
119+
M16(&M2, (i) => {}); // MISSING: a(0) in M2 is calling this lambda
120+
}
121+
122+
public unsafe void M18()
123+
{
124+
delegate*<Action<int>, void> fnptr = &M2;
125+
fnptr((i) => {}); // MISSING: a(0) in M2 is calling this lambda
126+
}
111127
}

0 commit comments

Comments
 (0)