Skip to content

Commit defb328

Browse files
authored
Merge pull request #525 from alrun3/null-conditional-templated-prop
tests: add test case for null-conditional access on templated property
2 parents 6d2e8d7 + 0b80855 commit defb328

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

test/BridgeNetTests/Batch1/src/Templates/PropertyTemplateTests.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,14 @@ public static void PropertyTemplateNullableTest()
195195
Assert.AreEqual(5, test.NullableProp.Value);
196196
}
197197

198+
[Test]
199+
public static void PropertyTemplateNullConditionalOperatorWorks()
200+
{
201+
TestType test = null;
202+
var prop = test?.GetProp;
203+
Assert.Null(prop);
204+
}
205+
198206
#pragma warning disable CS0626 // Method, operator, or accessor is marked external and has no attributes on it
199207
private class TestType
200208
{

0 commit comments

Comments
 (0)