Skip to content

Commit d22ef44

Browse files
committed
C#: Add tests with missing flow through dynamic members.
1 parent 06b1d8e commit d22ef44

File tree

1 file changed

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

1 file changed

+31
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
using System;
2+
3+
public class L
4+
{
5+
public string f1 { get; set; }
6+
public string f2 { get; set; }
7+
public string f3 { get; set; }
8+
9+
private void M1()
10+
{
11+
// dynamic write followed by dynamic read
12+
dynamic d1 = this;
13+
d1.f1 = Source<string>(1);
14+
Sink(d1.f1); // $ MISSING: hasValueFlow=1
15+
16+
// dynamic write followed by static read
17+
dynamic d2 = this;
18+
d2.f2 = Source<string>(2);
19+
L l2 = d2;
20+
Sink(l2.f2); // $ MISSING: hasValueFlow=2
21+
22+
// static write followed by dynamic read
23+
this.f3 = Source<string>(3);
24+
dynamic d3 = this;
25+
Sink(d3.f3); // $ MISSING: hasValueFlow=3
26+
}
27+
28+
public static void Sink(object o) { }
29+
30+
static T Source<T>(object source) => throw null;
31+
}

0 commit comments

Comments
 (0)