mirror of
https://github.com/github/codeql.git
synced 2025-12-17 01:03:14 +01:00
C#: Add FP test for cs/useless-cast-to-self
This commit is contained in:
@@ -22,6 +22,7 @@ class Test
|
||||
var good7 = (Action<int>)((int x) => { });
|
||||
func = x => x;
|
||||
exprFunc = x => x;
|
||||
exprFuncUntyped = (Expression<Func<int, int?>>)(x => x); // FP
|
||||
}
|
||||
|
||||
enum Enum
|
||||
@@ -35,4 +36,5 @@ class Test
|
||||
|
||||
private Func<int, int?> func;
|
||||
private Expression<Func<int, int?>> exprFunc;
|
||||
private LambdaExpression exprFuncUntyped;
|
||||
}
|
||||
|
||||
@@ -2,5 +2,6 @@
|
||||
| UselessCastToSelf.cs:10:20:10:29 | (...) ... | This cast is redundant because the expression already has type Test. |
|
||||
| UselessCastToSelf.cs:11:20:11:31 | ... as ... | This cast is redundant because the expression already has type Test. |
|
||||
| UselessCastToSelf.cs:13:20:13:56 | (...) ... | This cast is redundant because the expression already has type Expression<Func<Int32,Nullable<Int32>>>. |
|
||||
| UselessCastToSelf.cs:31:17:31:22 | (...) ... | This cast is redundant because the expression already has type Int32. |
|
||||
| UselessCastToSelf.cs:33:24:33:29 | (...) ... | This cast is redundant because the expression already has type Int32. |
|
||||
| UselessCastToSelf.cs:25:27:25:63 | (...) ... | This cast is redundant because the expression already has type Expression<Func<Int32,Nullable<Int32>>>. |
|
||||
| UselessCastToSelf.cs:32:17:32:22 | (...) ... | This cast is redundant because the expression already has type Int32. |
|
||||
| UselessCastToSelf.cs:34:24:34:29 | (...) ... | This cast is redundant because the expression already has type Int32. |
|
||||
|
||||
Reference in New Issue
Block a user