mirror of
https://github.com/github/codeql.git
synced 2026-04-29 10:45:15 +02:00
Add test cases to UselessCastToSelf
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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. |
|
||||
|
||||
Reference in New Issue
Block a user