Files
codeql/csharp/ql/test/query-tests/Nullness/EqualityCheck.ql
Tom Hvitved ab9aa7d338 C#: Teach guards library about conditional assignments
For example, in

```
void M(object x)
{
    var y = x != null ? "" : null;
    if (y != null)
        x.ToString();
}
```

the guard `y != null` implies that the guard `x != null` must be true.
2018-11-30 17:41:36 +01:00

6 lines
157 B
Plaintext

import csharp
import semmle.code.csharp.controlflow.Guards
from Expr e1, AbstractValue v, Expr e2
select Internal::getAnEqualityCheck(e1, v, e2), v, e1, e2