C#: Add a data flow test for side effects on static fields

This commit is contained in:
Tom Hvitved
2024-05-23 15:25:19 +02:00
parent a5a999f7d6
commit 29c204bc61

View File

@@ -0,0 +1,19 @@
public class K
{
static string[] Strings = new string[10];
private void M1()
{
var o = Source<string>(1);
Strings[0] = o;
}
private void M2()
{
Sink(Strings[0]); // $ MISSING: hasValueFlow=1
}
public static void Sink(object o) { }
static T Source<T>(object source) => throw null;
}