Skip to content

Commit 11d6774

Browse files
committed
C#: Add NullCoalescing example.
1 parent 2e5fc19 commit 11d6774

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

csharp/ql/test/library-tests/dataflow/global/GlobalDataFlow.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,7 @@ void Inner(Action<string> a, bool b, string arg)
490490
Inner(_ => { }, b, "taint source");
491491
}
492492

493-
private class SimpleClass
493+
public class SimpleClass
494494
{
495495
public string field = "";
496496
}
@@ -522,6 +522,14 @@ public void M7()
522522
TaintField((SimpleClass)x);
523523
Check(x.field);
524524
}
525+
526+
public void M8(SimpleClass x)
527+
{
528+
var y = new SimpleClass();
529+
TaintField(x ?? y);
530+
Check(x.field);
531+
Check(y.field);
532+
}
525533
}
526534

527535
static class IEnumerableExtensions

0 commit comments

Comments
 (0)