Skip to content

Commit 794ac7f

Browse files
Exclude out parameters from pass-by-reference diagnostics (#32)
* change * update tests
1 parent 7cb5808 commit 794ac7f

2 files changed

Lines changed: 2 additions & 10 deletions

File tree

src/CustomCode-Analyzer/Analyzer.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -887,8 +887,8 @@ ConcurrentDictionary<SyntaxTree, Location> candidateInputSizeLimitDiagnostics
887887
{
888888
foreach (var parameter in methodSymbol.Parameters)
889889
{
890-
// Disallow reference-like (ref/out/in) parameters
891-
if (parameter.RefKind is RefKind.Ref or RefKind.Out or RefKind.In)
890+
// Disallow reference-like (ref/in) parameters
891+
if (parameter.RefKind is RefKind.Ref or RefKind.In)
892892
{
893893
var paramSyntax =
894894
parameter.DeclaringSyntaxReferences.FirstOrDefault()?.GetSyntax()

tests/CustomCode-Analyzer.Tests/AnalyzerTests.cs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1163,10 +1163,6 @@ public void ReadValue(in double number) { }
11631163
.Diagnostic(DiagnosticIds.ParameterByReference)
11641164
.WithSpan(5, 22, 5, 35)
11651165
.WithArguments("value", "UpdateValue"),
1166-
CSharpAnalyzerVerifier<Analyzer>
1167-
.Diagnostic(DiagnosticIds.ParameterByReference)
1168-
.WithSpan(6, 19, 6, 34)
1169-
.WithArguments("text", "GetValue"),
11701166
CSharpAnalyzerVerifier<Analyzer>
11711167
.Diagnostic(DiagnosticIds.ParameterByReference)
11721168
.WithSpan(7, 20, 7, 36)
@@ -1213,10 +1209,6 @@ public void ReadValue(in double number) { }
12131209
.Diagnostic(DiagnosticIds.ParameterByReference)
12141210
.WithSpan(7, 26, 7, 39)
12151211
.WithArguments("value", "UpdateValue"),
1216-
CSharpAnalyzerVerifier<Analyzer>
1217-
.Diagnostic(DiagnosticIds.ParameterByReference)
1218-
.WithSpan(8, 23, 8, 38)
1219-
.WithArguments("text", "GetValue"),
12201212
CSharpAnalyzerVerifier<Analyzer>
12211213
.Diagnostic(DiagnosticIds.ParameterByReference)
12221214
.WithSpan(9, 24, 9, 40)

0 commit comments

Comments
 (0)