Skip to content

Commit 29c204b

Browse files
committed
C#: Add a data flow test for side effects on static fields
1 parent a5a999f commit 29c204b

File tree

1 file changed

+19
-0
lines changed
  • csharp/ql/test/library-tests/dataflow/fields

1 file changed

+19
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
public class K
2+
{
3+
static string[] Strings = new string[10];
4+
5+
private void M1()
6+
{
7+
var o = Source<string>(1);
8+
Strings[0] = o;
9+
}
10+
11+
private void M2()
12+
{
13+
Sink(Strings[0]); // $ MISSING: hasValueFlow=1
14+
}
15+
16+
public static void Sink(object o) { }
17+
18+
static T Source<T>(object source) => throw null;
19+
}

0 commit comments

Comments
 (0)