Skip to content

Commit b709a88

Browse files
committed
C#: Add cs/unused-collection test case.
1 parent feb97ef commit b709a88

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

csharp/ql/test/query-tests/WriteOnlyContainer/WriteOnlyContainer.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,4 +307,10 @@ void OutTest()
307307
{
308308
Out(out var strings); // BAD: but allow for now (only C# 7 allows discards)
309309
}
310+
311+
IList<int> TestNullcoalescingInitializations()
312+
{
313+
var l = new List<int> { 1, 2, 3 }; // GOOD: returned
314+
return l ??= new List<int>();
315+
}
310316
}

0 commit comments

Comments
 (0)