C#: Address review comments.

This commit is contained in:
calum
2019-04-16 17:38:55 +01:00
parent e16cbe0ca1
commit b628060ddd
3 changed files with 6 additions and 5 deletions

View File

@@ -50,7 +50,8 @@ class ConstantNullness
j = (int?)i ?? 1; // BAD
s = ""?.CommaJoinWith(s); // BAD
s = s ?? ""; // GOOD
s = (i==0 ? s : null) ?? s;
s = (i==0 ? s : null) ?? s; // GOOD
var k = (i==0 ? s : null)?.Length; // GOOD
}
}

View File

@@ -4,9 +4,9 @@
| ConstantCondition.cs:49:17:49:18 | "" | Expression is never 'null'. |
| ConstantCondition.cs:50:13:50:19 | (...) ... | Expression is never 'null'. |
| ConstantCondition.cs:51:13:51:14 | "" | Expression is never 'null'. |
| ConstantCondition.cs:63:18:63:18 | 2 | Pattern never matches. |
| ConstantCondition.cs:65:18:65:18 | 3 | Pattern always matches. |
| ConstantCondition.cs:76:18:76:20 | access to type Int32 | Pattern never matches. |
| ConstantCondition.cs:64:18:64:18 | 2 | Pattern never matches. |
| ConstantCondition.cs:66:18:66:18 | 3 | Pattern always matches. |
| ConstantCondition.cs:77:18:77:20 | access to type Int32 | Pattern never matches. |
| ConstantConditionBad.cs:5:16:5:20 | ... > ... | Condition always evaluates to 'false'. |
| ConstantConditionalExpressionCondition.cs:11:22:11:34 | ... == ... | Condition always evaluates to 'true'. |
| ConstantConditionalExpressionCondition.cs:12:21:12:25 | false | Condition always evaluates to 'false'. |