C#: Add dataflow examples for partial properties.

This commit is contained in:
Michael Nebel
2025-01-22 09:24:40 +01:00
parent e53c750876
commit dae5ca81a2

View File

@@ -51,3 +51,41 @@ public class D
static T Source<T>(object source) => throw null;
}
public partial class DPartial
{
private object _backingField;
public partial object PartialProp1
{
get { return _backingField; }
set { _backingField = value; }
}
public partial object PartialProp2
{
get { return null; }
set { }
}
}
public partial class DPartial
{
public partial object PartialProp1 { get; set; }
public partial object PartialProp2 { get; set; }
public void M()
{
var o = Source<object>(1);
var d = new DPartial();
d.PartialProp1 = o;
d.PartialProp2 = o;
Sink(d.PartialProp1); // $ hasValueFlow=1
Sink(d.PartialProp2); // no flow
}
public static void Sink(object o) { }
static T Source<T>(object source) => throw null;
}