Skip to content

Commit b3e56e6

Browse files
committed
C#: Add dispatch examples for partial properties and indexers.
1 parent ff7719f commit b3e56e6

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

csharp/ql/test/library-tests/dispatch/ViableCallable.cs

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -687,3 +687,37 @@ public void Run3(I<int> tor)
687687
tor.M(l);
688688
}
689689
}
690+
691+
public class C23
692+
{
693+
public partial class Partial1
694+
{
695+
public partial object Property { get; set; }
696+
697+
public partial object this[int index] { get; set; }
698+
}
699+
700+
public partial class Partial1
701+
{
702+
public partial object Property { get { return null; } set { } }
703+
704+
public partial object this[int index] { get { return null; } set { } }
705+
}
706+
707+
public void Run1(Partial1 p)
708+
{
709+
object o;
710+
711+
// Viable callable: Partial1.set_Property
712+
p.Property = new object();
713+
714+
// Viable callable: Partial1.get_Property
715+
o = p.Property;
716+
717+
// Viable callable: Partial1.set_Item(int, object)
718+
p[0] = new object();
719+
720+
// Viable callable: Partial1.get_Item(int)
721+
o = p[0];
722+
}
723+
}

0 commit comments

Comments
 (0)