Skip to content

Commit b066c6f

Browse files
committed
RavenDB-25423 test
1 parent 122dbcf commit b066c6f

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

Raven.CodeAnalysis.Test/BooleanMethodNegationTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ public void ShouldReportDiagnosticOnNegatedBooleanMethod_field()
106106
const string input = @"
107107
class C
108108
{
109-
private bool HasPermission()
109+
internal bool HasPermission()
110110
{
111111
return false;
112112
}
@@ -131,7 +131,7 @@ void M()
131131
Severity = DiagnosticSeverity.Error,
132132
Locations =
133133
[
134-
new DiagnosticResultLocation("Test0.cs", 11, 13)
134+
new DiagnosticResultLocation("Test0.cs", 16, 13)
135135
]
136136
});
137137
}

Raven.CodeAnalysis/BooleanMethodNegation/BooleanMethodNegationAnalyzer.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,11 @@ private static void AnalyzeSyntax(SyntaxNodeAnalysisContext context)
2727
operand = parenthesizedExpressionSyntax.Expression;
2828
}
2929

30-
var invocationExpressionSyntax = operand as InvocationExpressionSyntax;
31-
if (invocationExpressionSyntax == null)
30+
if (operand is InvocationExpressionSyntax invocation == false)
3231
return;
3332

3433
var semanticModel = context.SemanticModel;
35-
var methodSymbol = semanticModel.GetSymbolInfo(invocationExpressionSyntax, context.CancellationToken).Symbol as IMethodSymbol;
34+
var methodSymbol = semanticModel.GetSymbolInfo(invocation, context.CancellationToken).Symbol as IMethodSymbol;
3635

3736
if (methodSymbol?.ReturnType?.SpecialType != SpecialType.System_Boolean)
3837
return;

0 commit comments

Comments
 (0)