Skip to content

Commit 08d33d5

Browse files
committed
C#: Add some null conditional assignments CFG tests.
1 parent 634802c commit 08d33d5

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

csharp/ql/test/library-tests/controlflow/graph/ConditionalAccess.cs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,25 @@ void M8(bool b, out int i)
3434
i = 0;
3535
Prop?.Out(out i);
3636
}
37+
38+
string StringProp { get; set; }
39+
int IntField;
40+
string this[int index]
41+
{
42+
get { return null; }
43+
set { }
44+
}
45+
46+
void M9(ConditionalAccess ca)
47+
{
48+
ca?.IntField = 42;
49+
ca?.StringProp = "Hello";
50+
ca?[0] = "Set0";
51+
ca?.Prop?.IntField = 84;
52+
ca?.Prop?.StringProp = "World";
53+
ca?.IntField -= 1;
54+
ca?.StringProp += "!";
55+
}
3756
}
3857

3958
static class Ext

0 commit comments

Comments
 (0)