Skip to content

Commit dae5ca8

Browse files
committed
C#: Add dataflow examples for partial properties.
1 parent e53c750 commit dae5ca8

File tree

1 file changed

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

1 file changed

+38
-0
lines changed

csharp/ql/test/library-tests/dataflow/fields/D.cs

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,41 @@ public static void Sink(object o) { }
5151

5252
static T Source<T>(object source) => throw null;
5353
}
54+
55+
public partial class DPartial
56+
{
57+
private object _backingField;
58+
public partial object PartialProp1
59+
{
60+
get { return _backingField; }
61+
set { _backingField = value; }
62+
}
63+
64+
public partial object PartialProp2
65+
{
66+
get { return null; }
67+
set { }
68+
}
69+
}
70+
71+
public partial class DPartial
72+
{
73+
public partial object PartialProp1 { get; set; }
74+
public partial object PartialProp2 { get; set; }
75+
76+
public void M()
77+
{
78+
var o = Source<object>(1);
79+
80+
var d = new DPartial();
81+
d.PartialProp1 = o;
82+
d.PartialProp2 = o;
83+
84+
Sink(d.PartialProp1); // $ hasValueFlow=1
85+
Sink(d.PartialProp2); // no flow
86+
}
87+
88+
public static void Sink(object o) { }
89+
90+
static T Source<T>(object source) => throw null;
91+
}

0 commit comments

Comments
 (0)