C#: Add FP test for cs/useless-cast-to-self

This commit is contained in:
Tom Hvitved
2022-04-29 11:59:51 +02:00
parent 080271f14f
commit a0e003e33c
2 changed files with 5 additions and 2 deletions

View File

@@ -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;
}

View File

@@ -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. |