Add test cases to UselessCastToSelf

This commit is contained in:
Tamas Vajk
2020-09-25 10:57:02 +02:00
parent 3577b27f49
commit a635503be0
2 changed files with 11 additions and 0 deletions

View File

@@ -18,4 +18,13 @@ class Test
var good6 = (Action<int>)(delegate (int x) { });
var good7 = (Action<int>)((int x) => { });
}
enum Enum
{
A = 2,
B = 1 | A,
C = 1 | (int)A, // BAD
D = 9 | (32 << A),
E = 9 | (32 << (int)A) // BAD
}
}

View File

@@ -1,3 +1,5 @@
| UselessCastToSelf.cs:8:20:8:25 | (...) ... | This cast is redundant because the expression already has type Int32. |
| UselessCastToSelf.cs:9:20:9:29 | (...) ... | This cast is redundant because the expression already has type Test. |
| UselessCastToSelf.cs:10:20:10:31 | ... as ... | This cast is redundant because the expression already has type Test. |
| UselessCastToSelf.cs:26:17:26:22 | (...) ... | This cast is redundant because the expression already has type Int32. |
| UselessCastToSelf.cs:28:24:28:29 | (...) ... | This cast is redundant because the expression already has type Int32. |