File tree Expand file tree Collapse file tree
ReflectionAnalyzers.Tests/REFL001CastReturnValueTests
ReflectionAnalyzers/Helpers/Reflection Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -14,7 +14,8 @@ public static class MethodInfoInvoke
1414 [ TestCase ( "typeof(C).GetMethod(nameof(M)).Invoke(null, null)" ) ]
1515 [ TestCase ( "typeof(C).GetMethod(nameof(M))!.Invoke(null, null)" ) ]
1616 [ TestCase ( "typeof(C).GetMethod(nameof(M))?.Invoke(null, null)" ) ]
17- //[TestCase("typeof(C).GetMethod(nameof(M))?.Invoke(null, null) ?? throw new Exception()")]
17+ [ TestCase ( "typeof(C).GetMethod(nameof(M))?.Invoke(null, null)!" ) ]
18+ [ TestCase ( "typeof(C).GetMethod(nameof(M))?.Invoke(null, null) ?? throw new Exception()" ) ]
1819 public static void AssigningLocal ( string expression )
1920 {
2021 var before = @"
Original file line number Diff line number Diff line change 11namespace ReflectionAnalyzers
22{
33 using Microsoft . CodeAnalysis ;
4+ using Microsoft . CodeAnalysis . CSharp ;
45 using Microsoft . CodeAnalysis . CSharp . Syntax ;
56
67 internal static class ReturnValue
@@ -20,6 +21,8 @@ internal static class ReturnValue
2021 when ! IsDiscardName ( variableDeclarator . Identifier . ValueText )
2122 => candidate ,
2223 ConditionalAccessExpressionSyntax conditionalAccess => Expression ( conditionalAccess ) ,
24+ BinaryExpressionSyntax { RawKind : ( int ) SyntaxKind . CoalesceExpression } coalesce => Expression ( coalesce ) ,
25+ PostfixUnaryExpressionSyntax { RawKind : ( int ) SyntaxKind . SuppressNullableWarningExpression } bang => Expression ( bang ) ,
2326 ArrowExpressionClauseSyntax => candidate ,
2427 ReturnStatementSyntax => candidate ,
2528 _ => null ,
You can’t perform that action at this time.
0 commit comments